当前位置: 首页>>代码示例>>PHP>>正文


PHP ObjectManagerProvider::expects方法代码示例

本文整理汇总了PHP中Magento\Setup\Model\ObjectManagerProvider::expects方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectManagerProvider::expects方法的具体用法?PHP ObjectManagerProvider::expects怎么用?PHP ObjectManagerProvider::expects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Setup\Model\ObjectManagerProvider的用法示例。


在下文中一共展示了ObjectManagerProvider::expects方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCreate

 public function testCreate()
 {
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($this->objectManager);
     $this->objectManager->expects($this->once())->method('get')->with('Magento\\Theme\\Model\\Theme\\ThemeDependencyChecker');
     $this->themeDependencyCheckerFactory = new ThemeDependencyCheckerFactory($this->objectManagerProvider);
     $this->themeDependencyCheckerFactory->create();
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:7,代码来源:ThemeDependencyCheckerFactoryTest.php

示例2: testCreate

 public function testCreate()
 {
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($this->objectManager);
     $this->objectManager->expects($this->once())->method('get')->with('Magento\\Framework\\Module\\Status');
     $this->moduleStatusFactory = new ModuleStatusFactory($this->objectManagerProvider);
     $this->moduleStatusFactory->create();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:ModuleStatusFactoryTest.php

示例3: setUp

 public function setUp()
 {
     $this->moduleLoader = $this->getMock('Magento\\Framework\\Module\\ModuleList\\Loader', [], [], '', false);
     $this->dependencyChecker = $this->getMock('Magento\\Framework\\Module\\DependencyChecker', [], [], '', false);
     $this->deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
     $this->objectManager = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManagerInterface');
     $this->objectManagerProvider = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false);
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($this->objectManager);
     $this->objectManager->expects($this->once())->method('get')->willReturn($this->dependencyChecker);
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:10,代码来源:ModuleStatusTest.php

示例4: setUp

 protected function setUp()
 {
     $this->objectManagerProvider = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false);
     $objectManager = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManagerInterface');
     $this->objectManagerProvider->expects($this->any())->method('get')->will($this->returnValue($objectManager));
     $this->status = $this->getMock('Magento\\Framework\\Module\\Status', [], [], '', false);
     $this->cache = $this->getMock('Magento\\Framework\\App\\Cache', [], [], '', false);
     $this->cleanupFiles = $this->getMock('Magento\\Framework\\App\\State\\CleanupFiles', [], [], '', false);
     $this->fullModuleList = $this->getMock('Magento\\Framework\\Module\\FullModuleList', [], [], '', false);
     $objectManager->expects($this->any())->method('get')->will($this->returnValueMap([['Magento\\Framework\\Module\\Status', $this->status], ['Magento\\Framework\\App\\Cache', $this->cache], ['Magento\\Framework\\App\\State\\CleanupFiles', $this->cleanupFiles], ['Magento\\Framework\\Module\\FullModuleList', $this->fullModuleList]]));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:ModuleEnableDisableCommandTest.php

示例5: setup

 public function setup()
 {
     $this->backupRollbackFactory = $this->getMock('Magento\\Framework\\Setup\\BackupRollbackFactory', [], [], '', false);
     $this->backupRollback = $this->getMock('\\Magento\\Framework\\Setup\\BackupRollback', [], [], '', false);
     $this->status = $this->getMock('Magento\\Setup\\Model\\Cron\\Status', [], [], '', false);
     $output = $this->getMockForAbstractClass('Symfony\\Component\\Console\\Output\\OutputInterface', [], '', false);
     $this->objectManagerProvider = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false);
     $objectManager = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManagerInterface', [], '', false);
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager);
     $this->jobDbRollback = new JobDbRollback($this->backupRollbackFactory, $output, $this->status, $this->objectManagerProvider, 'setup:rollback', ['backup_file_name' => 'someFileName']);
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:11,代码来源:JobDbRollbackTest.php

示例6: setUp

 public function setUp()
 {
     $this->serviceLocatorMock = $this->getMockForAbstractClass('Zend\\ServiceManager\\ServiceLocatorInterface', ['get']);
     $deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
     $deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(false);
     $objectManager = $this->getMock('Magento\\Framework\\ObjectManagerInterface', [], [], '', false);
     $objectManager->expects($this->once())->method('get')->willReturn($deploymentConfig);
     $this->objectManagerProvider = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false);
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager);
     $this->serviceLocatorMock->expects($this->exactly(2))->method('get')->with('config')->will($this->returnValue(['navInstallerTitles' => ['install' => 'SomeTitle'], 'navInstaller' => [['key1' => 'value1'], ['key2' => 'value2'], ['nav' => 'abc', 'key3' => 'value3'], ['nav' => ''], ['nav' => false], ['main' => 'abc', 'key3' => 'value3'], ['main' => ''], ['main' => false]]]));
     $this->navigation = new Navigation($this->serviceLocatorMock, $this->objectManagerProvider);
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:12,代码来源:NavigationTest.php

