loadFactories() публичный Метод

This method expects either a single path to a directory containing php files, or an array of directory paths, and will "require" each file. These files should be where you define your model definitions.
public loadFactories ( string | string[] $paths ) : FactoryMuffin
$paths string | string[] The directory path(s) to load.
Результат FactoryMuffin
Пример #1
0
 public function _beforeSuite($settings = [])
 {
     $store = null;
     if ($this->ormModule instanceof DataMapper) {
         // for Doctrine
         $store = new RepositoryStore($this->ormModule->_getEntityManager());
     }
     $this->factoryMuffin = new FactoryMuffin($store);
     if ($this->config['factories']) {
         foreach ((array) $this->config['factories'] as $factoryPath) {
             $realpath = realpath(codecept_root_dir() . $factoryPath);
             if ($realpath === false) {
                 throw new ModuleException($this, 'The path to one of your factories is not correct. Please specify the directory relative to the codeception.yml file (ie. _support/factories).');
             }
             $this->factoryMuffin->loadFactories($realpath);
         }
     }
 }
Пример #2
0
 public function _beforeSuite($settings = [])
 {
     if (!class_exists('League\\FactoryMuffin\\FactoryMuffin')) {
         throw new \Exception('FactoryMuffin not installed. Please add `"league/factory-muffin": "^3.0"` to composer.json');
     }
     if (!class_exists('League\\FactoryMuffin\\Faker\\Facade')) {
         throw new \Exception('FactoryMuffin requires Faker integration. Please add `"league/factory-muffin-faker": "^1.0"` to composer.json');
     }
     $store = null;
     if ($this->ormModule instanceof DataMapper) {
         // for Doctrine
         $store = new RepositoryStore($this->ormModule->_getEntityManager());
     }
     $this->factoryMuffin = new FactoryMuffin($store);
     if ($this->config['factories']) {
         foreach ((array) $this->config['factories'] as $factoryPath) {
             $this->factoryMuffin->loadFactories(realpath(codecept_root_dir() . $factoryPath));
         }
     }
 }