@@ 379-405 (lines=27) @@ | ||
376 | ||
377 | ||
378 | ||
379 | public function testGetSiteJournalDealsWithDefaultParams() |
|
380 | { |
|
381 | $apiClient = $this->getMockBuilder(Client::class) |
|
382 | ->disableOriginalConstructor() |
|
383 | ->setMethods(['doGetSiteJournalDeals']) |
|
384 | ->getMock(); |
|
385 | ||
386 | $apiClient->expects($this->once()) |
|
387 | ->method('doGetSiteJournalDeals') |
|
388 | ->with($this->equalTo([ |
|
389 | 'journalStart' => 0, |
|
390 | ])) |
|
391 | ->willReturn((object)[ |
|
392 | 'siteJournalDeals' => (object)[ |
|
393 | 'item' => [ |
|
394 | (object)[ |
|
395 | 'dealEventId' => 42 |
|
396 | ] |
|
397 | ] |
|
398 | ] |
|
399 | ]); |
|
400 | ||
401 | $helper = new Helper($apiClient); |
|
402 | $deals = $helper->getSiteJournalDeals(); |
|
403 | ||
404 | $this->assertContainsOnly('Radowoj\Yaah\Journal\Deal', $deals); |
|
405 | } |
|
406 | ||
407 | ||
408 | public function testGetSiteJournalDealsWithNonzeroStart() |
|
@@ 408-434 (lines=27) @@ | ||
405 | } |
|
406 | ||
407 | ||
408 | public function testGetSiteJournalDealsWithNonzeroStart() |
|
409 | { |
|
410 | $apiClient = $this->getMockBuilder(Client::class) |
|
411 | ->disableOriginalConstructor() |
|
412 | ->setMethods(['doGetSiteJournalDeals']) |
|
413 | ->getMock(); |
|
414 | ||
415 | $apiClient->expects($this->once()) |
|
416 | ->method('doGetSiteJournalDeals') |
|
417 | ->with($this->equalTo([ |
|
418 | 'journalStart' => 71830, |
|
419 | ])) |
|
420 | ->willReturn((object)[ |
|
421 | 'siteJournalDeals' => (object)[ |
|
422 | 'item' => [ |
|
423 | (object)[ |
|
424 | 'dealEventId' => 42 |
|
425 | ] |
|
426 | ] |
|
427 | ] |
|
428 | ]); |
|
429 | ||
430 | $helper = new Helper($apiClient); |
|
431 | $deals = $helper->getSiteJournalDeals(71830); |
|
432 | ||
433 | $this->assertContainsOnly('Radowoj\Yaah\Journal\Deal', $deals); |
|
434 | } |
|
435 | ||
436 | ||
437 |