Skip to content

Commit

Permalink
fix typo in second test and update to match first url workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
demeritcowboy committed Sep 5, 2019
1 parent 8437566 commit 5f3fd5f
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 5f3fd5f

Please sign in to comment.