public function testExecuteNoConfig() { $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(false)); $this->installerFactory->expects($this->never())->method('create'); $commandTester = new CommandTester(new DbDataUpgradeCommand($this->installerFactory, $this->deploymentConfig)); $commandTester->execute([]); $this->assertStringMatchesFormat('No information is available: the application is not installed.%w', $commandTester->getDisplay()); }
public function testExecuteNotInstalled() { $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(false)); $this->installerFactory->expects($this->never())->method('create'); $tester = new CommandTester($this->command); $tester->execute([]); $this->assertStringMatchesFormat("Store settings can't be saved because the Magento application is not installed.%w", $tester->getDisplay()); }
public function testExecute() { $options = ['--' . AdminAccount::KEY_USER => 'user', '--' . AdminAccount::KEY_PASSWORD => '123123q', '--' . AdminAccount::KEY_EMAIL => '*****@*****.**', '--' . AdminAccount::KEY_FIRST_NAME => 'John', '--' . AdminAccount::KEY_LAST_NAME => 'Doe']; $data = [AdminAccount::KEY_USER => 'user', AdminAccount::KEY_PASSWORD => '123123q', AdminAccount::KEY_EMAIL => '*****@*****.**', AdminAccount::KEY_FIRST_NAME => 'John', AdminAccount::KEY_LAST_NAME => 'Doe', InitParamListener::BOOTSTRAP_PARAM => null]; $commandTester = new CommandTester($this->command); $installerMock = $this->getMock('Magento\\Setup\\Model\\Installer', [], [], '', false); $installerMock->expects($this->once())->method('installAdminUser')->with($data); $this->installerFactoryMock->expects($this->once())->method('create')->willReturn($installerMock); $commandTester->execute($options); $this->assertEquals('Created Magento administrator user named user' . PHP_EOL, $commandTester->getDisplay()); }
/** * Test install command with invalid sales_order_increment_prefix value * * @expectedException \InvalidArgumentException * @dataProvider validateWithExceptionDataProvider * @param $prefixValue */ public function testValidateWithException($prefixValue) { $this->installerFactory->expects($this->never())->method('create')->will($this->returnValue($this->installer)); $this->installer->expects($this->never())->method('install'); $this->input['--' . InstallCommand::INPUT_KEY_SALES_ORDER_INCREMENT_PREFIX] = $prefixValue; $commandTester = new CommandTester($this->command); $commandTester->execute($this->input); }
/** * @dataProvider validateDataProvider * @param array $option * @param string $error */ public function testExecuteInvalidData(array $option, $error) { $url = $this->getMock('Magento\\Framework\\Url\\Validator', [], [], '', false); $url->expects($this->any())->method('isValid')->will($this->returnValue(false)); if (!isset($option['--' . StoreConfigurationDataMapper::KEY_BASE_URL_SECURE])) { $url->expects($this->any())->method('getMessages')->will($this->returnValue([Validator::INVALID_URL => 'Invalid URL.'])); } $localeLists = $this->getMock('Magento\\Framework\\Validator\\Locale', [], [], '', false); $localeLists->expects($this->any())->method('isValid')->will($this->returnValue(false)); $timezoneLists = $this->getMock('Magento\\Framework\\Validator\\Timezone', [], [], '', false); $timezoneLists->expects($this->any())->method('isValid')->will($this->returnValue(false)); $currencyLists = $this->getMock('Magento\\Framework\\Validator\\Currency', [], [], '', false); $currencyLists->expects($this->any())->method('isValid')->will($this->returnValue(false)); $returnValueMapOM = [['Magento\\Framework\\Url\\Validator', $url], ['Magento\\Framework\\Validator\\Locale', $localeLists], ['Magento\\Framework\\Validator\\Timezone', $timezoneLists], ['Magento\\Framework\\Validator\\Currency', $currencyLists]]; $this->objectManager->expects($this->any())->method('get')->will($this->returnValueMap($returnValueMapOM)); $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(true)); $this->installerFactory->expects($this->never())->method('create'); $commandTester = new CommandTester($this->command); $commandTester->execute($option); $this->assertEquals($error . PHP_EOL, $commandTester->getDisplay()); }
public function testExecuteInteractionNo() { $this->installer->expects($this->exactly(0))->method('uninstall'); $this->installerFactory->expects($this->exactly(0))->method('create'); $this->checkInteraction(false); }