Skip to content

Commit

Permalink
fix: fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peetya committed Sep 18, 2023
1 parent eec4e5a commit 4bebdae
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/unit/core/resource/Repository/ResourceRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'));
Expand Down Expand Up @@ -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.');
Expand Down

0 comments on commit 4bebdae

Please sign in to comment.