diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-10-08 01:10:49 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-10-08 01:10:49 +0200 |
commit | a35d4e7b44764c2eebec77c8b4e8de2636c60cad (patch) | |
tree | 1a2ff9b735e5ddb6115d05164ae616d524428fff /apps/comments/tests | |
parent | 006da9afd725060d48fd81893094256ddced0099 (diff) | |
download | nextcloud-server-a35d4e7b44764c2eebec77c8b4e8de2636c60cad.tar.gz nextcloud-server-a35d4e7b44764c2eebec77c8b4e8de2636c60cad.zip |
remove notifications of deleted comments from the DB
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/comments/tests')
-rw-r--r-- | apps/comments/tests/Unit/EventHandlerTest.php | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/apps/comments/tests/Unit/EventHandlerTest.php b/apps/comments/tests/Unit/EventHandlerTest.php index 7a630329974..21b701ea8cc 100644 --- a/apps/comments/tests/Unit/EventHandlerTest.php +++ b/apps/comments/tests/Unit/EventHandlerTest.php @@ -71,14 +71,13 @@ class EventHandlerTest extends TestCase { public function notHandledProvider() { return [ - [CommentsEvent::EVENT_DELETE], [CommentsEvent::EVENT_UPDATE] ]; } /** * @dataProvider notHandledProvider - * @param $eventType + * @param string $eventType */ public function testNotHandled($eventType) { /** @var IComment|\PHPUnit_Framework_MockObject_MockObject $comment */ @@ -103,7 +102,18 @@ class EventHandlerTest extends TestCase { $this->eventHandler->handle($event); } - public function testHandled() { + public function handledProvider() { + return [ + [CommentsEvent::EVENT_DELETE], + [CommentsEvent::EVENT_ADD] + ]; + } + + /** + * @dataProvider handledProvider + * @param string $eventType + */ + public function testHandled($eventType) { /** @var IComment|\PHPUnit_Framework_MockObject_MockObject $comment */ $comment = $this->getMockBuilder(IComment::class)->getMock(); $comment->expects($this->once()) @@ -119,7 +129,7 @@ class EventHandlerTest extends TestCase { ->willReturn($comment); $event->expects($this->atLeastOnce()) ->method('getEvent') - ->willReturn(CommentsEvent::EVENT_ADD); + ->willReturn($eventType); $notificationListener = $this->getMockBuilder(NotificationListener::class) ->disableOriginalConstructor() @@ -131,13 +141,13 @@ class EventHandlerTest extends TestCase { $activityListener = $this->getMockBuilder(ActivityListener::class) ->disableOriginalConstructor() ->getMock(); - $activityListener->expects($this->once()) + $activityListener->expects($this->any()) ->method('commentEvent') ->with($event); /** @var IContainer|\PHPUnit_Framework_MockObject_MockObject $c */ $c = $this->getMockBuilder(IContainer::class)->getMock(); - $c->expects($this->exactly(2)) + $c->expects($this->atLeastOnce()) ->method('query') ->withConsecutive([NotificationListener::class], [ActivityListener::class]) ->willReturnOnConsecutiveCalls($notificationListener, $activityListener); |