From 8c7d0f914e9d4e76d7236ad965349bfd8be39b4e Mon Sep 17 00:00:00 2001 From: grnd-alt Date: Tue, 3 Dec 2024 21:19:09 +0100 Subject: [PATCH] fix(tests): remove redundant unit test for activity Signed-off-by: grnd-alt --- apps/files/tests/Service/TagServiceTest.php | 40 --------------------- 1 file changed, 40 deletions(-) diff --git a/apps/files/tests/Service/TagServiceTest.php b/apps/files/tests/Service/TagServiceTest.php index a05025e98e1ae..0e0149cc71b64 100644 --- a/apps/files/tests/Service/TagServiceTest.php +++ b/apps/files/tests/Service/TagServiceTest.php @@ -9,9 +9,6 @@ use OCA\Files\Service\TagService; use OCP\Activity\IManager; -use OCP\EventDispatcher\IEventDispatcher; -use OCP\Files\Events\NodeAddedToFavorite; -use OCP\Files\Events\NodeRemovedFromFavorite; use OCP\Files\Folder; use OCP\Files\NotFoundException; use OCP\ITags; @@ -43,9 +40,6 @@ class TagServiceTest extends \Test\TestCase { */ private $root; - /** @var IEventDispatcher|\PHPUnit\Framework\MockObject\MockObject */ - private $dispatcher; - /** * @var TagService|\PHPUnit\Framework\MockObject\MockObject */ @@ -74,7 +68,6 @@ protected function setUp(): void { ->willReturn($user); $this->root = \OC::$server->getUserFolder(); - $this->dispatcher = $this->createMock(IEventDispatcher::class); $this->tagger = \OC::$server->getTagManager()->load('files'); $this->tagService = $this->getTagService(['addActivity']); @@ -108,9 +101,6 @@ public function testUpdateFileTags(): void { $tag1 = 'tag1'; $tag2 = 'tag2'; - $this->dispatcher->expects($this->never()) - ->method('dispatchTyped'); - $subdir = $this->root->newFolder('subdir'); $testFile = $subdir->newFile('test.txt'); $testFile->putContent('test contents'); @@ -142,36 +132,6 @@ public function testUpdateFileTags(): void { } $this->assertTrue($caught); - $subdir->delete(); - } - - public function testFavoriteActivity(): void { - $subdir = $this->root->newFolder('subdir'); - $file = $subdir->newFile('test.txt'); - - $invokedCount = $this->exactly(2); - - $this->dispatcher->expects($invokedCount) - ->method('dispatchTyped') - ->willReturnCallback(function ($event) use ($invokedCount, $file) { - if ($invokedCount->getInvocationCount() === 1) { - $this->assertInstanceOf(NodeAddedToFavorite::class, $event); - } - if ($invokedCount->getInvocationCount() === 2) { - $this->assertInstanceOf(NodeRemovedFromFavorite::class, $event); - } - $this->assertEquals($this->userSession->getUser()->getUID(), $event->getUser()->getUID()); - $this->assertEquals('subdir/test.txt', $event->getPath()); - $this->assertEquals($file->getId(), $event->getFileId()); - }); - - // set tags - $this->tagService->updateFileTags('subdir/test.txt', [ITags::TAG_FAVORITE]); - - // remove tag - $this->tagService->updateFileTags('subdir/test.txt', []); - - $subdir->delete(); } }