-
Notifications
You must be signed in to change notification settings - Fork 62
Conversation
updated some tests with ::class changed composer.json with phpunit to min 5.7.14 or 6.0.7
@@ -193,6 +194,13 @@ public function testAssertListenerAtPriorityFailsWhenListenerIsNotFound() | |||
$arguments['event'], | |||
$arguments['priority'] | |||
), $e->getMessage(), sprintf('Assertion failure message was unexpected: %s', $e->getMessage())); | |||
// for PHPUnit 5.7 |
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.
Please no dependencies to a specific version.
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.
thats the fallback for PHPUnit5, thats not just phpunit5.7
that exception class doesnt exist in phpunit 6, so there must be a fallback, other way would be a class_alias
or a check if the class exists.
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.
Please have a look how @weierophinney did it in another repo:
zendframework/zend-component-installer@654983e
I'd suggest the same way here.
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.
ohh i missed that, is that workflow is expected, than i will change that sure =)
@@ -9,7 +9,7 @@ | |||
|
|||
namespace Zend\EventManager\Test; | |||
|
|||
use PHPUnit_Framework_Assert as Assert; | |||
use PHPUnit\Framework\Assert as Assert; |
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.
Alias Assert
here is redundant.
@kokspflanze We need also update travis configuration, to install PHPUnit 5.7 on PHP5.6, please see changes for example here: |
composer.json
Outdated
@@ -32,7 +32,7 @@ | |||
"php": "^5.6 || ^7.0" | |||
}, | |||
"require-dev": { | |||
"phpunit/PHPUnit": "^5.6", | |||
"phpunit/PHPUnit": "^5.7.14 || ^6.0.7", |
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.
I would suggest also swap order here, please see:
zendframework/zend-expressive-skeleton@39ef689
Alias Assert is redundant update travis configuration swap order of phpunit version
updated doc-block
done, i just added in the autoload file a |
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.
LGTM 👍
@@ -9,7 +9,7 @@ | |||
|
|||
namespace Zend\EventManager\Test; | |||
|
|||
use PHPUnit_Framework_Assert as Assert; | |||
use PHPUnit\Framework\Assert; |
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 not using $this->assertTrue()
instead of Assert::assertTrue()
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?
in that case we are in a trait class and the class that this trait import can not have that method.
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.
Makes sense
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.
Makes sense
Sure? If we look at the comments of the class:
Trait providing utility methods and assertions for use in PHPUnit test cases.
😉
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.
before the Assert
class it was with the TestCase
class
from my site i see the Assets
class as better solution, with $this
it could be possible that it break smth in other tests if someone not use the TestCase
as parent-class. also we have a autocomplete and no warning that the method not exist.
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.
@froschdesign In a trait it's only possible to define an abstract method to define that a specific method needs to be available but that does not work with __call()
so it gets marked red in good IDEs. Using the direct assert seems to be more clear and the trait itself can be tested much 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.
I fine with it. No extra discussion needed. (Look at the smiley!)
The topic of this PR is "added phpunit 6", but you provide an all-in-one-commit:
This may be necessary, but not in one commit! It's fine to add all this changes to one PR, but please create separate commits for each problem. We work with a version control system and these all-in-one-commits breaks this system. Try a cherry-pick or try to read the history. Each individual change should be one commit. (Added benefit: a review becomes easier and faster!) |
@froschdesign no problem to split it in more commits, but that week is no much space, hope its okay if i do that next week. didnt know that this should be in more commits, it was for me one little task. |
I can live with this PR. @marc-mabe What are you saying?
Which mixes different problems! Each individual change should be one commit. That's not a specific feature or requirement of Zend Framework, GitHub or me. That's the principle of a version control system. |
Thanks, @kokspflanze |
updated some tests with ::class
changed composer.json with phpunit to min 5.7.14 or 6.0.7