コード例 #1
0
 public function testNoFixtureConfigValue()
 {
     $attributeMock = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute', [], [], '', false);
     $attributeMock->expects($this->never())->method('save');
     $objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManager\\ObjectManager', [], [], '', false);
     $objectManagerMock->expects($this->never())->method('create')->with($this->equalTo('Magento\\Catalog\\Model\\ResourceModel\\Eav\\Attribute'))->willReturn($attributeMock);
     $this->fixtureModelMock->expects($this->never())->method('getObjectManager')->will($this->returnValue($objectManagerMock));
     $this->fixtureModelMock->expects($this->once())->method('getValue')->willReturn(false);
     $this->model->execute();
 }
コード例 #2
0
 public function testNoFixtureConfigValue()
 {
     $csvImportHandlerMock = $this->getMock('Magento\\TaxImportExport\\Model\\Rate\\CsvImportHandler', [], [], '', false);
     $csvImportHandlerMock->expects($this->never())->method('importFromCsvFile');
     $objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManager\\ObjectManager', [], [], '', false);
     $objectManagerMock->expects($this->never())->method('create')->willReturn($csvImportHandlerMock);
     $this->fixtureModelMock->expects($this->never())->method('getObjectManager')->willReturn($objectManagerMock);
     $this->fixtureModelMock->expects($this->once())->method('getValue')->willReturn(false);
     $this->model->execute();
 }
コード例 #3
0
 public function testNoFixtureConfigValue()
 {
     $ruleMock = $this->getMock('\\Magento\\SalesRule\\Model\\Rule', [], [], '', false);
     $ruleMock->expects($this->never())->method('save');
     $objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManager\\ObjectManager', [], [], '', false);
     $objectManagerMock->expects($this->never())->method('get')->with($this->equalTo('Magento\\SalesRule\\Model\\Rule'))->willReturn($ruleMock);
     $this->fixtureModelMock->expects($this->never())->method('getObjectManager')->willReturn($objectManagerMock);
     $this->fixtureModelMock->expects($this->once())->method('getValue')->willReturn(false);
     $this->model->execute();
 }
コード例 #4
0
 public function testNoFixtureConfigValue()
 {
     $cacheInterfaceMock = $this->getMock('Magento\\Framework\\App\\CacheInterface', [], [], '', false);
     $cacheInterfaceMock->expects($this->never())->method('clean');
     $objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManager\\ObjectManager', [], [], '', false);
     $objectManagerMock->expects($this->never())->method('get')->willReturn($cacheInterfaceMock);
     $this->fixtureModelMock->expects($this->never())->method('getObjectManager')->willReturn($objectManagerMock);
     $this->fixtureModelMock->expects($this->once())->method('getValue')->willReturn(false);
     $this->model->execute();
 }
コード例 #5
0
 public function testNoFixtureConfigValue()
 {
     $importMock = $this->getMock('\\Magento\\ImportExport\\Model\\Import', [], [], '', false);
     $importMock->expects($this->never())->method('validateSource');
     $importMock->expects($this->never())->method('importSource');
     $objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManager\\ObjectManager', [], [], '', false);
     $objectManagerMock->expects($this->never())->method('create')->with($this->equalTo('Magento\\ImportExport\\Model\\Import'))->willReturn($importMock);
     $this->fixtureModelMock->expects($this->never())->method('getObjectManager')->will($this->returnValue($objectManagerMock));
     $this->fixtureModelMock->expects($this->once())->method('getValue')->willReturn(false);
     $this->model->execute();
 }
コード例 #6
0
 public function testTest()
 {
     $reindexCommand = Bootstrap::getObjectManager()->get('Magento\\Indexer\\Console\\Command\\IndexerReindexCommand');
     $parser = Bootstrap::getObjectManager()->get('Magento\\Framework\\Xml\\Parser');
     $itfApplication = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getBootstrap()->getApplication();
     $model = new FixtureModel($reindexCommand, $parser, $itfApplication->getInitParams());
     $model->loadConfig(__DIR__ . '/_files/small.xml');
     $model->initObjectManager();
     foreach ($model->loadFixtures()->getFixtures() as $fixture) {
         $fixture->execute();
     }
 }
コード例 #7
0
 public function testNoFixtureConfigValue()
 {
     $storeMock = $this->getMock('\\Magento\\Store\\Model\\Store', [], [], '', false);
     $storeMock->expects($this->never())->method('save');
     $storeManagerMock = $this->getMock('Magento\\Store\\Model\\StoreManager', [], [], '', false);
     $storeManagerMock->expects($this->never())->method('getDefaultStoreView')->willReturn($storeMock);
     $objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManager\\ObjectManager', [], [], '', false);
     $objectManagerMock->expects($this->never())->method('create')->with($this->equalTo('Magento\\Store\\Model\\StoreManager'))->willReturn($storeManagerMock);
     $this->fixtureModelMock->expects($this->never())->method('getObjectManager')->willReturn($objectManagerMock);
     $this->fixtureModelMock->expects($this->exactly(3))->method('getValue')->willReturn(false);
     $this->model->execute();
 }
コード例 #8
0
 public function testTest()
 {
     $reindexCommand = Bootstrap::getObjectManager()->get('Magento\\Indexer\\Console\\Command\\IndexerReindexCommand');
     $parser = Bootstrap::getObjectManager()->get('Magento\\Framework\\Xml\\Parser');
     $itfApplication = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getBootstrap()->getApplication();
     $model = new FixtureModel($reindexCommand, $parser, $itfApplication->getInitParams());
     $model->loadConfig(__DIR__ . '/_files/small.xml');
     $model->initObjectManager();
     foreach ($model->loadFixtures()->getFixtures() as $fixture) {
         //TODO: OrderFixture execution must be unskiped after implementation MAGETWO-47449
         if ($fixture->getPriority() == '135') {
             continue;
         }
         $fixture->execute();
     }
 }
コード例 #9
0
 public function testNoFixtureConfigValue()
 {
     $connectionMock = $this->getMockForAbstractClass('\\Magento\\Framework\\DB\\Adapter\\AdapterInterface', [], '', true, true, true, []);
     $connectionMock->expects($this->never())->method('query');
     $resourceMock = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $resourceMock->expects($this->never())->method('getConnection')->with($this->equalTo('write'))->willReturn($connectionMock);
     $objectManagerMock = $this->getMock('Magento\\Framework\\ObjectManager\\ObjectManager', [], [], '', false);
     $objectManagerMock->expects($this->never())->method('get')->with($this->equalTo('Magento\\Framework\\App\\ResourceConnection'))->willReturn($resourceMock);
     $this->fixtureModelMock->expects($this->never())->method('getObjectManagerMock')->willReturn($objectManagerMock);
     $this->fixtureModelMock->expects($this->once())->method('getValue')->willReturn(false);
     $this->model->execute();
 }
コード例 #10
0
ファイル: FixtureModelTest.php プロジェクト: nja78/magento2
 public function testGetValue()
 {
     $this->assertSame(null, $this->model->getValue('null_key'));
 }
コード例 #11
0
 public function testSkipReindexOption()
 {
     $this->fixtureModel->expects($this->never())->method('reindex');
     $commandTester = new CommandTester($this->command);
     $commandTester->execute(['profile' => 'path_to_profile.xml', '--skip-reindex' => true]);
 }