| @@ 265-285 (lines=21) @@ | ||
| 262 | $client->getArticlesBySectionId(100, 'auto', ['invalid' => 100]); |
|
| 263 | } |
|
| 264 | ||
| 265 | public function testGetArticlesBySectionIdWithParams() |
|
| 266 | { |
|
| 267 | $client = $this->getClientWithResponse( |
|
| 268 | 200, |
|
| 269 | [], |
|
| 270 | [], |
|
| 271 | function (GuzzleHttpClient $guzzleClient) { |
|
| 272 | /** @var GuzzleHttpClient|\PHPUnit_Framework_MockObject_MockObject $guzzleClient */ |
|
| 273 | $guzzleClient->expects($this->once()) |
|
| 274 | ->method('createRequest') |
|
| 275 | ->with( |
|
| 276 | 'GET', |
|
| 277 | 'http://api.snd.no/news/v2/publication/sa/sections/100/desked?offset=50' |
|
| 278 | ) |
|
| 279 | ->willReturn(new Request('GET', '/sections/100/desked?offset=50')); |
|
| 280 | } |
|
| 281 | ); |
|
| 282 | ||
| 283 | $result = $client->getArticlesBySectionId(100, 'desked', ['offset' => 50]); |
|
| 284 | $this->assertEquals([], $result); |
|
| 285 | } |
|
| 286 | ||
| 287 | public function testGetArticle() |
|
| 288 | { |
|
| @@ 311-334 (lines=24) @@ | ||
| 308 | $client->searchByInstance(100100, 'invalid'); |
|
| 309 | } |
|
| 310 | ||
| 311 | public function testGetSearchByInstance() |
|
| 312 | { |
|
| 313 | $client = $this->getClientWithResponse( |
|
| 314 | 200, |
|
| 315 | [], |
|
| 316 | [], |
|
| 317 | function (GuzzleHttpClient $guzzleClient) { |
|
| 318 | $url = 'http://api.snd.no/news/v2/publication/sa/searchContents/instance?contentId=100100' . |
|
| 319 | '&contentType=article'; |
|
| 320 | ||
| 321 | /** @var GuzzleHttpClient|\PHPUnit_Framework_MockObject_MockObject $guzzleClient */ |
|
| 322 | $guzzleClient->expects($this->once()) |
|
| 323 | ->method('createRequest') |
|
| 324 | ->with( |
|
| 325 | 'GET', |
|
| 326 | $url |
|
| 327 | ) |
|
| 328 | ->willReturn(new Request('GET', '/searchContents/instance?contentId=100100&contentType=article')); |
|
| 329 | } |
|
| 330 | ); |
|
| 331 | ||
| 332 | $result = $client->searchByInstance(100100, 'article'); |
|
| 333 | $this->assertEquals([], $result); |
|
| 334 | } |
|
| 335 | ||
| 336 | public function testGetSearchByCollection() |
|
| 337 | { |
|
| @@ 336-356 (lines=21) @@ | ||
| 333 | $this->assertEquals([], $result); |
|
| 334 | } |
|
| 335 | ||
| 336 | public function testGetSearchByCollection() |
|
| 337 | { |
|
| 338 | $client = $this->getClientWithResponse( |
|
| 339 | 200, |
|
| 340 | [], |
|
| 341 | [], |
|
| 342 | function (GuzzleHttpClient $guzzleClient) { |
|
| 343 | /** @var GuzzleHttpClient|\PHPUnit_Framework_MockObject_MockObject $guzzleClient */ |
|
| 344 | $guzzleClient->expects($this->once()) |
|
| 345 | ->method('createRequest') |
|
| 346 | ->with( |
|
| 347 | 'GET', |
|
| 348 | 'http://api.snd.no/news/v2/publication/sa/searchContents/collection?contentIds=100100,200200' |
|
| 349 | ) |
|
| 350 | ->willReturn(new Request('GET', '/searchContents/collection?contentIds=100100,200200')); |
|
| 351 | } |
|
| 352 | ); |
|
| 353 | ||
| 354 | $result = $client->searchByCollection([100100, 200200]); |
|
| 355 | $this->assertEquals([], $result); |
|
| 356 | } |
|
| 357 | } |
|
| 358 | ||