public function testStatuses() { $message = new Message(); $message->setState(MessageInterface::STATE_IN_PROGRESS); $this->assertTrue($message->isRunning()); $message->setState(MessageInterface::STATE_CANCELLED); $this->assertTrue($message->isCancelled()); $message->setState(MessageInterface::STATE_ERROR); $this->assertTrue($message->isError()); $message->setState(MessageInterface::STATE_OPEN); $this->assertTrue($message->isOpen()); }
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()); }
/** * @return \Sonata\NotificationBundle\Tests\Entity\Message */ protected function getMessage($state = MessageInterface::STATE_OPEN) { $message = new Message(); $message->setState($state); return $message; }