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

[5.6] Keep same string format and avoid potential test failure #23056

Merged
merged 2 commits into from
Feb 7, 2018
Merged

[5.6] Keep same string format and avoid potential test failure #23056

merged 2 commits into from
Feb 7, 2018

Conversation

wanghanlin
Copy link
Contributor

Sorry, last PR #23047 sent to wrong branch.


ProcessUtils::escapeArgument will return a string wrapped by single quote 'artisan' (on macOS, but other OS should have same issue), but artisan is not wrapped. when ARTISAN_BINARY is not defined, unit test will error.

This PR make them in a same style.

Previous code could lead some potential test issue when running the test specifically in phpstorm targeting on one function testMakeProcessCorrectlyFormatsCommandLine in tests/Queue/QueuePoolTest.php. (might be a setup issue, but still should keep them in same style.)

This could be seen as a breaking change so targeting 5.6 branch

Attached output dump with phpunit script

/usr/local/Cellar/php71/7.1.8_20/bin/php /Users/project/path/framework/vendor/bin/phpunit --configuration /Users/project/path/framework/phpunit.xml.dist --filter "/::testMakeProcessCorrectlyFormatsCommandLine( .*)?$/" Illuminate\Tests\Queue\QueueListenerTest /Users/project/path/framework/tests/Queue/QueueListenerTest.php --teamcity
PHPUnit 6.5.5 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.1.8 with Xdebug 2.5.5
Configuration: /Users/project/path/framework/phpunit.xml.dist


Failed asserting that two strings are equal.
Expected :''/usr/local/Cellar/php71/7.1.8_20/bin/php' 'artisan' queue:work 'connection' --once --queue='queue' --delay=1 --memory=2 --sleep=3 --tries=0'
Actual   :''/usr/local/Cellar/php71/7.1.8_20/bin/php' artisan queue:work 'connection' --once --queue='queue' --delay=1 --memory=2 --sleep=3 --tries=0'
 <Click to see difference>

 /Users/project/path/framework/tests/Queue/QueueListenerTest.php:49
 
Time: 211 ms, Memory: 6.00MB

`ProcessUtils::escapeArgument` will return a string wrapped by single quote `'string'`, but `artisan` is not wrapped.
This PR make them in a same style. 
Previous code could lead some potential test issue when running the test specifically in phpstorm targeting on one function `testMakeProcessCorrectlyFormatsCommandLine` in `tests/Queue/QueuePoolTest.php`.

Attached output dump
```
/usr/local/Cellar/php71/7.1.8_20/bin/php /Users/project/path/framework/vendor/bin/phpunit --configuration /Users/project/path/framework/phpunit.xml.dist --filter "/::testMakeProcessCorrectlyFormatsCommandLine( .*)?$/" Illuminate\Tests\Queue\QueueListenerTest /Users/project/path/framework/tests/Queue/QueueListenerTest.php --teamcity
PHPUnit 6.5.5 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.1.8 with Xdebug 2.5.5
Configuration: /Users/project/path/framework/phpunit.xml.dist


Failed asserting that two strings are equal.
Expected :''/usr/local/Cellar/php71/7.1.8_20/bin/php' 'artisan' queue:work 'connection' --once --queue='queue' --delay=1 --memory=2 --sleep=3 --tries=0'
Actual   :''/usr/local/Cellar/php71/7.1.8_20/bin/php' artisan queue:work 'connection' --once --queue='queue' --delay=1 --memory=2 --sleep=3 --tries=0'
 <Click to see difference>

 /Users/project/path/framework/tests/Queue/QueueListenerTest.php:49
 


Time: 211 ms, Memory: 6.00MB

```
@taylorotwell taylorotwell merged commit 04977e2 into laravel:5.6 Feb 7, 2018
@wanghanlin wanghanlin deleted the patch-1 branch February 7, 2018 13:51
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.

2 participants