示例#1
0
 /**
  * Loader
  *
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $i = 1;
     while ($i <= 10) {
         $message = ['title' => 'Message ' . $i, 'text' => 'message text ' . $i];
         $obj = new MessageModel();
         $obj->setTitle($message['title']);
         $obj->setText($message['text']);
         $manager->persist($obj);
         $manager->flush();
         $this->addReference('message_' . $i, $obj);
         $i++;
     }
 }
示例#2
0
 /**
  * Update message object
  *
  * @param MessageModel $message
  * @param string $title
  * @param string $text
  * @return MessageModel
  */
 public static function update(MessageModel $message, string $title, string $text) : MessageModel
 {
     $message->setTitle($title);
     $message->setText($text);
     return $message;
 }
示例#3
0
 /**
  * @test
  * @dataProvider invalidObjects
  * @covers       \Message\Entity\Message::setTitle
  * @expectedException \InvalidArgumentException
  */
 public function setTitleThrowsExceptionWhenEmpty($obj)
 {
     $message = new Message();
     $message->setTitle($obj->title);
 }