/** * @param \Domain\Core\Film $film * * @return bool */ public function persist($film) { $name = $film->getName(); $url = $film->getUrl(); echo 'importing: "' . $name . '"; Url: ' . $url; $tags = $film->getTags(); if (!empty($tags)) { echo '; Tags: '; $total = $tags->count(); foreach ($tags as $tag) { $tag->persist(); if ($total > $tags->key() + 1) { echo ','; } } } echo "\n"; return true; }
/** * Test for sure that the persist method is called * * @test */ public function testPersist() { $this->dummyFilmEntity->expects($this->once())->method('persist')->willReturn(true); $item = new Film($this->dummyFilmEntity, '', 'name test', 'url test'); $this->assertTrue($item->persist(), 'The persist method will return true'); }