public function EntityShareCronServiceTest::getResponseBody in Entity Share Cron 8
Same name and namespace in other branches
- 8.2 tests/src/Unit/EntityShareCronServiceTest.php \Drupal\Tests\entity_share_cron\Unit\EntityShareCronServiceTest::getResponseBody()
Returns the body of a request for a page.
Return value
\Psr\Http\Message\StreamInterface The mocked body.
File
- tests/
src/ Unit/ EntityShareCronServiceTest.php, line 204
Class
- EntityShareCronServiceTest
- @coversDefaultClass \Drupal\entity_share_cron\EntityShareCronService @group entity_share_cron
Namespace
Drupal\Tests\entity_share_cron\UnitCode
public function getResponseBody() {
$this->responsePages -= 1;
$json = [
'data' => $this->responseData[$this->requestCount++],
'links' => [
'next' => $this->responsePages > 0 ? 'page_' . $this->requestCount : FALSE,
],
];
$contents = json_encode($json);
$stream = $this
->getMock('Psr\\Http\\Message\\StreamInterface');
$stream
->expects($this
->any())
->method('getContents')
->will($this
->returnValue($contents));
return $stream;
}