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


PHP ModuleListInterface::expects方法代码示例

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


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

示例1: testExecute

 public function testExecute()
 {
     $this->moduleList->expects($this->once())->method('getNames')->willReturn([]);
     $commandTester = new CommandTester($this->command);
     $commandTester->execute([]);
     $this->assertContains('List of active modules', $commandTester->getDisplay());
 }
开发者ID:jeremyBass,项目名称:wsumage_command,代码行数:7,代码来源:CheckActiveModulesCommandTest.php

示例2: setUp

    protected function setUp()
    {
        $this->filePermissions = $this->getMock('Magento\Framework\Setup\FilePermissions', [], [], '', false);
        $this->configWriter = $this->getMock('Magento\Framework\App\DeploymentConfig\Writer', [], [], '', false);
        $this->configReader = $this->getMock('Magento\Framework\App\DeploymentConfig\Reader', [], [], '', false);
        $this->config = $this->getMock('Magento\Framework\App\DeploymentConfig', [], [], '', false);

        $this->moduleList = $this->getMockForAbstractClass('Magento\Framework\Module\ModuleListInterface');
        $this->moduleList->expects($this->any())->method('getOne')->willReturn(
            ['setup_version' => '2.0.0']
        );
        $this->moduleList->expects($this->any())->method('getNames')->willReturn(
            ['Foo_One', 'Bar_Two']
        );
        $this->moduleLoader = $this->getMock('Magento\Framework\Module\ModuleList\Loader', [], [], '', false);
        $this->directoryList = $this->getMock('Magento\Framework\App\Filesystem\DirectoryList', [], [], '', false);
        $this->adminFactory = $this->getMock('Magento\Setup\Model\AdminAccountFactory', [], [], '', false);
        $this->logger = $this->getMockForAbstractClass('Magento\Framework\Setup\LoggerInterface');
        $this->random = $this->getMock('Magento\Framework\Math\Random', [], [], '', false);
        $this->connection = $this->getMockForAbstractClass('Magento\Framework\DB\Adapter\AdapterInterface');
        $this->maintenanceMode = $this->getMock('Magento\Framework\App\MaintenanceMode', [], [], '', false);
        $this->filesystem = $this->getMock('Magento\Framework\Filesystem', [], [], '', false);
        $this->objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface');
        $this->contextMock = $this->getMock('Magento\Framework\Model\ResourceModel\Db\Context', [], [], '', false);
        $this->configModel = $this->getMock('Magento\Setup\Model\ConfigModel', [], [], '', false);
        $this->cleanupFiles = $this->getMock('Magento\Framework\App\State\CleanupFiles', [], [], '', false);
        $this->dbValidator = $this->getMock('Magento\Setup\Validator\DbValidator', [], [], '', false);
        $this->setupFactory = $this->getMock('Magento\Setup\Module\SetupFactory', [], [], '', false);
        $this->dataSetupFactory = $this->getMock('Magento\Setup\Module\DataSetupFactory', [], [], '', false);
        $this->sampleDataState = $this->getMock('Magento\Framework\Setup\SampleData\State', [], [], '', false);
        $this->componentRegistrar = $this->getMock('Magento\Framework\Component\ComponentRegistrar', [], [], '', false);
        $this->phpReadinessCheck = $this->getMock('Magento\Setup\Model\PhpReadinessCheck', [], [], '', false);
        $this->object = $this->createObject();
    }
开发者ID:rafaelstz,项目名称:magento2,代码行数:34,代码来源:InstallerTest.php

