コード例 #1
0
ファイル: MessageListenerTest.php プロジェクト: php-lug/lug
 public function testMessageWithApi()
 {
     $this->parameterResolver->expects($this->once())->method('resolveApi')->will($this->returnValue(true));
     $event = $this->createDomainEventMock();
     $event->expects($this->never())->method('setMessage');
     $this->messageListener->addMessage($event);
 }
コード例 #2
0
 public function testMessageWithoutLabelPropertyPath()
 {
     $event = $this->createDomainEventMock();
     $event->expects($this->once())->method('getMessageType')->will($this->returnValue($messageType = 'message_type'));
     $event->expects($this->once())->method('setMessageType')->with($this->identicalTo($messageType));
     $event->expects($this->once())->method('getMessage')->will($this->returnValue(null));
     $event->expects($this->once())->method('getAction')->will($this->returnValue($action = 'action'));
     $event->expects($this->once())->method('getObject')->will($this->returnValue($object = $this->createObjectMock()));
     $object->expects($this->once())->method('__toString')->will($this->returnValue($property = 'property'));
     $event->expects($this->once())->method('getResource')->will($this->returnValue($resource = $this->createResourceMock()));
     $resource->expects($this->once())->method('getName')->will($this->returnValue($name = 'name'));
     $this->translator->expects($this->once())->method('trans')->with($this->identicalTo('lug.' . $name . '.' . $action . '.' . $messageType), $this->identicalTo(['%' . $name . '%' => $property]))->will($this->returnValue($translation = 'translation'));
     $event->expects($this->once())->method('setMessage')->with($this->identicalTo($translation));
     $this->messageListener->addMessage($event);
 }