本文整理汇总了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));
}