Created
November 10, 2016 21:14
-
-
Save roma-glushko/da754c3fa77c99a02b760f98fbd044f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Vendor\Module\Test\Unit; | |
use Magento\Framework\App\ObjectManagerFactory as AppObjectManagerFactory; | |
use Magento\Framework\Config\File\ConfigFilePool; | |
use Magento\Framework\ObjectManagerInterface; | |
use Magento\Framework\Filesystem\DriverPool; | |
use Magento\Framework\Filesystem\Driver\File; | |
use Magento\Framework\App\Filesystem\DirectoryList; | |
/** | |
* Class ObjectManagerFactory | |
*/ | |
class ObjectManagerFactory | |
{ | |
/** | |
* @return ObjectManagerInterface | |
*/ | |
public function create($args = []) | |
{ | |
return $this->createObjectManagerFactory()->create($args); | |
} | |
/** | |
* @return AppObjectManagerFactory | |
*/ | |
protected function createObjectManagerFactory() | |
{ | |
$driverPool = $this->createDriverPool(); | |
$directoryList = $this->createDirectoryList(); | |
$configFilePool = $this->createConfigFilePool(); | |
return new AppObjectManagerFactory($directoryList, $driverPool, $configFilePool); | |
} | |
/** | |
* @return DriverPool | |
*/ | |
protected function createDriverPool() | |
{ | |
return new DriverPool([ | |
'file' => File::class | |
]); | |
} | |
/** | |
* @return DirectoryList | |
*/ | |
protected function createDirectoryList() | |
{ | |
return new DirectoryList(BP, [ | |
'base' => [ | |
'path' => BP | |
] | |
]); | |
} | |
/** | |
* @return ConfigFilePool | |
*/ | |
protected function createConfigFilePool() | |
{ | |
return new ConfigFilePool(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment