diff --git a/test/unit/core/resource/Repository/ResourceRepositoryTest.php b/test/unit/core/resource/Repository/ResourceRepositoryTest.php index 4c96f1d7e..f56227b4a 100644 --- a/test/unit/core/resource/Repository/ResourceRepositoryTest.php +++ b/test/unit/core/resource/Repository/ResourceRepositoryTest.php @@ -22,6 +22,7 @@ namespace oat\generis\test\unit\model\resource\Repository; +use oat\generis\model\data\event\BeforeResourceDeleted; use RuntimeException; use InvalidArgumentException; use core_kernel_classes_Class; @@ -90,7 +91,7 @@ public function testDeleteSuccess(): void ->method('delete') ->willReturn(true); $this->eventManager - ->expects($this->once()) + ->expects($this->exactly(2)) ->method('trigger'); $context = $this->createContext(4, $this->createResource('resourceUri')); @@ -132,8 +133,11 @@ public function testDeleteFailure(): void ->method('delete') ->willReturn(false); $this->eventManager - ->expects($this->never()) - ->method('trigger'); + ->expects($this->once()) + ->method('trigger') + ->with($this->callback(function ($parameter) { + return $parameter instanceof BeforeResourceDeleted; + })); $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Resource "resourceLabel" ("resourceUri") was not deleted.');