本文整理匯總了PHP中Magento\Framework\App\Filesystem\DirectoryList::addDirectory方法的典型用法代碼示例。如果您正苦於以下問題:PHP DirectoryList::addDirectory方法的具體用法?PHP DirectoryList::addDirectory怎麽用?PHP DirectoryList::addDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\App\Filesystem\DirectoryList
的用法示例。
在下文中一共展示了DirectoryList::addDirectory方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUp
public function setUp()
{
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var \Magento\Framework\App\Filesystem $filesystem */
$filesystem = $objectManager->create('Magento\\Framework\\App\\Filesystem', array('directoryList' => $objectManager->create('Magento\\Framework\\App\\Filesystem\\DirectoryList', array('root' => BP, 'directories' => array(\Magento\Framework\App\Filesystem::MODULES_DIR => array('path' => __DIR__ . '/_files/code'), \Magento\Framework\App\Filesystem::THEMES_DIR => array('path' => __DIR__ . '/_files/design'), \Magento\Framework\App\Filesystem::CONFIG_DIR => array('path' => __DIR__ . '/_files/'))))));
$moduleListMock = $this->getMockBuilder('Magento\\Framework\\Module\\ModuleListInterface')->disableOriginalConstructor()->getMock();
$moduleListMock->expects($this->any())->method('getModules')->will($this->returnValue(array('Magento_Test' => array('name' => 'Magento_Test', 'version' => '1.11.1', 'active' => 'true'))));
$moduleReader = $objectManager->create('Magento\\Framework\\Module\\Dir\\Reader', array('moduleList' => $moduleListMock, 'filesystem' => $filesystem));
$moduleReader->setModuleDir('Magento_Test', 'etc', __DIR__ . '/_files/code/Magento/Test/etc');
$this->_object = $objectManager->create('Magento\\Widget\\Model\\Config\\FileResolver', array('moduleReader' => $moduleReader, 'filesystem' => $filesystem));
$this->directoryList = $objectManager->get('Magento\\Framework\\App\\Filesystem\\DirectoryList');
$dirPath = ltrim(str_replace($this->directoryList->getRoot(), '', str_replace('\\', '/', __DIR__)) . '/_files', '/');
$this->directoryList->addDirectory(\Magento\Framework\App\Filesystem::MODULES_DIR, array('path' => $dirPath));
}