public function testAfterGetOptions() { $quote = $this->getMockBuilder('Magento\\Sales\\Model\\Quote')->disableOriginalConstructor()->getMock(); $this->sessionMock->expects($this->once())->method('getQuote')->will($this->returnValue($quote)); $this->filterMock->expects($this->once())->method('hasRecurringItems')->with($quote)->will($this->returnValue(true)); $this->assertArrayHasKey('hasRecurringItems', $this->payment->afterGetOptions($this->getMock('\\Magento\\Checkout\\Block\\Onepage\\Payment', array(), array(), '', false), array())); }
public function testObserve() { $quote = $this->getMockBuilder('Magento\\Sales\\Model\\Quote')->disableOriginalConstructor()->getMock(); $event = new \Magento\Framework\Event(array('quote' => $quote, 'method_instance' => $this->getMockBuilder('Magento\\Payment\\Model\\Method\\AbstractMethod')->disableOriginalConstructor()->getMock(), 'result' => new \StdClass())); $this->filterMock->expects($this->once())->method('hasRecurringItems')->with($quote)->will($this->returnValue(true)); $observer = $this->getMockBuilder('Magento\\Framework\\Event\\Observer')->disableOriginalConstructor()->getMock(); $observer->expects($this->any())->method('getEvent')->will($this->returnValue($event)); $this->paymentAvailabilityObserver->observe($observer); $this->assertFalse($event->getResult()->isAvailable); }