Signed-off-by: Joas Schilling <coding@schilljs.com>tags/v17.0.0beta1
@@ -117,6 +117,9 @@ class NotificationsTest extends TestCase { | |||
$comment->expects($this->any()) | |||
->method('getObjectType') | |||
->willReturn('files'); | |||
$comment->expects($this->any()) | |||
->method('getId') | |||
->willReturn('1234'); | |||
$this->commentsManager->expects($this->any()) | |||
->method('get') | |||
@@ -192,6 +195,9 @@ class NotificationsTest extends TestCase { | |||
$comment->expects($this->any()) | |||
->method('getObjectType') | |||
->willReturn('files'); | |||
$comment->expects($this->any()) | |||
->method('getId') | |||
->willReturn('1234'); | |||
$this->commentsManager->expects($this->any()) | |||
->method('get') |
@@ -91,6 +91,9 @@ class ListenerTest extends TestCase { | |||
[ 'type' => 'user', 'id' => '23452-4333-54353-2342'], | |||
[ 'type' => 'user', 'id' => 'yolo'], | |||
]); | |||
$comment->expects($this->atLeastOnce()) | |||
->method('getId') | |||
->willReturn('1234'); | |||
/** @var CommentsEvent|\PHPUnit_Framework_MockObject_MockObject $event */ | |||
$event = $this->getMockBuilder(CommentsEvent::class) | |||
@@ -186,6 +189,9 @@ class ListenerTest extends TestCase { | |||
$comment->expects($this->once()) | |||
->method('getMentions') | |||
->willReturn([[ 'type' => 'user', 'id' => 'foobar']]); | |||
$comment->expects($this->atLeastOnce()) | |||
->method('getId') | |||
->willReturn('1234'); | |||
/** @var CommentsEvent|\PHPUnit_Framework_MockObject_MockObject $event */ | |||
$event = $this->getMockBuilder(CommentsEvent::class) |
@@ -195,6 +195,9 @@ class NotifierTest extends TestCase { | |||
->expects($this->any()) | |||
->method('getMentions') | |||
->willReturn([['type' => 'user', 'id' => 'you']]); | |||
$this->comment->expects($this->atLeastOnce()) | |||
->method('getId') | |||
->willReturn('1234'); | |||
$this->commentsManager | |||
->expects($this->once()) | |||
@@ -539,7 +542,7 @@ class NotifierTest extends TestCase { | |||
} | |||
/** | |||
* @expectedException \InvalidArgumentException | |||
* @expectedException \OCP\Notification\AlreadyProcessedException | |||
*/ | |||
public function testPrepareUnresolvableFileID() { | |||
$displayName = 'Huraga'; |
@@ -30,6 +30,7 @@ use OCP\IGroupManager; | |||
use OCP\IURLGenerator; | |||
use OCP\IUserSession; | |||
use OCP\L10N\IFactory; | |||
use OCP\Notification\AlreadyProcessedException; | |||
use OCP\Notification\IManager; | |||
use OCP\Notification\INotification; | |||
use Test\TestCase; | |||
@@ -112,21 +113,12 @@ class NotifierTest extends TestCase { | |||
->method('getObjectId') | |||
->willReturn($versionNotification); | |||
if ($exception) { | |||
$this->notificationManager->expects($this->once()) | |||
->method('markProcessed') | |||
->with($notification); | |||
} else { | |||
$this->notificationManager->expects($this->never()) | |||
->method('markProcessed'); | |||
} | |||
try { | |||
self::invokePrivate($notifier, 'updateAlreadyInstalledCheck', [$notification, $versionInstalled]); | |||
$this->assertFalse($exception); | |||
} catch (\Exception $e) { | |||
$this->assertTrue($exception); | |||
$this->assertInstanceOf('InvalidArgumentException', $e); | |||
$this->assertInstanceOf(AlreadyProcessedException::class, $e); | |||
} | |||
} | |||
} |
@@ -61,7 +61,7 @@ class RemoteWipeNotificationsListener implements IEventListener { | |||
$notification->setApp('auth') | |||
->setUser($token->getUID()) | |||
->setDateTime($this->timeFactory->getDateTime()) | |||
->setObject('token', $token->getId()) | |||
->setObject('token', (string) $token->getId()) | |||
->setSubject($event, [ | |||
'name' => $token->getName(), | |||
]); |
@@ -92,7 +92,7 @@ class RemoteWipeNotificationListenerTests extends TestCase { | |||
$token->method('getId')->willReturn(123); | |||
$notification->expects($this->once()) | |||
->method('setObject') | |||
->with('token', 123) | |||
->with('token', '123') | |||
->willReturnSelf(); | |||
$token->method('getName')->willReturn('Token 1'); | |||
$notification->expects($this->once()) | |||
@@ -132,7 +132,7 @@ class RemoteWipeNotificationListenerTests extends TestCase { | |||
$token->method('getId')->willReturn(123); | |||
$notification->expects($this->once()) | |||
->method('setObject') | |||
->with('token', 123) | |||
->with('token', '123') | |||
->willReturnSelf(); | |||
$token->method('getName')->willReturn('Token 1'); | |||
$notification->expects($this->once()) |