Skip to content

Commit

Permalink
phpunit - setMethods replaced
Browse files Browse the repository at this point in the history
  • Loading branch information
encreinformatique committed Jul 28, 2023
1 parent 81a44d7 commit ca6c9a6
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions tests/Endpoints/CampaignsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,19 @@ public function getOneWithOptions()
*/
public function getOneWithoutId()
{
$soapClient = $this->getMockBuilder(\SoapClient::class)
if (!method_exists($this, 'addMethods')) {
$soapClient = $this->getMockBuilder(\SoapClient::class)
->disableOriginalConstructor()
->setMethods(['webservice'])
->getMock();
} else {
$soapClient = $this->getMockBuilder(\SoapClient::class)
->disableOriginalConstructor()
->setMethods(['webservice'])
->addMethods(['webservice'])
->getMock();
$soapClient->expects($this->never())
->method('webservice');
}

$soapClient->expects($this->never())->method('webservice');

$campaignEndpoint = new Campaigns($soapClient);
$result = $campaignEndpoint->getOne([]);
Expand Down Expand Up @@ -164,10 +171,17 @@ private function getCorrectResponse()
*/
private function getClient($response = [], $dsMethod = '', $arguments = [])
{
$soapClient = $this->getMockBuilder(\SoapClient::class)
if (!method_exists($this, 'addMethods')) {
$soapClient = $this->getMockBuilder(\SoapClient::class)
->disableOriginalConstructor()
->setMethods(['webservice'])
->getMock();
} else {
$soapClient = $this->getMockBuilder(\SoapClient::class)
->disableOriginalConstructor()
->setMethods(['webservice'])
->addMethods(['webservice'])
->getMock();
}

$soapClient->expects($this->atMost(1))
->method('webservice')
Expand Down

0 comments on commit ca6c9a6

Please sign in to comment.