public function testValidate() { $code = 'code'; $isInCatalog = true; $methodInstanceMock = $this->getMockBuilder('Magento\\Payment\\Model\\Method\\AbstractMethod')->disableOriginalConstructor()->setMethods([])->getMock(); $this->paypalShortcutHelperMock->expects($this->once())->method('isContextAvailable')->with($code, $isInCatalog)->will($this->returnValue(true)); $this->paypalShortcutHelperMock->expects($this->once())->method('isPriceOrSetAvailable')->with($isInCatalog)->will($this->returnValue(true)); $this->paymentHelperMock->expects($this->once())->method('getMethodInstance')->with($code)->will($this->returnValue($methodInstanceMock)); $methodInstanceMock->expects($this->once())->method('isAvailable')->with(null)->will($this->returnValue(true)); $this->assertTrue($this->checkoutValidator->validate($code, $isInCatalog)); }