Exemplo n.º 1
0
 /**
  * Loads fixture files
  *
  * @param array                            $fixtures
  * @param string|EcomDev_PHPUnit_Test_Case $classOrInstance
  *
  * @throws RuntimeException
  * @return EcomDev_PHPUnit_Model_Fixture
  */
 protected function _loadFixtureFiles(array $fixtures, $classOrInstance)
 {
     $isShared = $this->isScopeShared() || !$classOrInstance instanceof PHPUnit_Framework_TestCase;
     foreach ($fixtures as $fixture) {
         if (empty($fixture) && $isShared) {
             $fixture = self::DEFAULT_SHARED_FIXTURE_NAME;
         } elseif (empty($fixture)) {
             $fixture = $classOrInstance->getName(false);
         }
         $className = is_string($classOrInstance) ? $classOrInstance : get_class($classOrInstance);
         $filePath = EcomDev_PHPUnit_Test_Case_Util::getYamlLoader()->resolveFilePath($className, EcomDev_PHPUnit_Model_Yaml_Loader::TYPE_FIXTURE, $fixture);
         if (!$filePath) {
             throw new RuntimeException('Unable to load fixture for test: ' . $fixture);
         }
         $this->loadYaml($filePath);
     }
     return $this;
 }