/**
  * @param BaseFixtureInterface $fixture
  */
 public function addFixture(BaseFixtureInterface $fixture)
 {
     if (!$fixture instanceof FixtureInterface || $this->hasFixture($fixture)) {
         return;
     }
     $fixture->setContainer($this->getContainer());
     $searchPaths = FixturePaths::create()->cartesianProductFromPaths([$this->container->getParameter('kernel.root_dir')], ...$this->container->getParameter('s.arthur_doctrine_fixtures.fixture_search_parts'));
     $fixture->loadFixtureMetadata($searchPaths);
     parent::addFixture($fixture);
 }
 public function testCartesianProductFromPaths()
 {
     $cartesianStringPaths = [['/../../../app', 'app', '', 'application'], ['config', 'cfg'], ['public/fixtures', 'proprietary/fixtures']];
     $expectedWithLeadingSlashes = ['/../../../app/config/public/fixtures', 'app/config/public/fixtures', 'config/public/fixtures', 'application/config/public/fixtures', '/../../../app/cfg/public/fixtures', 'app/cfg/public/fixtures', 'cfg/public/fixtures', 'application/cfg/public/fixtures', '/../../../app/config/proprietary/fixtures', 'app/config/proprietary/fixtures', 'config/proprietary/fixtures', 'application/config/proprietary/fixtures', '/../../../app/cfg/proprietary/fixtures', 'app/cfg/proprietary/fixtures', 'cfg/proprietary/fixtures', 'application/cfg/proprietary/fixtures'];
     $expectedWithoutLeadingSlashes = ['../../../app/config/public/fixtures', 'app/config/public/fixtures', 'config/public/fixtures', 'application/config/public/fixtures', '../../../app/cfg/public/fixtures', 'app/cfg/public/fixtures', 'cfg/public/fixtures', 'application/cfg/public/fixtures', '../../../app/config/proprietary/fixtures', 'app/config/proprietary/fixtures', 'config/proprietary/fixtures', 'application/config/proprietary/fixtures', '../../../app/cfg/proprietary/fixtures', 'app/cfg/proprietary/fixtures', 'cfg/proprietary/fixtures', 'application/cfg/proprietary/fixtures'];
     $result = FixturePaths::cartesianProductFromPaths(...$cartesianStringPaths);
     static::assertCount(16, $result);
     static::assertEquals($expectedWithLeadingSlashes, $result->getPaths());
     $result = FixturePaths::cartesianProductFromPaths(...$cartesianStringPaths)->removeLeadingSlashes()->getPaths();
     static::assertEquals($expectedWithoutLeadingSlashes, $result);
 }
 public function testValidAndInvalidPaths()
 {
     $input = ['bad/bad/path', 'bin', 'src', 'invalid-path', 'tests/DataFixtures/Locator'];
     $expected = ['bin', 'src', 'tests/DataFixtures/Locator'];
     $locator = new FixtureLocator($input);
     static::assertEquals([], $locator->locate('FixtureLocator.php'));
     $locator->setPaths(FixturePaths::create(...$input));
     $resultingPaths = $locator->locateValidPaths(null, FixturePaths::create(...$input));
     foreach ($resultingPaths as $i => $p) {
         static::assertEquals($expected[$i], substr($p, strlen($p) - strlen($expected[$i])));
     }
 }
 public function setUp()
 {
     $this->c = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container')->setMethods(['getParameter'])->getMock();
     $this->c->expects($this->any())->method('getParameter')->will($this->returnValue('./tests/fixtures/'));
     $this->f = $this->getMockBuilder('Scribe\\Arthur\\DoctrineFixturesBundle\\DataFixtures\\YamlFixture')->setMethods(['getFixtureFileSearchPaths'])->getMock();
     $this->f->expects($this->any())->method('getFixtureFileSearchPaths')->will($this->returnValue(FixturePaths::create()->cartesianProductFromPaths(['tests/fixtures'])));
     $reflectionF = new \ReflectionClass('Scribe\\Arthur\\DoctrineFixturesBundle\\DataFixtures\\YamlFixture');
     $reflectionContainer = $reflectionF->getProperty('container');
     $reflectionContainer->setAccessible(true);
     $reflectionContainer->setValue($this->f, $this->c);
     $this->paths = $searchPaths = FixturePaths::create()->cartesianProductFromPaths([$this->c->getParameter('kernel.root_dir')]);
     parent::setUp();
 }