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

Replace usage of deprecated $canonicalize phpunit parameter #238

Merged
merged 7 commits into from Jul 1, 2019
Merged

Replace usage of deprecated $canonicalize phpunit parameter #238

merged 7 commits into from Jul 1, 2019

Conversation

G-Rath
Copy link
Contributor

@G-Rath G-Rath commented Feb 28, 2019

More deprecated things.

In other news, I found the PHPUnit issue on github 😃

@@ -26,7 +30,7 @@ public function testAllergiesToOneAllergen($allergicTo)
$otherAllergen = array_filter(Allergen::allergenList(), function ($allergen) use ($allergicTo) {
return $allergen != $allergicTo;
});
$self = $this;
$self = $this;
array_map(function ($allergen) use ($allergies, $self) {
$self->assertFalse($allergies->isAllergicTo($allergen));
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm this is weird, passing $self through here, not sure why it isn't just $this->assertFalse() inside the closure 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Prior to PHP 5.4 $this wasn't bound automatically inside anonymous functions, so it was possibly written with that in mind? The test was originally written in 2016, when 5.4 had only just reached it's end of life and keeping PHP up to date wasn't as common.

It should probably be removed now, however, as 5.4 has been EOL'd for four years.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me know if you guys want me to remove this :)

Also: Hi Ross! :P

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it makes sense to remove it, as it's bad practice now and the tests are something students should be looking at while they're working through a problem.

Thoughts @petemcfarlane?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah 💯

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you guys want this change, could you please request it? (i.e review with "changes requested")

/cc @DerTee

@DerTee
Copy link
Contributor

DerTee commented Apr 27, 2019

@G-Rath Since the assertEqualsCanonicalize thing was fixed in a different PR: Could you rebase this PR on the current master and check what is left?
I think at least your are other two commits are still valid and should be merged.

@G-Rath
Copy link
Contributor Author

G-Rath commented Apr 27, 2019

Sure thing!

@G-Rath
Copy link
Contributor Author

G-Rath commented Apr 27, 2019

@DerTee I've merged this branch with master - hopefully it's how you want it. I had a bit of trouble with rebasing & such (I'm still learning about working across forks), so let me know if there's any problems with it.

Worse case, I can remake the branch by just cherry picking the commits out.

@DerTee
Copy link
Contributor

DerTee commented Apr 28, 2019

@G-Rath No, a merge just clutters the history unnecessarily in this case. But a rebase with conflicts can be a major pain, that's true :)

I think you are right, doing a cherry pick is probably the smarter move (maybe in a new PR if it's too much hassle to change this one, I don't know what's better).

@@ -26,7 +30,7 @@ public function testAllergiesToOneAllergen($allergicTo)
$otherAllergen = array_filter(Allergen::allergenList(), function ($allergen) use ($allergicTo) {
return $allergen != $allergicTo;
});
$self = $this;
$self = $this;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please can we remove this temporary variable $self, as it's no longer necessary

@petemcfarlane petemcfarlane merged commit 8770606 into exercism:master Jul 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants