Пример #1
0
 public function testBeforeDispatchWithException()
 {
     $exception = new LocalizedException(new Phrase('Phrase'));
     $this->themeRegistration->expects($this->once())->method('register')->willThrowException($exception);
     $this->logger->expects($this->once())->method('critical');
     $this->plugin->beforeDispatch($this->abstractAction, $this->request);
 }
Пример #2
0
 public function testBeforeExecuteWithException()
 {
     $exception = new LocalizedException(new Phrase('Phrase'));
     $this->themeRegistration->expects($this->once())->method('register')->willThrowException($exception);
     $this->logger->expects($this->once())->method('critical');
     $object = new Registration($this->themeRegistration, $this->logger, $this->appState);
     $object->beforeExecute($this->abstractAction, $this->request);
 }
 public function testThemeRegistration()
 {
     $pattern = 'some pattern';
     $eventMock = $this->getMockBuilder('Magento\\Framework\\Event')->setMethods(['getPathPattern'])->disableOriginalConstructor()->getMock();
     $eventMock->expects($this->any())->method('getPathPattern')->willReturn($pattern);
     $observerMock = $this->getMockBuilder('Magento\\Framework\\Event\\Observer')->disableOriginalConstructor()->getMock();
     $observerMock->expects($this->any())->method('getEvent')->willReturn($eventMock);
     $this->registration->expects($this->once())->method('register')->with($pattern)->willThrowException(new \Magento\Framework\Exception\LocalizedException(__('exception')));
     $this->logger->expects($this->once())->method('critical');
     /** @var $observerMock \Magento\Framework\Event\Observer */
     $this->themeObserver->execute($observerMock);
 }