/**
  * Fixture loading strategy
  *
  * 1. load base fixtures e.g. from AbstractDbTestCase.getBaseFixtureDir() + *-fixtures.{ext}
  * 2. load class's fixtures e.g. all fixtures that relative to *Test.php
  * 3. load instance's fixtures e.g. AbstractDbTestCase.getFixtures
  *
  * @param AbstractConnection $connection
  * @param AbstractDbTestCase $testCase
  * @return CompositeDataSet
  */
 public function load(AbstractConnection $connection, AbstractDbTestCase $testCase)
 {
     $dataSets = new CompositeDataSet();
     // 1. load base fixture first
     $baseFixtureDir = $testCase->getBaseFixtureDir();
     $this->loadFixturesByPath($dataSets, $connection->getName(), $baseFixtureDir);
     // 2. load class fixtures
     $classPath = $this->getClassPath($testCase);
     $this->loadFixturesByPath($dataSets, $connection->getName(), $classPath);
     // 3. load instance fixtures
     $this->loadFixturesByClass($dataSets, $connection->getName(), $testCase);
     // ensure we have at least one dataset
     $dataSets->addDataSet(new \PHPUnit_Extensions_Database_DataSet_ArrayDataSet([]));
     return $dataSets;
 }
 protected function executeQueryWithForeignKeySetting(\Closure $closure, AbstractConnection $connection, $disableForeignKeyChecks = true)
 {
     if ($disableForeignKeyChecks) {
         $connection->disableForeignKeyChecks();
     }
     $closure();
     if ($disableForeignKeyChecks) {
         $connection->enableForeignKeyChecks();
     }
 }