From 4bebdaefc2c9269c344bb6a69afd8179e3afeafa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Hal=C3=A1sz?= <18699247+peetya@users.noreply.github.com> Date: Mon, 18 Sep 2023 10:23:07 +0200 Subject: [PATCH] fix: fixed failing tests --- .../resource/Repository/ResourceRepositoryTest.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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.');