/** * @covers \Magento\TestFramework\Application::getTempDir * @covers \Magento\TestFramework\Application::getDbInstance() * @covers \Magento\TestFramework\Application::getInitParams() */ public function testConstructor() { $shell = $this->getMock('\\Magento\\Framework\\Shell', [], [], '', false); $autoloadWrapper = $this->getMockBuilder('Magento\\Framework\\Autoload\\ClassLoaderWrapper')->disableOriginalConstructor()->getMock(); $tempDir = '/temp/dir'; $appMode = \Magento\Framework\App\State::MODE_DEVELOPER; $object = new \Magento\TestFramework\Application($shell, $tempDir, 'config.php', 'global-config.php', '', $appMode, $autoloadWrapper); $this->assertEquals($tempDir, $object->getTempDir(), 'Temp directory is not set in Application'); $initParams = $object->getInitParams(); $this->assertInternalType('array', $initParams, 'Wrong initialization parameters type'); $this->assertArrayHasKey(Bootstrap::INIT_PARAM_FILESYSTEM_DIR_PATHS, $initParams, 'Directories are not configured'); $this->assertArrayHasKey(State::PARAM_MODE, $initParams, 'Application mode is not configured'); $this->assertEquals(\Magento\Framework\App\State::MODE_DEVELOPER, $initParams[State::PARAM_MODE], 'Wrong application mode configured'); }
/** * @covers \Magento\TestFramework\Application::getInstallDir() * @covers \Magento\TestFramework\Application::getDbInstance() * @covers \Magento\TestFramework\Application::getInitParams() */ public function testConstructor() { $dbInstance = $this->getMockForAbstractClass('Magento\\TestFramework\\Db\\AbstractDb', array(), '', false); $installDir = '/install/dir'; $appMode = \Magento\Framework\App\State::MODE_DEVELOPER; $directoryList = new \Magento\Framework\App\Filesystem\DirectoryList(BP); $filesystem = new \Magento\Framework\App\Filesystem($directoryList, new \Magento\Framework\Filesystem\Directory\ReadFactory(), new \Magento\Framework\Filesystem\Directory\WriteFactory(), new \Magento\Framework\Filesystem\File\ReadFactory(new \Magento\Framework\Filesystem\DriverFactory($directoryList)), new \Magento\Framework\Filesystem\File\WriteFactory(new \Magento\Framework\Filesystem\DriverFactory($directoryList))); $object = new \Magento\TestFramework\Application($dbInstance, $installDir, new \Magento\Framework\Simplexml\Element('<data/>'), '', array(), $appMode, $filesystem); $this->assertSame($dbInstance, $object->getDbInstance(), 'Db instance is not set in Application'); $this->assertEquals($installDir, $object->getInstallDir(), 'Install directory is not set in Application'); $initParams = $object->getInitParams(); $this->assertInternalType('array', $initParams, 'Wrong initialization parameters type'); $this->assertArrayHasKey(\Magento\Framework\App\Filesystem::PARAM_APP_DIRS, $initParams, 'Directories are not configured'); $this->assertArrayHasKey(State::PARAM_MODE, $initParams, 'Application mode is not configured'); $this->assertEquals(\Magento\Framework\App\State::MODE_DEVELOPER, $initParams[State::PARAM_MODE], 'Wrong application mode configured'); }