diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-26 00:21:27 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-26 00:21:27 +0300 |
commit | 2ee65f177e4f7e09ad2287f14d564e7068d322fb (patch) | |
tree | 39075e87ea7927e20e8956824cb7c49bf626b178 /apps/comments | |
parent | 3cf321fdfc4235a87015a9af2f59c63220016c65 (diff) |
Use the shorter phpunit syntax for mocked return values
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/comments')
-rw-r--r-- | apps/comments/tests/Unit/Notification/ListenerTest.php | 36 | ||||
-rw-r--r-- | apps/comments/tests/Unit/Notification/NotifierTest.php | 4 |
2 files changed, 20 insertions, 20 deletions
diff --git a/apps/comments/tests/Unit/Notification/ListenerTest.php b/apps/comments/tests/Unit/Notification/ListenerTest.php index ee4f296ed0a..1972244a38e 100644 --- a/apps/comments/tests/Unit/Notification/ListenerTest.php +++ b/apps/comments/tests/Unit/Notification/ListenerTest.php @@ -78,10 +78,10 @@ class ListenerTest extends TestCase { $comment = $this->getMockBuilder(IComment::class)->getMock(); $comment->expects($this->any()) ->method('getObjectType') - ->will($this->returnValue('files')); + ->willReturn('files'); $comment->expects($this->any()) ->method('getCreationDateTime') - ->will($this->returnValue(new \DateTime())); + ->willReturn(new \DateTime()); $comment->expects($this->once()) ->method('getMentions') ->willReturn([ @@ -102,22 +102,22 @@ class ListenerTest extends TestCase { ->getMock(); $event->expects($this->once()) ->method('getComment') - ->will($this->returnValue($comment)); + ->willReturn($comment); $event->expects(($this->any())) ->method(('getEvent')) - ->will($this->returnValue($eventType)); + ->willReturn($eventType); /** @var INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ $notification = $this->getMockBuilder(INotification::class)->getMock(); $notification->expects($this->any()) ->method($this->anything()) - ->will($this->returnValue($notification)); + ->willReturn($notification); $notification->expects($this->exactly(6)) ->method('setUser'); $this->notificationManager->expects($this->once()) ->method('createNotification') - ->will($this->returnValue($notification)); + ->willReturn($notification); $this->notificationManager->expects($this->exactly(6)) ->method($notificationMethod) ->with($this->isInstanceOf('\OCP\Notification\INotification')); @@ -132,7 +132,7 @@ class ListenerTest extends TestCase { ['23452-4333-54353-2342'], ['yolo'] ) - ->will($this->returnValue(true)); + ->willReturn(true); $this->listener->evaluate($event); } @@ -146,10 +146,10 @@ class ListenerTest extends TestCase { $comment = $this->getMockBuilder(IComment::class)->getMock(); $comment->expects($this->any()) ->method('getObjectType') - ->will($this->returnValue('files')); + ->willReturn('files'); $comment->expects($this->any()) ->method('getCreationDateTime') - ->will($this->returnValue(new \DateTime())); + ->willReturn(new \DateTime()); $comment->expects($this->once()) ->method('getMentions') ->willReturn([]); @@ -160,10 +160,10 @@ class ListenerTest extends TestCase { ->getMock(); $event->expects($this->once()) ->method('getComment') - ->will($this->returnValue($comment)); + ->willReturn($comment); $event->expects(($this->any())) ->method(('getEvent')) - ->will($this->returnValue($eventType)); + ->willReturn($eventType); $this->notificationManager->expects($this->never()) ->method('createNotification'); @@ -183,10 +183,10 @@ class ListenerTest extends TestCase { $comment = $this->getMockBuilder(IComment::class)->getMock(); $comment->expects($this->any()) ->method('getObjectType') - ->will($this->returnValue('files')); + ->willReturn('files'); $comment->expects($this->any()) ->method('getCreationDateTime') - ->will($this->returnValue(new \DateTime())); + ->willReturn(new \DateTime()); $comment->expects($this->once()) ->method('getMentions') ->willReturn([[ 'type' => 'user', 'id' => 'foobar']]); @@ -200,22 +200,22 @@ class ListenerTest extends TestCase { ->getMock(); $event->expects($this->once()) ->method('getComment') - ->will($this->returnValue($comment)); + ->willReturn($comment); $event->expects(($this->any())) ->method(('getEvent')) - ->will($this->returnValue(CommentsEvent::EVENT_ADD)); + ->willReturn(CommentsEvent::EVENT_ADD); /** @var INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ $notification = $this->getMockBuilder(INotification::class)->getMock(); $notification->expects($this->any()) ->method($this->anything()) - ->will($this->returnValue($notification)); + ->willReturn($notification); $notification->expects($this->never()) ->method('setUser'); $this->notificationManager->expects($this->once()) ->method('createNotification') - ->will($this->returnValue($notification)); + ->willReturn($notification); $this->notificationManager->expects($this->never()) ->method('notify'); @@ -224,7 +224,7 @@ class ListenerTest extends TestCase { ->withConsecutive( ['foobar'] ) - ->will($this->returnValue(false)); + ->willReturn(false); $this->listener->evaluate($event); } diff --git a/apps/comments/tests/Unit/Notification/NotifierTest.php b/apps/comments/tests/Unit/Notification/NotifierTest.php index 34de6620897..2924c10c856 100644 --- a/apps/comments/tests/Unit/Notification/NotifierTest.php +++ b/apps/comments/tests/Unit/Notification/NotifierTest.php @@ -84,9 +84,9 @@ class NotifierTest extends TestCase { $this->l = $this->createMock(IL10N::class); $this->l->expects($this->any()) ->method('t') - ->will($this->returnCallback(function ($text, $parameters = []) { + ->willReturnCallback(function ($text, $parameters = []) { return vsprintf($text, $parameters); - })); + }); $this->notification = $this->createMock(INotification::class); $this->comment = $this->createMock(IComment::class); |