Skip to content

Commit

Permalink
Merge pull request #15216 from demeritcowboy/attachment-url-2
Browse files Browse the repository at this point in the history
dev/core#938 - remove duplicate lines
  • Loading branch information
eileenmcnaughton authored Sep 5, 2019
2 parents 2ce691d + 5f3fd5f commit 6189132
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/phpunit/api/v3/AttachmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,16 @@ public function testCreate($testEntityClass, $createParams, $expectedContent) {
'return' => ['content'],
]);
$this->assertEquals($expectedContent, $getResult2['values'][$fileId]['content']);
// Do this again even though we just tested above to demonstrate that these fields should be returned even if you only ask to return 'content'.
foreach (['id', 'entity_table', 'entity_id', 'url'] as $field) {
$this->assertEquals($createResult['values'][$fileId][$field], $getResult['values'][$fileId][$field], "Expect field $field to match");
if ($field == 'url') {
$this->assertEquals(substr($createResult['values'][$fileId][$field], 0, -15), substr($getResult2['values'][$fileId][$field], 0, -15));
$this->assertEquals(substr($createResult['values'][$fileId][$field], -3), substr($getResult2['values'][$fileId][$field], -3));
$this->assertApproxEquals(substr($createResult['values'][$fileId][$field], -14, 10), substr($getResult2['values'][$fileId][$field], -14, 10), 2);
}
else {
$this->assertEquals($createResult['values'][$fileId][$field], $getResult2['values'][$fileId][$field], "Expect field $field to match");
}
}
}

Expand Down

0 comments on commit 6189132

Please sign in to comment.