Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.17.x' into 2.18.x
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Jan 18, 2024
2 parents b648bea + a0ed379 commit 2b8d6f8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/Tests/ORM/Functional/EagerFetchCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ protected function setUp(): void
parent::setUp();

$this->createSchemaForModels(EagerFetchOwner::class, EagerFetchChild::class);

// Ensure tables are empty
$this->_em->getRepository(EagerFetchChild::class)->createQueryBuilder('o')->delete()->getQuery()->execute();
$this->_em->getRepository(EagerFetchOwner::class)->createQueryBuilder('o')->delete()->getQuery()->execute();
}

public function testEagerFetchMode(): void
Expand Down Expand Up @@ -91,9 +95,11 @@ public function testEagerFetchWithIterable(): void
$this->_em->clear();

$iterable = $this->_em->getRepository(EagerFetchOwner::class)->createQueryBuilder('o')->getQuery()->toIterable();
$owner = $iterable->current();

$this->assertCount(2, $owner->children);
// There is only a single record, but use a foreach to ensure the iterator is marked as finished and the table lock is released
foreach ($iterable as $owner) {
$this->assertCount(2, $owner->children);
}
}

protected function createOwnerWithChildren(int $children): EagerFetchOwner
Expand Down

0 comments on commit 2b8d6f8

Please sign in to comment.