Following is the code that I'm using to mock the response of XmlResponse::getResultCode as Ok, but it isn't working, I'm not sure what exactly is going wrong here:
$response = $this->createPartialMock('\CommerceGuys\AuthNet\Response\XmlResponse', ['getResultCode']);
$response->expects($this->any())->method('getResultCode')->will($this->returnValue('Ok'));
$client = $this->createMock('\GuzzleHttp\Client');
$client->expects($this->any())->method('request')->withAnyParameters()->will($this->returnValue($response));
$this->container->set('http_client', $client);
$clientFactory = $this->createMock('\Drupal\Core\Http\ClientFactory');
$clientFactory->expects($this->any())->method('fromOptions')->will($this->returnValue($client));
$this->container->set('http_client_factory', $clientFactory);
I've even tried the prophesize way, but that's not working either:
$response = $this->prophesize('\CommerceGuys\AuthNet\Response\XmlResponse');
$response->getResultCode()->willReturn('Ok');
My goal is to mock the response of XmlResponse::getResultCode to return string Ok.
Trying the above approach for the D8 site with PHPUnit 7.5.20 using Kernal Testcase.