/** * @dataProvider dataUpdateAlreadyInstalledCheck * * @param string $versionNotification * @param string $versionInstalled * @param bool $exception */ public function testUpdateAlreadyInstalledCheck($versionNotification, $versionInstalled, $exception) { $notifier = $this->getNotifier(); $notification = $this->getMock('OCP\\Notification\\INotification'); $notification->expects($this->once())->method('getObjectId')->willReturn($versionNotification); if ($exception) { $this->notificationManager->expects($this->once())->method('markProcessed')->with($notification); } else { $this->notificationManager->expects($this->never())->method('markProcessed'); } try { $this->invokePrivate($notifier, 'updateAlreadyInstalledCheck', [$notification, $versionInstalled]); $this->assertFalse($exception); } catch (\Exception $e) { $this->assertTrue($exception); $this->assertInstanceOf('InvalidArgumentException', $e); } }
/** * @dataProvider dataDeleteOutdatedNotifications * @param string $app * @param string $version */ public function testDeleteOutdatedNotifications($app, $version) { $notification = $this->getMock('OCP\\Notification\\INotification'); $notification->expects($this->once())->method('setApp')->with('updatenotification')->willReturnSelf(); $notification->expects($this->once())->method('setObject')->with($app, $version)->willReturnSelf(); $this->notificationManager->expects($this->once())->method('createNotification')->willReturn($notification); $this->notificationManager->expects($this->once())->method('markProcessed')->with($notification); $job = $this->getJob(); $this->invokePrivate($job, 'deleteOutdatedNotifications', [$app, $version]); }