-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add PHP 7.2 testing #1811
Merged
Merged
Add PHP 7.2 testing #1811
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -270,6 +270,7 @@ public function testAddsProxy() | |
public function testAddsProxyByProtocol() | ||
{ | ||
$url = str_replace('http', 'tcp', Server::$url); | ||
$url = rtrim($url, '/'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a quick not why we are doing this? Just to make sure we find it. Thanks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, I've referred your #1823 issue |
||
$res = $this->getSendResult(['proxy' => ['http' => $url]]); | ||
$opts = stream_context_get_options($res->getBody()->detach()); | ||
$this->assertEquals($url, $opts['http']['proxy']); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why
self::
not$this->
. I think code should be uniform.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be
$this->assertInstanceOf
will be better?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accepted
$this->
, will fix this.Did not understand about
instanceOf
. This test explicitly invokes thecount()
method to be sure, that internals ofCookieJar
is countable from construction with 7.2There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand, you want to check the existence of
count
method. Am I right? But actually you check thatcount == 0
. So I'm suggesting you to check implementing of the\Countable
interface.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I wan't to actually invoke the
count
method. Because PHP 7.2 throws a warning when trying to count a non-countable things likenull
, which could be done internally (i.e counting internal property which was not initialized) . So I want to check thatCookieJar
does not throws the warning when calling count directly after constructing.https://wiki.php.net/rfc/counting_non_countables
The same thing I did with the
MockHandler
, but we have to fix it (see array default)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You wrote:
But actually you
So nothing changes in my mind if you will check implementing of the
\Countable
interface, because it guarantees that callingcount
won't fail.But it's kind of a holywar... =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having
count
method implemented does not guarantees that id does not fail. Short example:So having
count
method implemented does not guarantee that it works properly internally.Checking that
count == 0
is needed because the future phpunit versions will mark tests without assertions as risky, actually I could just call the(new CookieJar())->count()
without any assertions.