コード例 #1
0
ファイル: Fixture.php プロジェクト: codesleeve/fixture
 /**
  * Load a fixture's data into the database.
  * We'll also store it inside the fixtures property for easy
  * access as an array element or class property from our tests.
  *
  * @param  string $fixture
  * @return void
  */
 protected function loadFixture($fixture)
 {
     $tableName = basename($fixture, '.php');
     $records = (include $fixture);
     if (!is_array($records)) {
         throw new Exceptions\InvalidFixtureDataException("Invalid fixture: {$fixture}, please ensure this file returns an array of data.", 1);
     }
     $this->fixtures[$tableName] = $this->driver->buildRecords($tableName, $records);
 }