public function testGet() { $this->
initAuthentication();
$has_canonical_url =
$this->entity->
hasLinkTemplate('canonical'
);
// The URL and Guzzle request options that will be used in this test. The
// request options will be modified/expanded throughout this test:
// - to first test all mistakes a developer might make, and assert that the
// error responses provide a good DX
// - to eventually result in a well-formed request that succeeds.
$url =
$this->
getEntityResourceUrl();
$request_options =
[];
// DX: 404 when resource not provisioned, 403 if canonical route. HTML
// response because missing ?_format query string.
$response =
$this->
request('GET',
$url,
$request_options);
$this->
assertSame($has_canonical_url ? 403 : 404,
$response->
getStatusCode());
$this->
assertSame(['text/html; charset=UTF-8'
],
$response->
getHeader('Content-Type'
));
$url->
setOption('query',
['_format' =>
static::
$format]);
// DX: 404 when resource not provisioned, 403 if canonical route. Non-HTML