public function testGetPaymentIsDeleted() { $this->quote->setId(1); $payment = $this->getMock('Magento\\Quote\\Model\\Quote\\Payment', ['setQuote', 'isDeleted', 'getId', '__wakeup'], [], '', false); $payment->expects($this->exactly(2))->method('setQuote'); $payment->expects($this->once())->method('isDeleted')->willReturn(true); $payment->expects($this->once())->method('getId')->willReturn(1); $quotePaymentCollectionMock = $this->getMock('Magento\\Quote\\Model\\Resource\\Quote\\Payment\\Collection', ['setQuoteFilter', 'getFirstItem'], [], '', false); $quotePaymentCollectionMock->expects($this->once())->method('setQuoteFilter')->with(1)->will($this->returnSelf()); $quotePaymentCollectionMock->expects($this->once())->method('getFirstItem')->willReturn($payment); $this->quotePaymentCollectionFactoryMock->expects($this->once())->method('create')->willReturn($quotePaymentCollectionMock); $this->paymentFactoryMock->expects($this->once())->method('create')->willReturn($payment); $this->assertInstanceOf('\\Magento\\Quote\\Model\\Quote\\Payment', $this->quote->getPayment()); }