Skip to content

Commit faacf63

Browse files
authored
PHPORM-299 Enable PHPUnit 11 (#3286)
1 parent a8f38d9 commit faacf63

16 files changed

+41
-19
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"laravel/scout": "^10.3",
3838
"league/flysystem-gridfs": "^3.28",
3939
"league/flysystem-read-only": "^3.0",
40-
"phpunit/phpunit": "^10.3",
40+
"phpunit/phpunit": "^10.3|^11.5.3",
4141
"orchestra/testbench": "^8.0|^9.0",
4242
"mockery/mockery": "^1.4.4@stable",
4343
"doctrine/coding-standard": "12.0.x-dev",

tests/AuthTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ class AuthTest extends TestCase
1717
{
1818
public function tearDown(): void
1919
{
20-
parent::setUp();
21-
2220
User::truncate();
2321
DB::table('password_reset_tokens')->truncate();
22+
23+
parent::tearDown();
2424
}
2525

2626
public function testAuthAttempt()

tests/Eloquent/CallBuilderTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ final class CallBuilderTest extends TestCase
2121
protected function tearDown(): void
2222
{
2323
User::truncate();
24+
25+
parent::tearDown();
2426
}
2527

2628
#[Dataprovider('provideFunctionNames')]

tests/Eloquent/MassPrunableTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public function tearDown(): void
2020
{
2121
User::truncate();
2222
Soft::truncate();
23+
24+
parent::tearDown();
2325
}
2426

2527
public function testPruneWithQuery(): void

tests/EmbeddedRelationsTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public function tearDown(): void
2020
{
2121
Mockery::close();
2222
User::truncate();
23+
24+
parent::tearDown();
2325
}
2426

2527
public function testEmbedsManySave()

tests/GeospatialTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public function setUp(): void
5353
public function tearDown(): void
5454
{
5555
Schema::drop('locations');
56+
57+
parent::tearDown();
5658
}
5759

5860
public function testGeoWithin()

tests/HybridRelationsTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public function tearDown(): void
4242
Skill::truncate();
4343
Experience::truncate();
4444
Label::truncate();
45+
46+
parent::tearDown();
4547
}
4648

4749
public function testSqlRelations()

tests/ModelTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public function tearDown(): void
5656
Book::truncate();
5757
Item::truncate();
5858
Guarded::truncate();
59+
60+
parent::tearDown();
5961
}
6062

6163
public function testNewModel(): void

tests/QueryBuilderTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public function tearDown(): void
4343
{
4444
DB::table('users')->truncate();
4545
DB::table('items')->truncate();
46+
47+
parent::tearDown();
4648
}
4749

4850
public function testDeleteWithId()

tests/RelationsTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public function tearDown(): void
3535
Photo::truncate();
3636
Label::truncate();
3737
Skill::truncate();
38+
39+
parent::tearDown();
3840
}
3941

4042
public function testHasMany(): void

tests/SchemaTest.php

+8-10
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public function tearDown(): void
2626
assert($database instanceof Database);
2727
$database->dropCollection('newcollection');
2828
$database->dropCollection('newcollection_two');
29+
30+
parent::tearDown();
2931
}
3032

3133
public function testCreate(): void
@@ -37,10 +39,8 @@ public function testCreate(): void
3739

3840
public function testCreateWithCallback(): void
3941
{
40-
$instance = $this;
41-
42-
Schema::create('newcollection', function ($collection) use ($instance) {
43-
$instance->assertInstanceOf(Blueprint::class, $collection);
42+
Schema::create('newcollection', static function ($collection) {
43+
self::assertInstanceOf(Blueprint::class, $collection);
4444
});
4545

4646
$this->assertTrue(Schema::hasCollection('newcollection'));
@@ -66,14 +66,12 @@ public function testDrop(): void
6666

6767
public function testBluePrint(): void
6868
{
69-
$instance = $this;
70-
71-
Schema::table('newcollection', function ($collection) use ($instance) {
72-
$instance->assertInstanceOf(Blueprint::class, $collection);
69+
Schema::table('newcollection', static function ($collection) {
70+
self::assertInstanceOf(Blueprint::class, $collection);
7371
});
7472

75-
Schema::table('newcollection', function ($collection) use ($instance) {
76-
$instance->assertInstanceOf(Blueprint::class, $collection);
73+
Schema::table('newcollection', static function ($collection) {
74+
self::assertInstanceOf(Blueprint::class, $collection);
7775
});
7876
}
7977

tests/SchemaVersionTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class SchemaVersionTest extends TestCase
1515
public function tearDown(): void
1616
{
1717
SchemaVersion::truncate();
18+
19+
parent::tearDown();
1820
}
1921

2022
public function testWithBasicDocument()

tests/Scout/ScoutEngineTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function testSearch(Closure $builder, array $expectedPipeline): void
141141
$this->assertEquals($data, $result);
142142
}
143143

144-
public function provideSearchPipelines(): iterable
144+
public static function provideSearchPipelines(): iterable
145145
{
146146
$defaultPipeline = [
147147
[
@@ -377,11 +377,11 @@ function () {
377377

378378
yield 'with callback' => [
379379
fn () => new Builder(new SearchableModel(), 'query', callback: function (...$args) {
380-
$this->assertCount(3, $args);
381-
$this->assertInstanceOf(Collection::class, $args[0]);
382-
$this->assertSame('collection_searchable', $args[0]->getCollectionName());
383-
$this->assertSame('query', $args[1]);
384-
$this->assertNull($args[2]);
380+
self::assertCount(3, $args);
381+
self::assertInstanceOf(Collection::class, $args[0]);
382+
self::assertSame('collection_searchable', $args[0]->getCollectionName());
383+
self::assertSame('query', $args[1]);
384+
self::assertNull($args[2]);
385385

386386
return $args[0]->aggregate(['pipeline']);
387387
}),

tests/SeederTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class SeederTest extends TestCase
1414
public function tearDown(): void
1515
{
1616
User::truncate();
17+
18+
parent::tearDown();
1719
}
1820

1921
public function testSeed(): void

tests/Ticket/GH2489Test.php

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class GH2489Test extends TestCase
1313
public function tearDown(): void
1414
{
1515
Location::truncate();
16+
17+
parent::tearDown();
1618
}
1719

1820
public function testQuerySubdocumentsUsingWhereInId()

tests/ValidationTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class ValidationTest extends TestCase
1212
public function tearDown(): void
1313
{
1414
User::truncate();
15+
16+
parent::tearDown();
1517
}
1618

1719
public function testUnique(): void

0 commit comments

Comments
 (0)