예제 #1
0
 /**
  * @cover ::getFixtures
  */
 public function testGetFixturesWithInvalidPath()
 {
     $finder = new Finder();
     $kernel = $this->prophesize('Symfony\\Component\\HttpKernel\\KernelInterface');
     try {
         $finder->getFixtures($kernel->reveal(), [new TestEmptyBundle()], 'dev');
         $this->fail('Expected \\InvalidArgumentException to be thrown.');
     } catch (\InvalidArgumentException $exception) {
         // Expected result
     }
 }
예제 #2
0
 /**
  * {@inheritdoc}
  *
  * Extended to look for data loaders. If a data loader is found, will take the fixtures from it instead of taking
  * all the fixtures files.
  */
 public function getFixturesFromDirectory($path)
 {
     $fixtures = [];
     $loaders = $this->getDataLoadersFromDirectory($path);
     foreach ($loaders as $loader) {
         $fixtures = array_merge($fixtures, $loader->getFixtures());
     }
     // If no data loader is found, takes all fixtures files
     if (0 === count($loaders)) {
         return parent::getFixturesFromDirectory($path);
     }
     return $fixtures;
 }