public function testClone() { $message = new Message(); $message->setId(42); $message->setState(Message::STATE_ERROR); $this->assertTrue($message->isError()); $this->assertEquals(42, $message->getId()); $newMessage = clone $message; $this->assertTrue($newMessage->isOpen()); $this->assertNull($newMessage->getId()); }
public function testClone() { $originalMessage = new Message(); $originalMessage->setId(42); $originalMessage->setBody('body'); $originalMessage->setState(MessageInterface::STATE_ERROR); $clonedMessage = clone $originalMessage; $this->assertEquals('body', $clonedMessage->getBody()); $this->assertEquals(MessageInterface::STATE_ERROR, $clonedMessage->getState()); $this->assertNull($clonedMessage->getId()); }