Skip to content

PHPORM-299 Enable PHPUnit 11 #3286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions tests/AuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class AuthTest extends TestCase
{
public function tearDown(): void
{
parent::setUp();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this a longstanding bug? I don't understand why a setUp() method should ever have been called during tearDown().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


User::truncate();
DB::table('password_reset_tokens')->truncate();

parent::tearDown();
}

public function testAuthAttempt()
Expand Down
2 changes: 2 additions & 0 deletions tests/Eloquent/CallBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ final class CallBuilderTest extends TestCase
protected function tearDown(): void
{
User::truncate();

parent::tearDown();
}

#[Dataprovider('provideFunctionNames')]
Expand Down
2 changes: 2 additions & 0 deletions tests/Eloquent/MassPrunableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public function tearDown(): void
{
User::truncate();
Soft::truncate();

parent::tearDown();
}

public function testPruneWithQuery(): void
Expand Down
2 changes: 2 additions & 0 deletions tests/EmbeddedRelationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public function tearDown(): void
{
Mockery::close();
User::truncate();

parent::tearDown();
}

public function testEmbedsManySave()
Expand Down
2 changes: 2 additions & 0 deletions tests/GeospatialTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public function setUp(): void
public function tearDown(): void
{
Schema::drop('locations');

parent::tearDown();
}

public function testGeoWithin()
Expand Down
2 changes: 2 additions & 0 deletions tests/HybridRelationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public function tearDown(): void
Skill::truncate();
Experience::truncate();
Label::truncate();

parent::tearDown();
}

public function testSqlRelations()
Expand Down
2 changes: 2 additions & 0 deletions tests/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public function tearDown(): void
Book::truncate();
Item::truncate();
Guarded::truncate();

parent::tearDown();
}

public function testNewModel(): void
Expand Down
2 changes: 2 additions & 0 deletions tests/QueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public function tearDown(): void
{
DB::table('users')->truncate();
DB::table('items')->truncate();

parent::tearDown();
}

public function testDeleteWithId()
Expand Down
2 changes: 2 additions & 0 deletions tests/RelationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public function tearDown(): void
Photo::truncate();
Label::truncate();
Skill::truncate();

parent::tearDown();
}

public function testHasMany(): void
Expand Down
18 changes: 8 additions & 10 deletions tests/SchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'));
Expand All @@ -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);
});
}

Expand Down
2 changes: 2 additions & 0 deletions tests/SchemaVersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class SchemaVersionTest extends TestCase
public function tearDown(): void
{
SchemaVersion::truncate();

parent::tearDown();
}

public function testWithBasicDocument()
Expand Down
12 changes: 6 additions & 6 deletions tests/Scout/ScoutEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
[
Expand Down Expand Up @@ -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']);
}),
Expand Down
2 changes: 2 additions & 0 deletions tests/SeederTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class SeederTest extends TestCase
public function tearDown(): void
{
User::truncate();

parent::tearDown();
}

public function testSeed(): void
Expand Down
2 changes: 2 additions & 0 deletions tests/Ticket/GH2489Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class GH2489Test extends TestCase
public function tearDown(): void
{
Location::truncate();

parent::tearDown();
}

public function testQuerySubdocumentsUsingWhereInId()
Expand Down
2 changes: 2 additions & 0 deletions tests/ValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class ValidationTest extends TestCase
public function tearDown(): void
{
User::truncate();

parent::tearDown();
}

public function testUnique(): void
Expand Down
Loading