|
2 | 2 |
|
3 | 3 | namespace SkriptManufaktur\SimpleRestBundle\Tests\Normalizer; |
4 | 4 |
|
5 | | -use Doctrine\ORM\EntityRepository; |
6 | 5 | use Doctrine\Persistence\ManagerRegistry; |
7 | 6 | use Doctrine\Persistence\ObjectManager; |
8 | 7 | use SkriptManufaktur\SimpleRestBundle\Component\EntityIdDenormalizer; |
9 | 8 | use SkriptManufaktur\SimpleRestBundle\Component\EntityUuidDenormalizer; |
| 9 | +use SkriptManufaktur\SimpleRestBundle\Tests\Fixtures\DummyEntityRepository; |
10 | 10 | use SkriptManufaktur\SimpleRestBundle\Tests\Fixtures\EmbeddedDummyEntity; |
11 | 11 | use SkriptManufaktur\SimpleRestBundle\Tests\Fixtures\EmbeddedUuidDummyEntity; |
12 | 12 | use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor; |
@@ -65,28 +65,26 @@ private function createUuidSerializer(string $hydrationMethod): Serializer |
65 | 65 |
|
66 | 66 | private function createManagerRegistry(string $hydratingMethod, string $className, callable $repoCallback): ManagerRegistry |
67 | 67 | { |
68 | | - $repository = $this->getMockBuilder(EntityRepository::class) |
| 68 | + $repository = $this->getStubBuilder(DummyEntityRepository::class) |
69 | 69 | ->disableOriginalConstructor() |
70 | 70 | ->disableOriginalClone() |
71 | | - ->disableArgumentCloning() |
72 | | - ->onlyMethods(['find', 'findAll']) |
73 | | - ->addMethods(['getOne']) |
74 | | - ->getMock() |
| 71 | + ->onlyMethods(['find', 'findAll', 'getOneFromId', 'getOneFromUuid']) |
| 72 | + ->getStub() |
75 | 73 | ; |
76 | 74 |
|
77 | 75 | $repository |
78 | 76 | ->method($hydratingMethod) |
79 | 77 | ->willReturnCallback($repoCallback) |
80 | 78 | ; |
81 | 79 |
|
82 | | - $objManager = $this->createMock(ObjectManager::class); |
| 80 | + $objManager = $this->createStub(ObjectManager::class); |
83 | 81 | $objManager |
84 | 82 | ->method('getRepository') |
85 | 83 | ->with($className) |
86 | 84 | ->willReturn($repository) |
87 | 85 | ; |
88 | 86 |
|
89 | | - $registry = $this->createMock(ManagerRegistry::class); |
| 87 | + $registry = $this->createStub(ManagerRegistry::class); |
90 | 88 | $registry |
91 | 89 | ->method('getManagerForClass') |
92 | 90 | ->with($className) |
|
0 commit comments