Skip to content

Commit

Permalink
fixup! Bugfix: respect orderBy for fetch EAGER mode (doctrine#11163)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomr3 committed Apr 24, 2024
1 parent 522145f commit 512448f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/Tests/ORM/Functional/Ticket/GH11163Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ protected function setUp(): void
]);
}

public function tearDown(): void
{
parent::tearDown();

$conn = static::$sharedConn;
$conn->executeStatement('DELETE FROM GH11163BucketItem');
$conn->executeStatement('DELETE FROM GH11163Bucket');
}

public function testFetchEagerModeWithOrderBy(): void
{
// Load entities into database
Expand All @@ -35,11 +44,14 @@ public function testFetchEagerModeWithOrderBy(): void
// Fetch entity from database
$bucket = $this->_em->find(GH11163Bucket::class, 11163);

// Assert associated entity is loaded eagerly
static::assertInstanceOf(GH11163Bucket::class, $bucket);
static::assertInstanceOf(PersistentCollection::class, $bucket->items);
static::assertTrue($bucket->items->isInitialized());

static::assertCount(3, $bucket->items);

// Assert order of entities
static::assertSame(1, $bucket->items[0]->position);
static::assertSame(3, $bucket->items[0]->id);

Expand All @@ -53,7 +65,6 @@ public function testFetchEagerModeWithOrderBy(): void

/**
* @ORM\Entity
* @ORM\Table("gh11163_bucket")
*/
class GH11163Bucket
{
Expand Down Expand Up @@ -86,7 +97,6 @@ public function __construct(int $id)

/**
* @ORM\Entity
* @ORM\Table("gh11163_bucket_item")
*/
class GH11163BucketItem
{
Expand Down

0 comments on commit 512448f

Please sign in to comment.