Open clphillips opened 9 years ago
Could use PHP 5.5 generator instead of implementing FixtureIterator
class. Obviously requires increasing PHP requirement.
protected function fetchFixtures(array $fixtures = null, \DirectoryIterator $files = null)
{
$files = $files ?: new \GlobIterator($this->config['location'] . "/*.php");
foreach ($files as $filename => $file) {
if (null === $fixtures || in_array(basename($filename, '.php'), $fixtures)) {
yield $filename;
}
}
}
Glob pattern should be provided in the config. Update config to use either location
or pattern
, where pattern
is a globbing pattern.
Look into extending GlobIterator to improve performance in Fixture::fetchFixtures. We could have something like:
FixtureIterator
would extendGlobIterator
(which indirectly extendsDirectoryIterator
) and would handle filtering out undesired fixtures.