diff --git a/composer.json b/composer.json index 6df5c0575..27e793477 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "laravel/scout": "^10.3", "league/flysystem-gridfs": "^3.28", "league/flysystem-read-only": "^3.0", - "phpunit/phpunit": "^10.3", + "phpunit/phpunit": "^10.3|^11.5.3", "orchestra/testbench": "^8.0|^9.0", "mockery/mockery": "^1.4.4@stable", "doctrine/coding-standard": "12.0.x-dev", diff --git a/tests/AuthTest.php b/tests/AuthTest.php index 98d42832e..998c07f2d 100644 --- a/tests/AuthTest.php +++ b/tests/AuthTest.php @@ -17,10 +17,10 @@ class AuthTest extends TestCase { public function tearDown(): void { - parent::setUp(); - User::truncate(); DB::table('password_reset_tokens')->truncate(); + + parent::tearDown(); } public function testAuthAttempt() diff --git a/tests/Eloquent/CallBuilderTest.php b/tests/Eloquent/CallBuilderTest.php index fa4cb4580..39643f1c1 100644 --- a/tests/Eloquent/CallBuilderTest.php +++ b/tests/Eloquent/CallBuilderTest.php @@ -21,6 +21,8 @@ final class CallBuilderTest extends TestCase protected function tearDown(): void { User::truncate(); + + parent::tearDown(); } #[Dataprovider('provideFunctionNames')] diff --git a/tests/Eloquent/MassPrunableTest.php b/tests/Eloquent/MassPrunableTest.php index 0f6f2ab15..884f90ac6 100644 --- a/tests/Eloquent/MassPrunableTest.php +++ b/tests/Eloquent/MassPrunableTest.php @@ -20,6 +20,8 @@ public function tearDown(): void { User::truncate(); Soft::truncate(); + + parent::tearDown(); } public function testPruneWithQuery(): void diff --git a/tests/EmbeddedRelationsTest.php b/tests/EmbeddedRelationsTest.php index 8ee8297f7..1c68e2d34 100644 --- a/tests/EmbeddedRelationsTest.php +++ b/tests/EmbeddedRelationsTest.php @@ -20,6 +20,8 @@ public function tearDown(): void { Mockery::close(); User::truncate(); + + parent::tearDown(); } public function testEmbedsManySave() diff --git a/tests/GeospatialTest.php b/tests/GeospatialTest.php index 724bb580b..b29a3240a 100644 --- a/tests/GeospatialTest.php +++ b/tests/GeospatialTest.php @@ -53,6 +53,8 @@ public function setUp(): void public function tearDown(): void { Schema::drop('locations'); + + parent::tearDown(); } public function testGeoWithin() diff --git a/tests/HybridRelationsTest.php b/tests/HybridRelationsTest.php index 71958d27d..08423007c 100644 --- a/tests/HybridRelationsTest.php +++ b/tests/HybridRelationsTest.php @@ -42,6 +42,8 @@ public function tearDown(): void Skill::truncate(); Experience::truncate(); Label::truncate(); + + parent::tearDown(); } public function testSqlRelations() diff --git a/tests/ModelTest.php b/tests/ModelTest.php index ef71a5fe0..ecfcb2b6a 100644 --- a/tests/ModelTest.php +++ b/tests/ModelTest.php @@ -56,6 +56,8 @@ public function tearDown(): void Book::truncate(); Item::truncate(); Guarded::truncate(); + + parent::tearDown(); } public function testNewModel(): void diff --git a/tests/QueryBuilderTest.php b/tests/QueryBuilderTest.php index 01f937915..9592bbe7c 100644 --- a/tests/QueryBuilderTest.php +++ b/tests/QueryBuilderTest.php @@ -43,6 +43,8 @@ public function tearDown(): void { DB::table('users')->truncate(); DB::table('items')->truncate(); + + parent::tearDown(); } public function testDeleteWithId() diff --git a/tests/RelationsTest.php b/tests/RelationsTest.php index a58fef02f..a55c8c0e0 100644 --- a/tests/RelationsTest.php +++ b/tests/RelationsTest.php @@ -35,6 +35,8 @@ public function tearDown(): void Photo::truncate(); Label::truncate(); Skill::truncate(); + + parent::tearDown(); } public function testHasMany(): void diff --git a/tests/SchemaTest.php b/tests/SchemaTest.php index 34029aa32..e2f4f7b7e 100644 --- a/tests/SchemaTest.php +++ b/tests/SchemaTest.php @@ -26,6 +26,8 @@ public function tearDown(): void assert($database instanceof Database); $database->dropCollection('newcollection'); $database->dropCollection('newcollection_two'); + + parent::tearDown(); } public function testCreate(): void @@ -37,10 +39,8 @@ public function testCreate(): void public function testCreateWithCallback(): void { - $instance = $this; - - Schema::create('newcollection', function ($collection) use ($instance) { - $instance->assertInstanceOf(Blueprint::class, $collection); + Schema::create('newcollection', static function ($collection) { + self::assertInstanceOf(Blueprint::class, $collection); }); $this->assertTrue(Schema::hasCollection('newcollection')); @@ -66,14 +66,12 @@ public function testDrop(): void public function testBluePrint(): void { - $instance = $this; - - Schema::table('newcollection', function ($collection) use ($instance) { - $instance->assertInstanceOf(Blueprint::class, $collection); + Schema::table('newcollection', static function ($collection) { + self::assertInstanceOf(Blueprint::class, $collection); }); - Schema::table('newcollection', function ($collection) use ($instance) { - $instance->assertInstanceOf(Blueprint::class, $collection); + Schema::table('newcollection', static function ($collection) { + self::assertInstanceOf(Blueprint::class, $collection); }); } diff --git a/tests/SchemaVersionTest.php b/tests/SchemaVersionTest.php index 4a205c77b..b8048b71a 100644 --- a/tests/SchemaVersionTest.php +++ b/tests/SchemaVersionTest.php @@ -15,6 +15,8 @@ class SchemaVersionTest extends TestCase public function tearDown(): void { SchemaVersion::truncate(); + + parent::tearDown(); } public function testWithBasicDocument() diff --git a/tests/Scout/ScoutEngineTest.php b/tests/Scout/ScoutEngineTest.php index f1244d060..40d943ffb 100644 --- a/tests/Scout/ScoutEngineTest.php +++ b/tests/Scout/ScoutEngineTest.php @@ -141,7 +141,7 @@ public function testSearch(Closure $builder, array $expectedPipeline): void $this->assertEquals($data, $result); } - public function provideSearchPipelines(): iterable + public static function provideSearchPipelines(): iterable { $defaultPipeline = [ [ @@ -377,11 +377,11 @@ function () { yield 'with callback' => [ fn () => new Builder(new SearchableModel(), 'query', callback: function (...$args) { - $this->assertCount(3, $args); - $this->assertInstanceOf(Collection::class, $args[0]); - $this->assertSame('collection_searchable', $args[0]->getCollectionName()); - $this->assertSame('query', $args[1]); - $this->assertNull($args[2]); + self::assertCount(3, $args); + self::assertInstanceOf(Collection::class, $args[0]); + self::assertSame('collection_searchable', $args[0]->getCollectionName()); + self::assertSame('query', $args[1]); + self::assertNull($args[2]); return $args[0]->aggregate(['pipeline']); }), diff --git a/tests/SeederTest.php b/tests/SeederTest.php index a6122ce17..71f36943c 100644 --- a/tests/SeederTest.php +++ b/tests/SeederTest.php @@ -14,6 +14,8 @@ class SeederTest extends TestCase public function tearDown(): void { User::truncate(); + + parent::tearDown(); } public function testSeed(): void diff --git a/tests/Ticket/GH2489Test.php b/tests/Ticket/GH2489Test.php index 62ce11d0e..09fa111ea 100644 --- a/tests/Ticket/GH2489Test.php +++ b/tests/Ticket/GH2489Test.php @@ -13,6 +13,8 @@ class GH2489Test extends TestCase public function tearDown(): void { Location::truncate(); + + parent::tearDown(); } public function testQuerySubdocumentsUsingWhereInId() diff --git a/tests/ValidationTest.php b/tests/ValidationTest.php index d5122ce7b..9d2089af5 100644 --- a/tests/ValidationTest.php +++ b/tests/ValidationTest.php @@ -12,6 +12,8 @@ class ValidationTest extends TestCase public function tearDown(): void { User::truncate(); + + parent::tearDown(); } public function testUnique(): void