Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#938 - remove duplicate lines #15216

Merged
merged 1 commit into from
Sep 5, 2019

Conversation

demeritcowboy
Copy link
Contributor

Overview

See https://lab.civicrm.org/dev/core/issues/938#note_22580. There's some duplicate lines that were never noticed before because the only time they would fail was when the lines above it would fail, but that meant the test would end before hitting them. Now that the lines above it are worked-around this comes up.

Before

Test can still fail intermittently because of duplicated lines.

After

Lines removed.

Technical Details

These duplicate lines are comparing the results of the previous get call a second time. My guess is they were copy and paste.

Comments

@civibot
Copy link

civibot bot commented Sep 4, 2019

(Standard links)

@seamuslee001
Copy link
Contributor

yep makes sense probably a copy and paste issue

@@ -349,9 +349,6 @@ public function testCreate($testEntityClass, $createParams, $expectedContent) {
'return' => ['content'],
]);
$this->assertEquals($expectedContent, $getResult2['values'][$fileId]['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");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yeah, I think the intent was to ensure that the get always returned essential fields (id, entity_table, entity_id) even if the return list didn't specify them, and the old snippet looks like a copy-paste error. (s/$getResult/$getResult2/)

Good point, though, that checking $getResult is effectively superfluous here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes I see it does return those even if you only ask for content. So I can put it back replacing with the getResult2 and removing url, and then adding a comment that that's why it's there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@demeritcowboy maybe replicate it what we did with the url above as well

@eileenmcnaughton eileenmcnaughton merged commit 6189132 into civicrm:master Sep 5, 2019
@demeritcowboy demeritcowboy deleted the attachment-url-2 branch September 5, 2019 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants