/** * Launch the Import command with the reader injected * * @param ReaderInterface $readerEngine * * @return bool */ protected function executeWithProvider(ReaderInterface $readerEngine) { $data = $this->readData($readerEngine); $res = false; if (!empty($data)) { foreach ($data as $item) { $cmd = new SaveCommand(new Film(), new Tag()); $res = $cmd->execute($item); if (false == $res) { break; } } } return $res; }
/** * Test for sure that the persist method is called * * @test */ public function testSaveCommandExecute() { $this->dummyFilmEntity->expects($this->once())->method('persist'); $cmd = new SaveCommand($this->dummyFilmEntity, $this->dummyTagEntity); $cmd->execute(['id' => '', 'name' => 'nameTest', 'url' => 'url test', 'tags' => []]); }