示例3: testGetModuleDataRefreshOrStatement

 /**
  * Tests modules data returns array and saving in DB
  *
  * @dataProvider itemDataProvider
  * @return void
  */
 public function testGetModuleDataRefreshOrStatement($data)
 {
     $moduleCollectionMock = $this->getMockBuilder('Magento\\NewRelicReporting\\Model\\ResourceModel\\Module\\Collection')->disableOriginalConstructor()->getMock();
     /** @var \Magento\NewRelicReporting\Model\Module|\PHPUnit_Framework_MockObject_MockObject $itemMock */
     $itemMock = $this->getMock('Magento\\NewRelicReporting\\Model\\Module', ['getName', 'getData', 'setData', 'getState', 'save'], [], '', false);
     $modulesMockArray = ['Module_Name1' => ['name' => 'Module_Name1', 'setup_version' => '2.0.0', 'sequence' => []]];
     $itemMock->setData($data);
     $testChangesMockArray = ['entity_id' => '3', 'name' => 'Name', 'active' => 'false', 'state' => 'enabled', 'setup_version' => '2.0.0', 'some_param' => 'some_value', 'updated_at' => '2015-09-02 18:38:17'];
     $itemMockArray = [$itemMock];
     $enabledModulesMockArray = ['Module_Name2'];
     $allModulesMockArray = ['Module_Name1', 'Module_Name2'];
     $this->moduleCollectionFactoryMock->expects($this->any())->method('create')->willReturn($moduleCollectionMock);
     $this->moduleFactoryMock->expects($this->any())->method('create')->willReturn($itemMock);
     $itemMock->expects($this->any())->method('setData')->willReturnSelf();
     $itemMock->expects($this->any())->method('save')->willReturnSelf();
     $itemMock->expects($this->any())->method('getState')->willReturn($data['state']);
     $itemMock->expects($this->any())->method('getName')->willReturn($data['name']);
     $moduleCollectionMock->expects($this->any())->method('getItems')->willReturn($itemMockArray);
     $itemMock->expects($this->any())->method('getData')->willReturn($testChangesMockArray);
     $this->fullModuleListMock->expects($this->once())->method('getAll')->willReturn($modulesMockArray);
     $this->fullModuleListMock->expects($this->any())->method('getNames')->willReturn($allModulesMockArray);
     $this->moduleListMock->expects($this->any())->method('getNames')->willReturn($enabledModulesMockArray);
     $this->moduleManagerMock->expects($this->any())->method('isOutputEnabled')->will($this->returnValue(true));
     $this->assertInternalType('array', $this->model->getModuleData());
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:31,代码来源:CollectTest.php

示例4: setUp

 protected function setUp()
 {
     $this->filePermissions = $this->getMock('Magento\\Setup\\Model\\FilePermissions', [], [], '', false);
     $this->configWriter = $this->getMock('Magento\\Framework\\App\\DeploymentConfig\\Writer', [], [], '', false);
     $this->configReader = $this->getMock('Magento\\Framework\\App\\DeploymentConfig\\Reader', [], [], '', false);
     $this->config = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
     $this->moduleList = $this->getMockForAbstractClass('Magento\\Framework\\Module\\ModuleListInterface');
     $this->moduleList->expects($this->any())->method('getOne')->willReturn(['setup_version' => '2.0.0']);
     $this->moduleList->expects($this->any())->method('getNames')->willReturn(['Foo_One', 'Bar_Two']);
     $this->moduleLoader = $this->getMock('Magento\\Framework\\Module\\ModuleList\\Loader', [], [], '', false);
     $this->deploymentConfigFactory = $this->getMock('Magento\\Framework\\Module\\ModuleList\\DeploymentConfigFactory', [], [], '', false);
     $this->deploymentConfig = $this->getMock('Magento\\Framework\\Module\\ModuleList\\DeploymentConfig', [], [], '', false);
     $this->directoryList = $this->getMock('Magento\\Framework\\App\\Filesystem\\DirectoryList', [], [], '', false);
     $this->adminFactory = $this->getMock('Magento\\Setup\\Model\\AdminAccountFactory', [], [], '', false);
     $this->logger = $this->getMockForAbstractClass('Magento\\Setup\\Model\\LoggerInterface');
     $this->random = $this->getMock('Magento\\Framework\\Math\\Random', [], [], '', false);
     $this->connection = $this->getMockForAbstractClass('Magento\\Framework\\DB\\Adapter\\AdapterInterface');
     $this->maintenanceMode = $this->getMock('Magento\\Framework\\App\\MaintenanceMode', [], [], '', false);
     $this->filesystem = $this->getMock('Magento\\Framework\\Filesystem', [], [], '', false);
     $this->sampleData = $this->getMock('Magento\\Setup\\Model\\SampleData', [], [], '', false);
     $this->objectManager = $this->getMockForAbstractClass('Magento\\Framework\\ObjectManagerInterface');
     $this->contextMock = $this->getMock('Magento\\Framework\\Model\\Resource\\Db\\Context', [], [], '', false);
     $this->object = $this->createObject();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:24,代码来源:InstallerTest.php

示例5: testGetModuleName

 /**
  * @param string $path
  * @param string $expectedResult
  * @dataProvider getModuleNameDataProvider
  */
 public function testGetModuleName($path, $expectedResult)
 {
     $this->_moduleList->expects($this->once())->method('getNames')->will($this->returnValue(['Fixture_ModuleOne', 'Fixture_ModuleTwo']));
     $this->_moduleDirs->expects($this->atLeastOnce())->method('getDir')->will($this->returnValueMap([['Fixture_ModuleOne', '', 'app/code/Fixture/ModuleOne'], ['Fixture_ModuleTwo', '', 'app/code/Fixture/ModuleTwo']]));
     $this->assertSame($expectedResult, $this->_model->getModuleName($path));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:ReverseResolverTest.php

示例6: testDetermineOmittedNamespace

 /**
  * @param string $namespace
  * @param array $modules
  * @param string $expected
  * @param bool $asFullModuleName
  *
  * @dataProvider determineOmittedNamespaceDataProvider
  */
 public function testDetermineOmittedNamespace($namespace, $modules, $expected, $asFullModuleName)
 {
     $this->moduleListMock->expects($this->once())->method('getNames')->willReturn($modules);
     $this->assertSame($expected, $this->namespaceResolver->determineOmittedNamespace($namespace, $asFullModuleName));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:NamespaceResolverTest.php


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