Conversation
* Update dev phpunit to ^5.0
|
We already have a proposed fix for the proxy thing in #1792 It's not decided yet what should be the final solution though. |
|
@sagikazarmark I'm not fixing it, but just "hiding" the problem with testing against correct URI. If\When you decide to fix this in a proper way you choose you can add more tests against slash-trailed URIs to check that behavior is correct |
|
|
||
| public function testEmptyJarIsCountable() | ||
| { | ||
| self::assertCount(0, new CookieJar()); |
There was a problem hiding this comment.
Why self:: not $this->. I think code should be uniform.
There was a problem hiding this comment.
May be $this->assertInstanceOf will be better?
There was a problem hiding this comment.
Accepted $this->, will fix this.
Did not understand about instanceOf. This test explicitly invokes the count() method to be sure, that internals of CookieJar is countable from construction with 7.2
There was a problem hiding this comment.
As I understand, you want to check the existence of count method. Am I right? But actually you check that count == 0. So I'm suggesting you to check implementing of the \Countable interface.
There was a problem hiding this comment.
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 like null, which could be done internally (i.e counting internal property which was not initialized) . So I want to check that CookieJar 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.
You wrote:
So I want to check that CookieJar does not throws the warning when calling count
But actually you
you check that
count == 0
So nothing changes in my mind if you will check implementing of the \Countable interface, because it guarantees that calling count won't fail.
But it's kind of a holywar... =)
There was a problem hiding this comment.
Having count method implemented does not guarantees that id does not fail. Short example:
class foo implements \Countable {
private $things;
public function count() { return count($this->things); }
public function push($element) { $this->things[] = $element; }
}
$f = new \foo();
$f->count(); // this will pass on PHP < 7.2 and throw warning on PHP 7.2
$f->push(1);
$f->count(); // this will passSo 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.
| public function testAddsProxyByProtocol() | ||
| { | ||
| $url = str_replace('http', 'tcp', Server::$url); | ||
| $url = rtrim($url, '/'); |
There was a problem hiding this comment.
Can you add a quick not why we are doing this? Just to make sure we find it. Thanks
|
Ok, one small comment, then it's good to go. |
|
Thanks for your work. |
^4.0 || ^5.0(4.0 is no longer supported, but required for testing against PHP 5.5)At the moment no more failures found for 7.2 and tests are green. Further patches are matter of test coverage
Incorporates #1809
cc. @sagikazarmark