Uh oh!
There was an error while loading. Please reload this page.
Conversation
clue
commented
Jan 11, 2017
I'm currently undecided so I won't vote yet. Can we really pass values for these missing constants or should we rather make sure the tests are skipped in this case? |
ghost
commented
Jan 11, 2017
The tests are skipped when pcntl is not loaded. The problem is that the constants are used in a data provider and PHPUnit will allways call the data provider before the test is skipped from within. An alternative solution would be to do the checks in the data provider and provide defaults. This way one can get rid of notices without defining constants. |
clue
commented
Jan 15, 2017
IMHO it makes more sense to make sure the data provider is only invoked if the extension is actually available. If this is not possible, then I would suggest using signal constant names only and accessing values only through the What do you think? |
ghost
commented
Jan 15, 2017
Using I changed the code to do the checks in the data provider. I am not aware of any way to prevent the data provider from being called by PHPUnit. Another solution would be to do the signal testing in another test class and do the check in the setup method but that is too much work IMHO. |
jsor
commented
Feb 3, 2017
From the PHPUnit docs (second blue box):
Also related: sebastianbergmann/phpunit#836 This current solution looks like a good compromise, so i'm 👍 |
jsor
left a comment
There was a problem hiding this comment.
I've recently run into the same while running the test suite on windows, so 👍
clue
left a comment
There was a problem hiding this comment.
Looks okay to me, but consider my comment below anyway 👍
| ['SIGTERM', SIGTERM], | ||
| ['SIGUSR1', defined('SIGUSR1') ? SIGUSR1 : 10], | ||
| ['SIGHUP', defined('SIGHUP') ? SIGHUP : 1], | ||
| ['SIGTERM', defined('SIGTERM') ? SIGTERM : 15], |
There was a problem hiding this comment.
This looks okay to me. My suggestion would have been to only return the constant names here and then use constant() to access their values within the test instead. This way we would not have to provide any defaults at all and could still skip the tests (possibly via defined()). What do you think about this?
clue
commented
Feb 8, 2017
Ping @martinschroeder, what do you think about the above suggestion? Also, may I ask you to rebase this on the new "0.4" branch so we get this in for the upcoming v0.4.3 release? |
clue
commented
Feb 12, 2017
I've updated the base branch, can you force-push a rebased version? 👍 |
ghost
commented
Feb 12, 2017
I rebased the PR and changed the data provider to use signal constant names as suggested. |
Define constants
SIGUSR1,SIGHUPandSIGTERMif they are not defined yet. The signal constants are used in data providerStreamSelectLoopTest::signalProvider()and cause a notice when the pcntl extension is not loaded.