Update to laravel 12, other changes.

This commit is contained in:
Simon Pocrnjič
2025-03-25 21:38:24 +01:00
parent 0f8cfd3f16
commit 86a021143a
22 changed files with 2820 additions and 1504 deletions
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
use App\Models\User;
class InsertDatabaseTest extends TestCase
{
use RefreshDatabase;
/**
* A basic feature test example.
*/
public function test_example(): void
{
$this->actingAs($user = User::factory()->create());
$this->assertTrue(false);
}
}
+4 -1
View File
@@ -6,5 +6,8 @@
abstract class TestCase extends BaseTestCase
{
//
public function testBasicTest(): void
{
$this->assertTrue(true);
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace Tests\Unit;
use Illuminate\Foundation\Testing\WithConsoleEvents;
use Tests\TestCase;
class ConsoleEventTest extends TestCase
{
use WithConsoleEvents;
/**
* A basic unit test example.
*/
public function test_example(): void
{
$this->artisan('question')
->expectsQuestion('What is your name?', 'Taylor Otwell')
->expectsQuestion('Which language do you prefer?', 'PHP')
->expectsOutput('Your name is Taylor Otwell and you prefer PHP.')
->doesntExpectOutput('Your name is Taylor Otwell and you prefer Ruby.')
->assertExitCode(0);
}
}
+31 -2
View File
@@ -9,8 +9,37 @@ class ExampleTest extends TestCase
/**
* A basic test example.
*/
public function test_that_true_is_true(): void
public function test_that_true_is_true(): string
{
$this->assertTrue(true);
$this->assertTrue(false);
return 'first';
}
public function testPushAndPop(): void
{
$stack = [];
$this->assertSame(0, count($stack));
array_push($stack, 'foo');
$this->assertSame('foo', $stack[count($stack)-1]);
$this->assertSame(1, count($stack));
$this->assertSame('foo', array_pop($stack));
$this->assertSame(0, count($stack));
}
public function testDeprecationCanBeExpected(): void
{
$this->expectDeprecation();
// Optionally test that the message is equal to a string
$this->expectDeprecationMessage('foo');
// Or optionally test that the message matches a regular expression
$this->expectDeprecationMessageMatches('/foo/');
\trigger_error('foo', \E_USER_DEPRECATED);
}
}