/** * 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++; } }
/** * 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; }
/** * @test * @dataProvider invalidObjects * @covers \Message\Entity\Message::setText * @expectedException \InvalidArgumentException */ public function setTextThrowsInvalidArgumentExceptoinWhenInvalid($obj) { $message = new Message(); $message->setText($obj->text); }