-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from kbond/orm3
Support ORM 3+, DBAL 4+, Pagerfanta 4+
- Loading branch information
Showing
6 changed files
with
77 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,15 @@ | |
|
||
namespace Zenstruck\Collection\Tests\Doctrine\ORM\Bridge; | ||
|
||
use Zenstruck\Collection\Doctrine\ObjectRepository; | ||
use Zenstruck\Collection\Doctrine\ORM\Bridge\ORMEntityRepository; | ||
use Zenstruck\Collection\Tests\Doctrine\Fixture\Entity; | ||
use Zenstruck\Collection\Tests\Doctrine\ORM\EntityRepositoryTest; | ||
|
||
/** | ||
* @author Kevin Bond <[email protected]> | ||
*/ | ||
final class ORMEntityRepositoryTest extends EntityRepositoryTest | ||
class ORMEntityRepositoryTest extends EntityRepositoryTest | ||
{ | ||
/** | ||
* @test | ||
|
@@ -38,7 +39,15 @@ public function find_all_is_empty_if_repository_is_empty(): void | |
$this->assertSame([], $this->createWithItems(0)->findAll()); | ||
} | ||
|
||
protected function repo(): ORMEntityRepository | ||
/** | ||
* @test | ||
*/ | ||
public function can_create_query_builder(): void | ||
{ | ||
$this->assertEmpty($this->repo()->createQueryBuilder('e')->getQuery()->execute()); | ||
} | ||
|
||
protected function repo(): ObjectRepository | ||
{ | ||
return new ORMEntityRepository($this->em, $this->em->getClassMetadata(Entity::class)); | ||
} | ||
|
30 changes: 30 additions & 0 deletions
30
tests/Doctrine/ORM/Bridge/ORMServiceEntityRepositoryTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the zenstruck/collection package. | ||
* | ||
* (c) Kevin Bond <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Zenstruck\Collection\Tests\Doctrine\ORM\Bridge; | ||
|
||
use Doctrine\Persistence\ManagerRegistry; | ||
use Zenstruck\Collection\Doctrine\ORM\Bridge\ORMServiceEntityRepository; | ||
use Zenstruck\Collection\Tests\Doctrine\Fixture\Entity; | ||
|
||
/** | ||
* @author Kevin Bond <[email protected]> | ||
*/ | ||
final class ORMServiceEntityRepositoryTest extends ORMEntityRepositoryTest | ||
{ | ||
protected function repo(): ORMServiceEntityRepository | ||
{ | ||
$manager = $this->createMock(ManagerRegistry::class); | ||
$manager->method('getManagerForClass')->willReturn($this->em); | ||
|
||
return new ORMServiceEntityRepository($manager, Entity::class); | ||
} | ||
} |