public function testMarkRead() { /** @var NotificationInterface $notification */ $notification = $this->getMockBuilder(NotificationInterface::class)->setMethods(['getId', 'getText', 'getDate', 'getUser', 'getRead', 'setRead'])->getMock(); $notification->expects($this->at(0))->method('setRead')->with(true); $this->objectManager->expects($this->at(0))->method('persist')->with($notification); $this->objectManager->expects($this->at(0))->method('flush'); $result = $this->mapper->markRead($notification); $this->assertTrue($result); }