Skip to content

Commit 46c7eee

Browse files
committed
Laravel 11 support
1 parent e7da2bd commit 46c7eee

12 files changed

+78
-82
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
php: [8.1, 8.2]
11+
php: [8.2, 8.3, 8.4]
1212
stability: [prefer-lowest, prefer-stable]
1313

1414
name: PHP ${{ matrix.php }} / ${{ matrix.stability }}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Laravel-specific Testing Helpers and Assertions.
1717

1818
| Laravel | Testing Tools |
1919
|---------|--------------------------------------------------------------------------|
20-
| 11.x | _[Support](https://buymeacoffee.com/dmitry.ivanov)_ |
20+
| 11.x | [11.x](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/11.x) |
2121
| 10.x | [10.x](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/10.x) |
2222
| 9.x | [9.x](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/9.x) |
2323
| 8.x | [8.x](https://github.com/dmitry-ivanov/laravel-testing-tools/tree/8.x) |
@@ -58,7 +58,7 @@ Laravel-specific Testing Helpers and Assertions.
5858
```php
5959
class ExampleTest extends TestCase
6060
{
61-
/** @test */
61+
#[Test]
6262
public function it_has_lots_of_useful_assertions()
6363
{
6464
$this->assertDatabaseHasMany('posts', [
@@ -249,7 +249,7 @@ Assert that the given log file doesn't exist.
249249
The path is relative to the `storage/logs` folder:
250250

251251
```php
252-
$this->dontSeeLogFile('foobarbaz.log');
252+
$this->dontSeeLogFile('foo.log');
253253
```
254254

255255
#### `seeInLogFile()`
@@ -340,7 +340,7 @@ $this->seeInSchedule('baz', '0 1,13 * * * *');
340340
Assert that the given command is not scheduled:
341341

342342
```php
343-
$this->dontSeeInSchedule('foobarbaz');
343+
$this->dontSeeInSchedule('foo');
344344
```
345345

346346
## Sponsors

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
"email": "dmitry.g.ivanov@gmail.com"
1313
}],
1414
"require": {
15-
"php": "^8.1",
16-
"illuminate/database": "^10.0",
17-
"illuminate/support": "^10.0",
18-
"mockery/mockery": "^1.5.1"
15+
"php": "^8.2",
16+
"illuminate/database": "^11.0",
17+
"illuminate/support": "^11.0",
18+
"mockery/mockery": "^1.6"
1919
},
2020
"require-dev": {
21-
"phpunit/phpunit": "^10.5",
22-
"orchestra/testbench": "^8.0"
21+
"phpunit/phpunit": "^11.3",
22+
"orchestra/testbench": "^9.0"
2323
},
2424
"autoload": {
2525
"psr-4": {

phpunit.xml.dist

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
3-
backupGlobals="false"
4-
backupStaticProperties="false"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd"
53
beStrictAboutTestsThatDoNotTestAnything="false"
64
beStrictAboutOutputDuringTests="true"
75
bootstrap="vendor/autoload.php"
8-
cacheDirectory=".phpunit.cache"
96
colors="true"
10-
processIsolation="false"
11-
stopOnError="false"
12-
stopOnFailure="false"
7+
displayDetailsOnPhpunitDeprecations="true"
138
>
149
<testsuites>
1510
<testsuite name="Laravel Testing Tools Test Suite">
16-
<directory suffix="Test.php">./tests</directory>
11+
<directory>./tests</directory>
1712
</testsuite>
1813
</testsuites>
1914

2015
<source>
2116
<include>
22-
<directory suffix=".php">./src</directory>
17+
<directory>./src</directory>
2318
</include>
2419
</source>
2520
</phpunit>

tests/Asserts/CollectionAssertsTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
namespace Illuminated\Testing\Tests\Asserts;
44

55
use Illuminated\Testing\Tests\TestCase;
6+
use PHPUnit\Framework\Attributes\Test;
67

78
class CollectionAssertsTest extends TestCase
89
{
9-
/** @test */
10-
public function it_has_collections_equal_assertion()
10+
#[Test]
11+
public function it_has_collections_equal_assertion(): void
1112
{
1213
$collection1 = collect([
1314
['id' => 1, 'name' => 'John Doe'],
@@ -24,8 +25,8 @@ public function it_has_collections_equal_assertion()
2425
$this->assertCollectionsEqual($collection1, $collection2, 'id');
2526
}
2627

27-
/** @test */
28-
public function it_has_collections_not_equal_assertion()
28+
#[Test]
29+
public function it_has_collections_not_equal_assertion(): void
2930
{
3031
$collection1 = collect([
3132
['id' => 1, 'name' => 'John Doe'],

tests/Asserts/DatabaseAssertsTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@
44

55
use Illuminated\Testing\Tests\App\Post;
66
use Illuminated\Testing\Tests\TestCase;
7+
use PHPUnit\Framework\Attributes\Test;
78

89
class DatabaseAssertsTest extends TestCase
910
{
10-
/** @test */
11-
public function it_has_database_has_table_assertion()
11+
#[Test]
12+
public function it_has_database_has_table_assertion(): void
1213
{
1314
$this->assertDatabaseHasTable('posts');
1415
}
1516

16-
/** @test */
17-
public function it_has_database_missing_table_assertion()
17+
#[Test]
18+
public function it_has_database_missing_table_assertion(): void
1819
{
1920
$this->assertDatabaseMissingTable('unicorns');
2021
}
2122

22-
/** @test */
23-
public function it_has_database_has_many_assertion()
23+
#[Test]
24+
public function it_has_database_has_many_assertion(): void
2425
{
2526
Post::factory()->create(['title' => 'First Post']);
2627
Post::factory()->create(['title' => 'Second Post']);
@@ -33,8 +34,8 @@ public function it_has_database_has_many_assertion()
3334
]);
3435
}
3536

36-
/** @test */
37-
public function it_has_database_missing_many_assertion()
37+
#[Test]
38+
public function it_has_database_missing_many_assertion(): void
3839
{
3940
$this->assertDatabaseMissingMany('posts', [
4041
['title' => 'Fourth Post'],

tests/Asserts/FilesystemAssertsTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,32 @@
33
namespace Illuminated\Testing\Tests\Asserts;
44

55
use Illuminated\Testing\Tests\TestCase;
6+
use PHPUnit\Framework\Attributes\Test;
67

78
class FilesystemAssertsTest extends TestCase
89
{
9-
/** @test */
10-
public function it_has_directory_empty_assertion()
10+
#[Test]
11+
public function it_has_directory_empty_assertion(): void
1112
{
1213
$this->assertDirectoryEmpty(__DIR__ . '/FilesystemAssertsTest/Empty');
1314
}
1415

15-
/** @test */
16-
public function it_has_directory_not_empty_assertion()
16+
#[Test]
17+
public function it_has_directory_not_empty_assertion(): void
1718
{
1819
$this->assertDirectoryNotEmpty(__DIR__ . '/FilesystemAssertsTest/NotEmpty');
1920
$this->assertDirectoryNotEmpty(__DIR__ . '/FilesystemAssertsTest/WithSubDirectory');
2021
}
2122

22-
/** @test */
23-
public function it_has_files_count_assertion()
23+
#[Test]
24+
public function it_has_files_count_assertion(): void
2425
{
2526
$this->assertFilesCount(__DIR__ . '/FilesystemAssertsTest/NotEmpty', 3);
2627
$this->assertFilesCount(__DIR__ . '/FilesystemAssertsTest/WithSubDirectory', 0);
2728
}
2829

29-
/** @test */
30-
public function it_has_not_files_count_assertion()
30+
#[Test]
31+
public function it_has_not_files_count_assertion(): void
3132
{
3233
$this->assertNotFilesCount(__DIR__ . '/FilesystemAssertsTest/NotEmpty', 1);
3334
$this->assertNotFilesCount(__DIR__ . '/FilesystemAssertsTest/NotEmpty', 2);

tests/Asserts/LogFileAssertsTest.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Carbon\Carbon;
66
use Illuminate\Support\Facades\File;
77
use Illuminated\Testing\Tests\TestCase;
8+
use PHPUnit\Framework\Attributes\Test;
89

910
class LogFileAssertsTest extends TestCase
1011
{
@@ -31,28 +32,28 @@ private function createSampleLogFile(): void
3132
File::append($path, "[{$date}]: Sample log message 3!\n");
3233
}
3334

34-
/** @test */
35-
public function it_has_see_log_file_assertion()
35+
#[Test]
36+
public function it_has_see_log_file_assertion(): void
3637
{
3738
$this->seeLogFile('example.log');
3839
}
3940

40-
/** @test */
41-
public function it_has_dont_see_log_file_assertion()
41+
#[Test]
42+
public function it_has_dont_see_log_file_assertion(): void
4243
{
4344
$this->dontSeeLogFile('fake.log');
4445
}
4546

46-
/** @test */
47-
public function it_has_see_in_log_file_assertion()
47+
#[Test]
48+
public function it_has_see_in_log_file_assertion(): void
4849
{
4950
$this->seeInLogFile('example.log', 'Sample log message 1!');
5051
$this->seeInLogFile('example.log', 'Sample log message 2!');
5152
$this->seeInLogFile('example.log', 'Sample log message 3!');
5253
}
5354

54-
/** @test */
55-
public function which_supports_array_of_contents()
55+
#[Test]
56+
public function which_supports_array_of_contents(): void
5657
{
5758
$this->seeInLogFile('example.log', [
5859
'Sample log message 1!',
@@ -61,24 +62,24 @@ public function which_supports_array_of_contents()
6162
]);
6263
}
6364

64-
/** @test */
65-
public function which_supports_datetime_placeholder()
65+
#[Test]
66+
public function which_supports_datetime_placeholder(): void
6667
{
6768
$this->seeInLogFile('example.log', '[%datetime%]: Sample log message 1!');
6869
$this->seeInLogFile('example.log', '[%datetime%]: Sample log message 2!');
6970
$this->seeInLogFile('example.log', '[%datetime%]: Sample log message 3!');
7071
}
7172

72-
/** @test */
73-
public function it_has_dont_see_in_log_file_assertion()
73+
#[Test]
74+
public function it_has_dont_see_in_log_file_assertion(): void
7475
{
7576
$this->dontSeeInLogFile('example.log', 'Not existing log message 1!');
7677
$this->dontSeeInLogFile('example.log', 'Not existing log message 2!');
7778
$this->dontSeeInLogFile('example.log', 'Not existing log message 3!');
7879
}
7980

80-
/** @test */
81-
public function which_also_supports_array_of_contents()
81+
#[Test]
82+
public function which_also_supports_array_of_contents(): void
8283
{
8384
$this->dontSeeInLogFile('example.log', [
8485
'Not existing log message 1!',

tests/Asserts/ScheduleAssertsTest.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@
44

55
use Illuminate\Console\Scheduling\Schedule;
66
use Illuminated\Testing\Tests\TestCase;
7+
use PHPUnit\Framework\Attributes\Test;
78

89
class ScheduleAssertsTest extends TestCase
910
{
1011
/**
1112
* Resolve application Console Kernel implementation.
12-
*
13-
* @param \Illuminate\Foundation\Application $app
14-
* @return void
1513
*/
16-
protected function resolveApplicationConsoleKernel($app)
14+
protected function resolveApplicationConsoleKernel($app): void
1715
{
1816
parent::resolveApplicationConsoleKernel($app);
1917

@@ -34,39 +32,39 @@ private function createSampleSchedule(): void
3432
});
3533
}
3634

37-
/** @test */
38-
public function it_has_see_schedule_count_assertion()
35+
#[Test]
36+
public function it_has_see_schedule_count_assertion(): void
3937
{
4038
$this->seeScheduleCount(3);
4139
}
4240

43-
/** @test */
44-
public function it_has_dont_see_schedule_count_assertion()
41+
#[Test]
42+
public function it_has_dont_see_schedule_count_assertion(): void
4543
{
4644
$this->dontSeeScheduleCount(1);
4745
$this->dontSeeScheduleCount(2);
4846
$this->dontSeeScheduleCount(4);
4947
$this->dontSeeScheduleCount(5);
5048
}
5149

52-
/** @test */
53-
public function it_has_see_in_schedule_assertion()
50+
#[Test]
51+
public function it_has_see_in_schedule_assertion(): void
5452
{
5553
$this->seeInSchedule('foo', '*/5 * * * *');
5654
$this->seeInSchedule('bar', '0 * * * *');
5755
$this->seeInSchedule('baz', '0 1,13 * * *', true);
5856
}
5957

60-
/** @test */
61-
public function which_allows_expressions_same_as_schedule_methods()
58+
#[Test]
59+
public function which_allows_expressions_same_as_schedule_methods(): void
6260
{
6361
$this->seeInSchedule('foo', 'everyFiveMinutes');
6462
$this->seeInSchedule('bar', 'hourly');
6563
$this->seeInSchedule('baz', 'twiceDaily', true);
6664
}
6765

68-
/** @test */
69-
public function it_has_dont_see_in_schedule_assertion()
66+
#[Test]
67+
public function it_has_dont_see_in_schedule_assertion(): void
7068
{
7169
$this->dontSeeInSchedule('fake');
7270
}

tests/Helpers/ApplicationHelpersTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,28 @@
33
namespace Illuminated\Testing\Tests\Helpers;
44

55
use Illuminated\Testing\Tests\TestCase;
6+
use PHPUnit\Framework\Attributes\Test;
67

78
class ApplicationHelpersTest extends TestCase
89
{
9-
/** @test */
10-
public function it_can_emulate_local_environment()
10+
#[Test]
11+
public function it_can_emulate_local_environment(): void
1112
{
1213
$this->emulateLocal();
1314

1415
$this->assertEquals('local', $this->app->environment());
1516
}
1617

17-
/** @test */
18-
public function it_can_emulate_production_environment()
18+
#[Test]
19+
public function it_can_emulate_production_environment(): void
1920
{
2021
$this->emulateProduction();
2122

2223
$this->assertEquals('production', $this->app->environment());
2324
}
2425

25-
/** @test */
26-
public function it_can_emulate_any_environment()
26+
#[Test]
27+
public function it_can_emulate_any_environment(): void
2728
{
2829
$this->emulateEnvironment('demo');
2930

tests/TestCase.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,8 @@ private function setUpStorage(): void
5555

5656
/**
5757
* Resolve application Console Kernel implementation.
58-
*
59-
* @param \Illuminate\Foundation\Application $app
60-
* @return void
6158
*/
62-
protected function resolveApplicationConsoleKernel($app)
59+
protected function resolveApplicationConsoleKernel($app): void
6360
{
6461
parent::resolveApplicationConsoleKernel($app);
6562

0 commit comments

Comments
 (0)