Issue #3031466 by mondrake, Wim Leers: EntityResourceTestBase::assert406Response uses a wrong assertion and results in false positives (and fails for PHPUnit 7)

merge-requests/1119/head
catch 2019-06-28 09:54:33 +01:00
parent 1dfafffa58
commit b57f550d12
1 changed files with 7 additions and 2 deletions

View File

@ -1538,8 +1538,13 @@ abstract class EntityResourceTestBase extends ResourceTestBase {
else {
// This is the desired response.
$this->assertSame(406, $response->getStatusCode());
$this->stringContains('?_format=' . static::$format . '>; rel="alternate"; type="' . static::$mimeType . '"', $response->getHeader('Link'));
$this->stringContains('?_format=foobar>; rel="alternate"', $response->getHeader('Link'));
$actual_link_header = $response->getHeader('Link');
if ($actual_link_header) {
$this->assertTrue(is_array($actual_link_header));
$expected_type = explode(';', static::$mimeType)[0];
$this->assertContains('?_format=' . static::$format . '>; rel="alternate"; type="' . $expected_type . '"', $actual_link_header[0]);
$this->assertContains('?_format=foobar>; rel="alternate"', $actual_link_header[0]);
}
}
}