コード例 #1
0
 public function testAddMessageArgument()
 {
     $message = $this->getMock('Qu\\Message\\MessageInterface');
     $this->assertSame($this->instance, $this->instance->addMessage($message), 'Method is fluent');
     $this->assertCount(1, $this->instance->getMessages());
     $this->assertSame($message, $this->instance->getMessages()[0]);
     $this->instance->addMessage($message);
     $this->assertCount(2, $this->instance->getMessages());
     $this->assertSame([$message, $message], $this->instance->getMessages());
     $this->setExpectedException('PHPUnit_Framework_Error');
     $this->instance->addMessage(new \stdClass(), 'only instances of MessageInterface are accepted');
 }