示例7: testCreateUpdaterTasks

 /**
  * @param array $payload
  * @dataProvider createUpdaterTasksDataProvider
  */
 public function testCreateUpdaterTasks($payload)
 {
     $write = $this->getMockForAbstractClass('Magento\\Framework\\Filesystem\\Directory\\WriteInterface', [], '', false);
     $this->filesystem->expects($this->once())->method('getDirectoryWrite')->willReturn($write);
     $write->expects($this->once())->method('writeFile');
     $cacheManager = $this->getMock('\\Magento\\Framework\\App\\Cache\\Manager', [], [], '', false);
     $objectManager = $this->getMockForAbstractClass('\\Magento\\Framework\\ObjectManagerInterface');
     $objectManager->expects($this->once())->method('get')->willReturn($cacheManager);
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager);
     $cacheManager->expects($this->once())->method('getStatus')->willReturn(['cache1' => 1, 'cache2' => 0, 'cache3' => 1]);
     $this->model->createUpdaterTasks($payload);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:16,代码来源:UpdaterTaskCreatorTest.php

示例8: setUp

 protected function setUp()
 {
     $this->objectManagerProviderMock = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false);
     $objectManager = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManagerInterface');
     $this->objectManagerProviderMock->expects($this->any())->method('get')->will($this->returnValue($objectManager));
     $this->statusMock = $this->getMock('Magento\\Framework\\Module\\Status', [], [], '', false);
     $this->cacheMock = $this->getMock('Magento\\Framework\\App\\Cache', [], [], '', false);
     $this->cleanupFilesMock = $this->getMock('Magento\\Framework\\App\\State\\CleanupFiles', [], [], '', false);
     $this->fullModuleListMock = $this->getMock('Magento\\Framework\\Module\\FullModuleList', [], [], '', false);
     $this->deploymentConfigMock = $this->getMock(\Magento\Framework\App\DeploymentConfig::class, [], [], '', false);
     $this->generatedFiles = $this->getMock('\\Magento\\Framework\\Code\\GeneratedFiles', [], [], '', false);
     $objectManager->expects($this->any())->method('get')->will($this->returnValueMap([['Magento\\Framework\\Module\\Status', $this->statusMock], ['Magento\\Framework\\App\\Cache', $this->cacheMock], ['Magento\\Framework\\App\\State\\CleanupFiles', $this->cleanupFilesMock], ['Magento\\Framework\\Module\\FullModuleList', $this->fullModuleListMock]]));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:ModuleEnableDisableCommandTest.php

示例9: 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());
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:14,代码来源:IndexTest.php

示例10: setUp

 public function setUp()
 {
     $this->output = $this->getMockForAbstractClass('Symfony\\Component\\Console\\Output\\OutputInterface', [], '', false);
     $this->status = $this->getMock('Magento\\Setup\\Model\\Cron\\Status', [], [], '', false);
     $this->moduleUninstallHelper = $this->getMock('Magento\\Setup\\Model\\Cron\\Helper\\ModuleUninstall', [], [], '', false);
     $this->themeUninstallHelper = $this->getMock('Magento\\Setup\\Model\\Cron\\Helper\\ThemeUninstall', [], [], '', false);
     $this->composerInformation = $this->getMock('Magento\\Framework\\Composer\\ComposerInformation', [], [], '', false);
     $this->objectManagerProvider = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false);
     $this->objectManager = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManagerInterface', [], '', false);
     $packageInfoFactory = $this->getMock('Magento\\Framework\\Module\\PackageInfoFactory', [], [], '', false);
     $packageInfo = $this->getMock('Magento\\Framework\\Module\\PackageInfo', [], [], '', false);
     $packageInfoFactory->expects($this->any())->method('create')->willReturn($packageInfo);
     $this->objectManagerProvider->expects($this->any())->method('get')->willReturn($this->objectManager);
     $this->updater = $this->getMock('Magento\\Setup\\Model\\Updater', [], [], '', false);
     $this->quence = $this->getMock('Magento\\Setup\\Model\\Cron\\Queue', ['addJobs'], [], '', false);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:JobComponentUninstallTest.php

