N98\Magento\Command\LocalConfig\GenerateCommandTest::testExecuteInteractively PHP Метод

testExecuteInteractively() публичный Метод

    public function testExecuteInteractively()
    {
        $command = $this->getApplication()->find('local-config:generate');
        $dialog = $this->getMock('Symfony\\Component\\Console\\Helper\\DialogHelper', array('ask'));
        $inputs = array(array('database host', 'some-db-host'), array('database username', 'some-db-username'), array('database password', 'some-db-password'), array('database name', 'some-db-name'), array('session save', 'some-session-save'), array('admin frontname', 'some-admin-front-name'));
        foreach ($inputs as $i => $input) {
            list($prompt, $returnValue) = $input;
            $dialog->expects($this->at($i))->method('ask')->with($this->isInstanceOf('Symfony\\Component\\Console\\Output\\StreamOutput'), sprintf('<question>Please enter the %s:</question>', $prompt))->will($this->returnValue($returnValue));
        }
        $command->getHelperSet()->set($dialog, 'dialog');
        $commandTester = new CommandTester($command);
        $commandTester->execute(array('command' => $command->getName()));
        $this->assertFileExists($this->configFile);
        $fileContent = \file_get_contents($this->configFile);
        $this->assertContains('<host><![CDATA[some-db-host]]></host>', $fileContent);
        $this->assertContains('<username><![CDATA[some-db-username]]></username>', $fileContent);
        $this->assertContains('<password><![CDATA[some-db-password]]></password>', $fileContent);
        $this->assertContains('<dbname><![CDATA[some-db-name]]></dbname>', $fileContent);
        $this->assertContains('<session_save><![CDATA[some-session-save]]></session_save>', $fileContent);
        $this->assertContains('<frontName><![CDATA[some-admin-front-name]]></frontName>', $fileContent);
        $xml = \simplexml_load_file($this->configFile);
        $this->assertNotInternalType('bool', $xml);
    }