This probably would not happen on DrupalCI
But this code in \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
$this->assertSame([str_replace($this->entity->id(), static::$firstCreatedEntityId, $this->entity->toUrl('canonical')->setAbsolute(TRUE)->toString())], $response->getHeader('Location'));
causes a error for me locally
1) Drupal\Tests\rest\Functional\EntityResource\User\UserJsonAnonTest::testPost
Failed asserting that Array &0 (
0 => 'http://www.local.dev/d8_3_rest/user/4'
) is identical to Array &0 (
0 => 'http://www.local.dev/d8_4_rest/user/4'
).
This is because "3" is replaced in "d8_3_rest" where it should only be replaced in "user/3"
Comment | File | Size | Author |
---|---|---|---|
#13 | 2834848-13.patch | 1.68 KB | tedbow |
#9 | interdiff-3-9.txt | 1.17 KB | tedbow |
#9 | 2834848-9.patch | 2.04 KB | tedbow |
| |||
#3 | 2834848-3.patch | 2.05 KB | tedbow |
Comments
Comment #2
tedbowComment #3
tedbowHere is a fix the problem happens twice in the same function.
Comment #4
tedbowComment #5
Wim Leerss/id/ID/
Needs newline before it.
Trailing comment must be removed.
Comment below is not indented correctly.
The formatting here makes it hard to see what's going on. Let's change it to
Comment #6
Wim LeersGreat catch BTW!
Comment #7
Wim LeersAlso affects 8.2.x.
Comment #8
Wim LeersIntroduced in #2737719: EntityResource: Provide comprehensive test coverage: for every entity type, every format, every method.
Comment #9
tedbow@Wim Leers thanks for review. This patch address all issues in #5
Comment #10
Wim LeersSuper nit:
string|int
, per\Drupal\Core\Entity\EntityInterface::id()
.Comment #11
alexpottSo I wouldn't create a new method. And the whole substr thing here is strange. How about just doing (for example)...
Comment #12
Wim Leers#11 makes a great point. I also don't see a reason why we can't just do that instead. Much simpler.
Comment #13
tedbowOK here is @alexpott's suggestion for #11. Thanks!
No interdiff because new lines are completely different.
Comment #14
Wim LeersThat totally makes sense. Nice simplification!
Comment #16
Wim LeersComment #17
dawehnerNice fix!
Comment #21
xjmNice clean solution. Committed to 8.4.x, and backported to 8.3.x as a testing bugfix. Thanks everyone!