public createOrReturnExistingInstance ( string $locale ) : |
||
$locale | string | e.g. 'fr_FR', 'en_US' |
return |
private function getGenerator(GeneratorFactory $factory, string $formatter) { $explodedFormatter = explode(':', $formatter); $size = count($explodedFormatter); if (1 === $size) { return [$factory->getSeedGenerator(), $explodedFormatter[0]]; } if (2 === $size) { return [$factory->createOrReturnExistingInstance($explodedFormatter[0]), $explodedFormatter[1]]; } throw InvalidArgumentExceptionFactory::createForInvalidFakerFormatter($formatter); }
public function testCreatingGeneratorWithInvalidLocaleFallsbackOnFakerDefaultLocale() { $factory = new GeneratorFactory(FakerFactory::create()); $this->assertEquals($factory->createOrReturnExistingInstance('unknown'), $factory->createOrReturnExistingInstance('en_US')); }