Beispiel #1
0
 public function testPrepareNotifierThrows()
 {
     /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
     $notification = $this->getMockBuilder('OCP\\Notification\\INotification')->disableOriginalConstructor()->getMock();
     $notification->expects($this->once())->method('isValidParsed')->willReturn(true);
     /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier */
     $notifier = $this->getMockBuilder('OCP\\Notification\\INotifier')->disableOriginalConstructor()->getMock();
     $notifier->expects($this->once())->method('prepare')->with($notification, 'de')->willThrowException(new \InvalidArgumentException());
     $this->manager->registerNotifier(function () use($notifier) {
         return $notifier;
     }, function () {
         return ['id' => 'test1', 'name' => 'Test One'];
     });
     $this->assertEquals($notification, $this->manager->prepare($notification, 'de'));
 }