public function testExecuteEmptyQuoteError() { $resultExpectation = ['success' => false, 'error' => true, 'error_messages' => __('Your payment has been declined. Please try again.')]; $quoteMock = null; $jsonMock = $this->getMockBuilder('Magento\\Framework\\Controller\\Result\\Json')->disableOriginalConstructor()->getMock(); $this->sessionManagerMock->expects($this->atLeastOnce())->method('getQuote')->willReturn($quoteMock); $this->resultJsonFactoryMock->expects($this->once())->method('create')->willReturn($jsonMock); $jsonMock->expects($this->once())->method('setData')->with($resultExpectation)->willReturnSelf(); $this->assertEquals($jsonMock, $this->controller->executeInternal()); }