Esempio n. 1
0
 public function testExecuteWithException()
 {
     $this->flag->expects($this->once())->method('lock')->will($this->throwException(new \Exception('Test exception')));
     $logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
     $this->controllerArguments['context']->getObjectManager()->expects($this->at(2))->method('get')->with('Psr\\Log\\LoggerInterface')->will($this->returnValue($logger));
     $this->controller->execute();
 }
 public function testExecuteWithException()
 {
     $this->flag->expects($this->once())->method('lock')->will($this->throwException(new \Exception('Test exception')));
     $logger = $this->getMockBuilder('Magento\\Framework\\Logger')->setMethods(array('logException'))->disableOriginalConstructor()->getMock();
     $this->controllerArguments['context']->getObjectManager()->expects($this->at(2))->method('get')->with('Magento\\Framework\\Logger')->will($this->returnValue($logger));
     $this->controller->execute();
 }
Esempio n. 3
0
 public function testCheckSynchronizationOperations()
 {
     $this->flag->expects($this->once())->method('loadSelf')->will($this->returnSelf());
     $this->flag->expects($this->once())->method('isExpired')->will($this->returnValue(true));
     $observer = $this->objectManagerHelper->getObject('Magento\\Framework\\Event\\Observer');
     $this->notificationInterface->expects($this->once())->method('addMajor')->with('Google Shopping operation has expired.', 'One or more google shopping synchronization operations failed because of timeout.')->will($this->returnSelf());
     $this->observer->checkSynchronizationOperations($observer);
 }
 /**
  * @param string $exception
  * @return void
  * @dataProvider dataAddProductsExceptions
  */
 public function testAddProductsExceptions($exception)
 {
     $products = ['1'];
     $this->flag->expects($this->any())->method('isExpired')->will($this->returnValue(false));
     $product = $this->getMock('\\Magento\\Catalog\\Model\\Product', [], [], '', false);
     $this->productRepository->expects($this->once())->method('getById')->will($this->returnValue($product));
     $this->itemFactory->expects($this->once())->method('create')->willThrowException(new $exception(__('message')));
     $this->massOperations->setFlag($this->flag);
     $this->massOperations->addProducts($products, 1);
 }