League\FactoryMuffin\FactoryMuffin::loadFactories PHP Метод

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
    public function loadFactories($paths)
    {
        foreach ((array) $paths as $path) {
            $real = realpath($path);
            if (!$real) {
                throw new DirectoryNotFoundException($path);
            }
            if (!is_dir($real)) {
                throw new DirectoryNotFoundException($real);
            }
            $this->loadDirectory($real);
        }
        return $this;
    }

Usage Example

Пример #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);
         }
     }
 }
All Usage Examples Of League\FactoryMuffin\FactoryMuffin::loadFactories