本文整理汇总了PHP中Magento\Framework\App\DeploymentConfig::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP DeploymentConfig::expects方法的具体用法?PHP DeploymentConfig::expects怎么用?PHP DeploymentConfig::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\DeploymentConfig
的用法示例。
在下文中一共展示了DeploymentConfig::expects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCheckUpdate
/**
* @dataProvider checkUpdateDataProvider
* @param bool $callInbox
* @param string $curlRequest
*/
public function testCheckUpdate($callInbox, $curlRequest)
{
$mockName = 'Test Product Name';
$mockVersion = '0.0.0';
$mockEdition = 'Test Edition';
$mockUrl = 'http://test-url';
$this->productMetadata->expects($this->once())->method('getName')->willReturn($mockName);
$this->productMetadata->expects($this->once())->method('getVersion')->willReturn($mockVersion);
$this->productMetadata->expects($this->once())->method('getEdition')->willReturn($mockEdition);
$this->urlBuilder->expects($this->once())->method('getUrl')->with('*/*/*')->willReturn($mockUrl);
$configValues = ['timeout' => 2, 'useragent' => $mockName . '/' . $mockVersion . ' (' . $mockEdition . ')', 'referer' => $mockUrl];
$lastUpdate = 0;
$this->cacheManager->expects($this->once())->method('load')->will($this->returnValue($lastUpdate));
$this->curlFactory->expects($this->at(0))->method('create')->will($this->returnValue($this->curl));
$this->curl->expects($this->once())->method('setConfig')->with($configValues)->willReturnSelf();
$this->curl->expects($this->once())->method('read')->will($this->returnValue($curlRequest));
$this->backendConfig->expects($this->at(0))->method('getValue')->will($this->returnValue('1'));
$this->backendConfig->expects($this->once())->method('isSetFlag')->will($this->returnValue(false));
$this->backendConfig->expects($this->at(1))->method('getValue')->will($this->returnValue('http://feed.magento.com'));
$this->deploymentConfig->expects($this->once())->method('get')->with(ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE)->will($this->returnValue('Sat, 6 Sep 2014 16:46:11 UTC'));
if ($callInbox) {
$this->inboxFactory->expects($this->once())->method('create')->will($this->returnValue($this->inboxModel));
$this->inboxModel->expects($this->once())->method('parse')->will($this->returnSelf());
} else {
$this->inboxFactory->expects($this->never())->method('create');
$this->inboxModel->expects($this->never())->method('parse');
}
$this->feed->checkUpdate();
}
示例2: testExecuteNoOptions
public function testExecuteNoOptions()
{
$this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(false));
$this->tester->execute([]);
$expected = 'Enabling maintenance mode' . PHP_EOL . 'Not enough information provided to take backup.' . PHP_EOL . 'Disabling maintenance mode' . PHP_EOL;
$this->assertSame($expected, $this->tester->getDisplay());
}
示例3: testExecuteNotInstalled
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());
}
示例4: testRemoveModulesFromDeploymentConfig
public function testRemoveModulesFromDeploymentConfig()
{
$this->output->expects($this->atLeastOnce())->method('writeln');
$this->deploymentConfig->expects($this->once())->method('getConfigData')->willReturn(['moduleA' => 1, 'moduleB' => 1, 'moduleC' => 1, 'moduleD' => 1]);
$this->loader->expects($this->once())->method('load')->willReturn(['moduleC' => [], 'moduleD' => []]);
$this->writer->expects($this->once())->method('saveConfig')->with([ConfigFilePool::APP_CONFIG => [ConfigOptionsListConstants::KEY_MODULES => ['moduleC' => 1, 'moduleD' => 1]]]);
$this->moduleRegistryUninstaller->removeModulesFromDeploymentConfig($this->output, ['moduleA', 'moduleB']);
}
示例5: testExecute
public function testExecute()
{
$this->deploymentConfig->expects($this->once())->method('get')->willReturn('admin_qw12er');
$commandTester = new CommandTester(new InfoAdminUriCommand($this->deploymentConfig));
$commandTester->execute([]);
$regexp = '/' . BackendFrontnameGenerator::ADMIN_AREA_PATH_PREFIX . '[a-z0-9]{1,' . BackendFrontnameGenerator::ADMIN_AREA_PATH_RANDOM_PART_LENGTH . '}/';
$this->assertRegExp($regexp, $commandTester->getDisplay(), 'Unexpected Backend Frontname pattern.');
}
示例6: testExecuteNoConfig
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());
}
示例7: testExecuteNotInstalled
public function testExecuteNotInstalled()
{
$this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(false));
$this->dbVersionInfo->expects($this->never())->method('getDbVersionErrors');
$tester = new CommandTester($this->command);
$tester->execute([]);
$this->assertStringMatchesFormat('No information is available: the Magento application is not installed.%w', $tester->getDisplay());
}
示例8: setUp
public function setUp()
{
$this->_connectionFactory = $this->getMockBuilder('Magento\\Framework\\Model\\Resource\\Type\\Db\\ConnectionFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
$this->_config = $this->getMockBuilder('Magento\\Framework\\App\\Resource\\ConfigInterface')->disableOriginalConstructor()->setMethods(['getConnectionName'])->getMock();
$this->_config->expects($this->any())->method('getConnectionName')->with(self::RESOURCE_NAME)->will($this->returnValue(self::CONNECTION_NAME));
$this->deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
$this->deploymentConfig->expects($this->any())->method('get')->will($this->returnValue(['default' => ['host' => 'localhost', 'dbname' => 'magento', 'username' => 'username'], self::CONNECTION_NAME => ['host' => 'localhost', 'dbname' => 'magento', 'username' => 'username']]));
$this->connection = $this->getMockForAbstractClass('Magento\\Framework\\DB\\Adapter\\AdapterInterface');
$this->connection->expects($this->any())->method('getTableName')->will($this->returnArgument(0));
$this->resource = new Resource($this->_config, $this->_connectionFactory, $this->deploymentConfig, self::TABLE_PREFIX);
}
示例9: setUp
public function setUp()
{
$this->connectionFactory = $this->getMockBuilder(ConnectionFactoryInterface::class)->setMethods(['create'])->getMockForAbstractClass();
$this->config = $this->getMockBuilder('Magento\\Framework\\App\\ResourceConnection\\ConfigInterface')->disableOriginalConstructor()->setMethods(['getConnectionName'])->getMock();
$this->config->expects($this->any())->method('getConnectionName')->with(self::RESOURCE_NAME)->will($this->returnValue(self::CONNECTION_NAME));
$this->deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
$this->deploymentConfig->expects($this->any())->method('get')->willReturnMap([[ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS . '/connection-name', null, ['host' => 'localhost', 'dbname' => 'magento', 'username' => 'username']], [ConfigOptionsListConstants::CONFIG_PATH_DB_PREFIX, null, self::TABLE_PREFIX]]);
$this->connection = $this->getMockForAbstractClass('Magento\\Framework\\DB\\Adapter\\AdapterInterface');
$this->connection->expects($this->any())->method('getTableName')->will($this->returnArgument(0));
$this->resource = new ResourceConnection($this->config, $this->connectionFactory, $this->deploymentConfig);
}
示例10: setUp
public function setUp()
{
$this->collector = $this->getMock('Magento\\Setup\\Model\\ConfigOptionsListCollector', [], [], '', false);
$this->writer = $this->getMock('Magento\\Framework\\App\\DeploymentConfig\\Writer', [], [], '', false);
$this->deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
$this->configOptionsList = $this->getMock('Magento\\Backend\\Setup\\ConfigOptionsList', [], [], '', false);
$this->configData = $this->getMock('Magento\\Framework\\Config\\Data\\ConfigData', [], [], '', false);
$this->filePermissions = $this->getMock('\\Magento\\Framework\\Setup\\FilePermissions', [], [], '', false);
$this->deploymentConfig->expects($this->any())->method('get');
$this->configModel = new ConfigModel($this->collector, $this->writer, $this->deploymentConfig, $this->filePermissions);
}
示例11: testSaveConfigOverride
public function testSaveConfigOverride()
{
$configFiles = [ConfigFilePool::APP_CONFIG => 'test_conf.php', 'test_key' => 'test2_conf.php'];
$testSetExisting = [ConfigFilePool::APP_CONFIG => ['foo' => 'bar', 'key' => 'value', 'baz' => ['test' => 'value', 'test1' => 'value1']]];
$testSetUpdate = [ConfigFilePool::APP_CONFIG => ['baz' => ['test' => 'value2']]];
$testSetExpected = [ConfigFilePool::APP_CONFIG => ['foo' => 'bar', 'key' => 'value', 'baz' => ['test' => 'value2']]];
$this->deploymentConfig->expects($this->once())->method('resetData');
$this->configFilePool->expects($this->once())->method('getPaths')->willReturn($configFiles);
$this->dirWrite->expects($this->any())->method('isExist')->willReturn(true);
$this->reader->expects($this->once())->method('load')->willReturn($testSetExisting[ConfigFilePool::APP_CONFIG]);
$this->formatter->expects($this->once())->method('format')->with($testSetExpected[ConfigFilePool::APP_CONFIG])->willReturn([]);
$this->dirWrite->expects($this->once())->method('writeFile')->with('test_conf.php', []);
$this->object->saveConfig($testSetUpdate, true);
}
示例12: testIndexAction
public function testIndexAction()
{
$this->objectManager = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManagerInterface');
$this->objectManagerProvider = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', ['get'], [], '', false);
$this->deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
$this->objectManagerProvider->expects($this->once())->method('get')->willReturn($this->objectManager);
$this->objectManager->expects($this->once())->method('get')->willReturn($this->deploymentConfig);
$this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(false);
/** @var $controller Index */
$controller = new Index($this->objectManagerProvider);
$viewModel = $controller->indexAction();
$this->assertInstanceOf('Zend\\View\\Model\\ViewModel', $viewModel);
$this->assertFalse($viewModel->terminate());
}
示例13: setUp
public function setUp()
{
$this->dbValidator = $this->getMock('Magento\\Setup\\Validator\\DbValidator', [], [], '', false);
$this->deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
$this->deploymentConfig->expects($this->once())->method('get')->willReturn([ConfigOptionsListConstants::KEY_NAME => 'dbname', ConfigOptionsListConstants::KEY_HOST => 'host', ConfigOptionsListConstants::KEY_USER => 'username', ConfigOptionsListConstants::KEY_PASSWORD => 'password']);
$this->filesystem = $this->getMock('Magento\\Framework\\Filesystem', [], [], '', false);
$this->write = $this->getMock('Magento\\Framework\\Filesystem\\Directory\\Write', [], [], '', false);
$this->filesystem->expects($this->once())->method('getDirectoryWrite')->willReturn($this->write);
$this->phpReadinessCheck = $this->getMock('Magento\\Setup\\Model\\PhpReadinessCheck', [], [], '', false);
$this->readinessCheck = new ReadinessCheck($this->dbValidator, $this->deploymentConfig, $this->filesystem, $this->phpReadinessCheck);
$this->phpReadinessCheck->expects($this->once())->method('checkPhpVersion')->willReturn(['success' => true]);
$this->phpReadinessCheck->expects($this->once())->method('checkPhpExtensions')->willReturn(['success' => true]);
$this->phpReadinessCheck->expects($this->once())->method('checkPhpSettings')->willReturn(['success' => true]);
$this->expected = [ReadinessCheck::KEY_PHP_VERSION_VERIFIED => ['success' => true], ReadinessCheck::KEY_PHP_EXTENSIONS_VERIFIED => ['success' => true], ReadinessCheck::KEY_PHP_SETTINGS_VERIFIED => ['success' => true]];
}
示例14: setUpExecute
private function setUpExecute($input)
{
$this->setUpPassValidation();
$this->remove->expects($this->once())->method('remove')->with(['magento/package-a', 'magento/package-b']);
$this->dependencyChecker->expects($this->once())
->method('checkDependenciesWhenDisableModules')
->willReturn(['Magento_A' => [], 'Magento_B' => []]);
$this->dataSetup->expects($this->exactly(count($input['module'])))->method('deleteTableRow');
$this->deploymentConfig->expects($this->once())
->method('getConfigData')
->with(ConfigOptionsListConstants::KEY_MODULES)
->willReturn(['Magento_A' => 1, 'Magento_B' => 1, 'Magento_C' => 0, 'Magento_D' => 1]);
$this->loader->expects($this->once())
->method('load')
->with($input['module'])
->willReturn(['Magento_C' => [], 'Magento_D' => []]);
$this->writer->expects($this->once())
->method('saveConfig')
->with(
[
ConfigFilePool::APP_CONFIG =>
[ConfigOptionsListConstants::KEY_MODULES => ['Magento_C' => 0, 'Magento_D' => 1]]
]
);
$this->cache->expects($this->once())->method('clean');
$this->cleanupFiles->expects($this->once())->method('clearCodeGeneratedClasses');
}
示例15: testExecute
public function testExecute()
{
$this->objectManager->expects($this->once())
->method('get')
->with('Magento\Framework\App\Cache')
->willReturn($this->cacheMock);
$this->cacheMock->expects($this->once())->method('clean');
$writeDirectory = $this->getMock('Magento\Framework\Filesystem\Directory\WriteInterface');
$writeDirectory->expects($this->atLeastOnce())->method('delete');
$this->filesystem->expects($this->atLeastOnce())->method('getDirectoryWrite')->willReturn($writeDirectory);
$this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(true);
$progressBar = $this->getMockBuilder(
'Symfony\Component\Console\Helper\ProgressBar'
)
->disableOriginalConstructor()
->getMock();
$this->objectManager->expects($this->once())->method('configure');
$this->objectManager
->expects($this->once())
->method('create')
->with('Symfony\Component\Console\Helper\ProgressBar')
->willReturn($progressBar);
$this->manager->expects($this->exactly(6))->method('addOperation');
$this->manager->expects($this->once())->method('process');
$tester = new CommandTester($this->command);
$tester->execute([]);
$this->assertContains(
'Generated code and dependency injection configuration successfully.',
explode(PHP_EOL, $tester->getDisplay())
);
}