コード例 #1
0
 /**
  * Persist the film data.
  *
  * @param array $data Data of film with the next structure:
  *                    [
  *                      [
  *                          'id' => the id of the film
  *                          'name' => The name
  *                          'url' => the url of the film
  *                          'tags' => [tag1, tag2, ...]
  *                      ],
  *                      ...
  *                    ]
  *                    Note: The id and the tags can be empty
  *
  * @return bool
  */
 public function execute($data)
 {
     $tagCollection = TagCollectionFactory::buildTagCollectionFromArray($this->tagEntity, $data['tags']);
     $film = FilmFactory::buildFilm($this->filmEntity, $data['name'], $data['url'], $data['id'], $tagCollection);
     $film->persist();
     return true;
 }
コード例 #2
0
ファイル: FilmTest.php プロジェクト: neburs/Import-Video-Test
 /**
  * @test
  */
 public function testPersistWithTag()
 {
     $this->expectOutputString("importing: \"name test\"; Url: url test; Tags: tag 1,tag 2\n");
     $film = new Film();
     $tag = new Tag();
     $tagCollection = TagCollectionFactory::buildTagCollectionFromArray($tag, ['tag 1', 'tag 2']);
     $film->persist(FilmFactory::buildFilm($film, 'name test', 'url test', '', $tagCollection));
 }
コード例 #3
0
 /**
  * @test
  */
 public function testBuildFilmWithId()
 {
     $item = FilmFactory::buildFilm($this->dummyFilmEntity, 'film test', 'url test', '1');
     $this->assertEquals('1', $item->getId(), 'The value of the is not correct');
 }