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]))); } }
/** * {@inherit-doc}. * * @throws RuntimeException * * @return $this */ public function loadFixtureMetadata(FixturePathsInterface $paths) { try { $locator = new FixtureLocator(); $locator->setPaths($paths); $loader = new FixtureLoaderResolver(); $loader->assignLoaders($this->getFixtureFileLoaders()); $metadata = new FixtureMetadata(); $metadata->setNameRegex($this->fixtureSearchNameRegex)->setNameTemplate($this->fixtureNameTemplate)->setHandler($this)->setLocator($locator)->setLoader($loader)->load($this->container); $this->metadata = $metadata; } catch (\Exception $exception) { throw new RuntimeException('Unable to generate metadata for fixture (ORM Loader: %s)', null, $exception, get_class($this)); } return $this; }