示例11: testComponentsAction

 public function testComponentsAction()
 {
     $objectManager = $this->getMock('Magento\\Framework\\ObjectManagerInterface', [], [], '', false);
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager);
     $objectManager->expects($this->any())->method('get')->willReturnMap([['Magento\\Framework\\Module\\PackageInfoFactory', $this->packageInfoFactoryMock], ['Magento\\Framework\\Module\\FullModuleList', $this->fullModuleListMock], ['Magento\\Framework\\Module\\ModuleList', $this->enabledModuleListMock]]);
     $this->packageInfoFactoryMock->expects($this->once())->method('create')->willReturn($this->packageInfo);
     $this->fullModuleListMock->expects($this->once())->method('getNames')->willReturn(['magento/sample-module1']);
     $this->packageInfo->expects($this->once())->method('getModuleName')->willReturn('Sample_Module');
     $this->packageInfo->expects($this->exactly(2))->method('getPackageName')->willReturn($this->componentData['magento/sample-module-one']['name']);
     $this->packageInfo->expects($this->exactly(2))->method('getVersion')->willReturn($this->componentData['magento/sample-module-one']['version']);
     $this->enabledModuleListMock->expects($this->once())->method('has')->willReturn(true);
     $this->composerInformationMock->expects($this->once())->method('getInstalledMagentoPackages')->willReturn($this->componentData);
     $this->composerInformationMock->expects($this->once())->method('isPackageInComposerJson')->willReturn(true);
     $this->packagesAuth->expects($this->once())->method('getAuthJsonData')->willReturn(['username' => 'someusername', 'password' => 'somepassword']);
     $this->packagesData->expects($this->once())->method('syncPackagesData')->willReturn($this->lastSyncData);
     $jsonModel = $this->controller->componentsAction();
     $this->assertInstanceOf('Zend\\View\\Model\\JsonModel', $jsonModel);
     $variables = $jsonModel->getVariables();
     $this->assertArrayHasKey('success', $variables);
     $this->assertTrue($variables['success']);
     $expected = [['name' => 'magento/sample-module-one', 'type' => 'magento2-module', 'version' => '1.0.0', 'update' => false, 'uninstall' => true, 'vendor' => 'magento', 'moduleName' => 'Sample_Module', 'enable' => true, 'disable' => false]];
     $this->assertEquals($expected, $variables['components']);
     $this->assertArrayHasKey('total', $variables);
     $this->assertEquals(1, $variables['total']);
     $this->assertEquals($this->lastSyncData, $variables['lastSyncData']);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:26,代码来源:ComponentGridTest.php

示例12: testIndexActionNotInstalled

 public function testIndexActionNotInstalled()
 {
     $this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(false);
     $this->objectManagerProvider->expects($this->exactly(0))->method('get');
     /** @var $controller Index */
     $controller = new Index($this->objectManagerProvider, $this->deploymentConfig);
     $viewModel = $controller->indexAction();
     $this->assertInstanceOf('Zend\View\Model\ViewModel', $viewModel);
     $this->assertFalse($viewModel->terminate());
 }
开发者ID:nblair,项目名称:magescotch,代码行数:10,代码来源:IndexTest.php

示例13: testExecuteNotInstalled

 public function testExecuteNotInstalled()
 {
     $this->deploymentConfig->expects($this->once())
         ->method('isAvailable')
         ->will($this->returnValue(false));
     $this->objectManagerProvider->expects($this->never())->method('get');
     $tester = new CommandTester($this->command);
     $tester->execute([]);
     $this->assertStringMatchesFormat(
         'You need to install the Magento application before running this utility.%w',
         $tester->getDisplay()
     );
 }
开发者ID:nja78,项目名称:magento2,代码行数:13,代码来源:DeployStaticContentCommandTest.php

示例14: setUp

 public function setUp()
 {
     $this->directoryList = $this->getMock('Magento\\Framework\\App\\Filesystem\\DirectoryList', [], [], '', false);
     $this->objectManagerProvider = $this->getMock('Magento\\Setup\\Model\\ObjectManagerProvider', [], [], '', false);
     $this->backupRollback = $this->getMock('Magento\\Setup\\Model\\BackupRollback', ['getDBDiskSpace', 'dbBackup'], [], '', false);
     $objectManager = $this->getMock('Magento\\Framework\\ObjectManagerInterface', [], [], '', false);
     $objectManager->expects($this->once())->method('create')->willReturn($this->backupRollback);
     $this->objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager);
     $this->log = $this->getMock('Magento\\Setup\\Model\\WebLogger', [], [], '', false);
     $this->filesystem = $this->getMock('Magento\\Framework\\Backup\\Filesystem', [], [], '', false);
     $this->controller = new BackupActionItems($this->objectManagerProvider, $this->log, $this->directoryList, $this->filesystem);
     $request = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Request', [], [], '', false);
     $response = $this->getMock('\\Zend\\Http\\PhpEnvironment\\Response', [], [], '', false);
     $routeMatch = $this->getMock('\\Zend\\Mvc\\Router\\RouteMatch', [], [], '', false);
     $mvcEvent = $this->getMock('\\Zend\\Mvc\\MvcEvent', [], [], '', false);
     $mvcEvent->expects($this->any())->method('setRequest')->with($request)->willReturn($mvcEvent);
     $mvcEvent->expects($this->any())->method('setResponse')->with($response)->willReturn($mvcEvent);
     $mvcEvent->expects($this->any())->method('setTarget')->with($this->controller)->willReturn($mvcEvent);
     $mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch);
     $contentArray = '{"options":{"code":false,"media":false,"db":true}}';
     $request->expects($this->any())->method('getContent')->willReturn($contentArray);
     $this->controller->setEvent($mvcEvent);
     $this->controller->dispatch($request, $response);
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:24,代码来源:BackupActionItemsTest.php


注:本文中的Magento\Setup\Model\ObjectManagerProvider::expects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。