public function testGetComposerJsonFiles() { $configPath = 'app/code/Test/Module/composer.json'; $modulesDirectoryMock = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\ReadInterface'); $modulesDirectoryMock->expects($this->any())->method('getRelativePath')->will($this->returnArgument(0)); $modulesDirectoryMock->expects($this->any())->method('isExist')->with($configPath)->will($this->returnValue(true)); $this->directoryReadFactoryMock->expects($this->any())->method('create')->will($this->returnValue($modulesDirectoryMock)); $this->_moduleListMock->expects($this->once())->method('getNames')->will($this->returnValue(['Test_Module'])); $model = new \Magento\Framework\Module\Dir\Reader($this->_dirsMock, $this->_moduleListMock, new FileIteratorFactory(new \Magento\Framework\Filesystem\File\ReadFactory(new \Magento\Framework\Filesystem\DriverPool())), $this->directoryReadFactoryMock); $model->setModuleDir('Test_Module', '', 'app/code/Test/Module'); $this->assertEquals($configPath, $model->getComposerJsonFiles()->key()); }
public function testGetConfigurationFiles() { $modules = array('Test_Module' => array('name' => 'Test_Module', 'version' => '1.0.0.0', 'active' => true)); $configPath = 'app/code/Test/Module/etc/config.xml'; $modulesDirectoryMock = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\ReadInterface'); $modulesDirectoryMock->expects($this->any())->method('getRelativePath')->will($this->returnArgument(0)); $modulesDirectoryMock->expects($this->any())->method('isExist')->with($configPath)->will($this->returnValue(true)); $this->_filesystemMock->expects($this->any())->method('getDirectoryRead')->with(Filesystem::MODULES_DIR)->will($this->returnValue($modulesDirectoryMock)); $this->_moduleListMock->expects($this->once())->method('getModules')->will($this->returnValue($modules)); $model = new \Magento\Framework\Module\Dir\Reader($this->_dirsMock, $this->_moduleListMock, $this->_filesystemMock, new FileIteratorFactory()); $model->setModuleDir('Test_Module', 'etc', 'app/code/Test/Module/etc'); $this->assertEquals($configPath, $model->getConfigurationFiles('config.xml')->key()); }