Skip to content

Commit 005d5e7

Browse files
committed
Fixed mocking issues within GenericRepositoryTest integration class
1 parent 985a09b commit 005d5e7

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

tests/Integration/Repository/GenericRepositoryTest.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,18 @@ public function testThatFindMethodCallsExpectedEntityManagerMethod(): void
325325
ApiKeyEntity::class,
326326
'id',
327327
null,
328-
null
328+
null,
329329
);
330330

331+
$entityManager
332+
->expects($this->once())
333+
->method('isOpen')
334+
->willReturn(true);
335+
331336
$managerObject
332337
->expects($this->once())
333338
->method('getManagerForClass')
339+
->with(ApiKeyEntity::class)
334340
->willReturn($entityManager);
335341

336342
$repository = new ApiKeyRepository($managerObject);
@@ -370,6 +376,11 @@ public function testThatFindOneByMethodCallsExpectedEntityManagerMethod(): void
370376
->with(ApiKeyEntity::class)
371377
->willReturn($repositoryMock);
372378

379+
$entityManager
380+
->expects($this->once())
381+
->method('isOpen')
382+
->willReturn(true);
383+
373384
$managerObject
374385
->expects($this->once())
375386
->method('getManagerForClass')
@@ -419,6 +430,11 @@ public function testThatFindByMethodCallsExpectedEntityManagerMethod(): void
419430
->with(ApiKeyEntity::class)
420431
->willReturn($repositoryMock);
421432

433+
$entityManager
434+
->expects($this->once())
435+
->method('isOpen')
436+
->willReturn(true);
437+
422438
$managerObject
423439
->expects($this->once())
424440
->method('getManagerForClass')
@@ -456,6 +472,11 @@ public function testThatFindAllMethodCallsExpectedEntityManagerMethod(): void
456472
->with(ApiKeyEntity::class)
457473
->willReturn($repositoryMock);
458474

475+
$entityManager
476+
->expects($this->once())
477+
->method('isOpen')
478+
->willReturn(true);
479+
459480
$managerObject
460481
->expects($this->once())
461482
->method('getManagerForClass')

0 commit comments

Comments
 (0)