/** * {@inheritDoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $persister = new ConnectionPersister($this->getHelper('db')->getConnection()); $loader = new YamlLoader($this->getFilename($input->getArgument('file'))); $output->writeln(sprintf("Processing file '<info>%s</info>'... ", $this->getFilename($input->getArgument('file')))); $persister->persist($loader->load()); }
/** @test */ public function it_persists_fixtures_with_references() { $persister = new ConnectionPersister($this->connection, new ForeignKeyParser()); $persister->persist((new YamlLoader("{$this->path}/fixture.yml"))->load()); $station1 = $this->stationNamed('CASMEN GASOL'); $station2 = $this->stationNamed('COMBUSTIBLES JV'); $review1 = $this->reviewRated(5); $review2 = $this->reviewRated(1); $this->assertGreaterThan(0, $station1['station_id']); $this->assertGreaterThan(0, $station2['station_id']); $this->assertEquals($station1['station_id'], $review1['station_id']); $this->assertEquals($station1['station_id'], $review2['station_id']); }