| @@ 176-192 (lines=17) @@ | ||
| 173 | * @expectedException Radowoj\Yaah\Exception |
|
| 174 | * @expectedExceptionMessage Invalid WebAPI doQuerySysStatus() response |
|
| 175 | */ |
|
| 176 | public function testExceptionOnInvalidQuerySysStatusResponse() |
|
| 177 | {
|
|
| 178 | $config = $this->getConfig(); |
|
| 179 | ||
| 180 | $soapClient = $this->getMockBuilder(SoapClient::class) |
|
| 181 | ->disableOriginalConstructor() |
|
| 182 | ->setMethods(['doQuerySysStatus', 'doSomethingAfterLogin']) |
|
| 183 | ->getMock(); |
|
| 184 | ||
| 185 | //Allegro version key should be requested for first login per request |
|
| 186 | $soapClient->expects($this->once()) |
|
| 187 | ->method('doQuerySysStatus')
|
|
| 188 | ->willReturn((object)['trololo' => 'thisIsNotAVersionKey']); |
|
| 189 | ||
| 190 | $client = new Client($config, $soapClient); |
|
| 191 | $client->login(); |
|
| 192 | } |
|
| 193 | ||
| 194 | ||
| 195 | /** |
|
| @@ 441-457 (lines=17) @@ | ||
| 438 | * @expectedException Radowoj\Yaah\Exception |
|
| 439 | * @expectedExceptionMessage Invalid WebAPI response: stdClass Object |
|
| 440 | */ |
|
| 441 | public function testGetAuctionByItemIdExceptionOnInvalidResponse() |
|
| 442 | {
|
|
| 443 | $apiClient = $this->getMockBuilder(Client::class) |
|
| 444 | ->disableOriginalConstructor() |
|
| 445 | ->setMethods(['doGetItemFields']) |
|
| 446 | ->getMock(); |
|
| 447 | ||
| 448 | $apiClient->expects($this->once()) |
|
| 449 | ->method('doGetItemFields')
|
|
| 450 | ->with($this->equalTo([ |
|
| 451 | 'itemId' => 4321, |
|
| 452 | ])) |
|
| 453 | ->willReturn((object)[]); |
|
| 454 | ||
| 455 | $helper = new Helper($apiClient); |
|
| 456 | $helper->getAuctionByItemId(4321); |
|
| 457 | } |
|
| 458 | ||
| 459 | ||
| 460 | public function testGetAuctionByItem() |
|