/** * Load fixture to database. * * @param string $fixturePath The fixture path relative to fixturesRootPath. * * @throws DatabaseException * @throws FixtureLoaderException */ public function loadDbFixture($fixturePath) { list($fixtureFormat, $fixtureData) = $this->loadFixtureData($fixturePath); // Postpone database connection till we really need it. $this->db->dbConnect(); $this->db->dbLoadFixture($fixtureFormat, $fixtureData); }
/** * @covers ::loadDbFixtures */ public function test_loadFixtures() { // Given $this->fixtureLoader->loadDbFixtures(['test2.sql', 'test5.sql']); // When $gotData = $this->dbDriver->dbGetTableData('test2'); $expData = [['id' => '1', 'col2' => '2'], ['id' => '2', 'col2' => '22'], ['id' => '3', 'col2' => '200'], ['id' => '4', 'col2' => '202'], ['id' => '5', 'col2' => '500']]; // Then $this->assertSame($expData, $gotData); }