-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
End-to-End test(s) simulating how PhpStorm invokes PHPUnit #6367
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
Merged
sebastianbergmann
merged 3 commits into
sebastianbergmann:10.5
from
schlndh:feature-addE2ETestForPhpStorm
Oct 8, 2025
+144
−0
Merged
Changes from all commits
Commits
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
72 changes: 72 additions & 0 deletions
72
tests/end-to-end/cli/filter/filter-dataprovider-by-phpstorm-regex-number-key.phpt
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--TEST-- | ||
https://github.com/sebastianbergmann/phpunit/pull/6364 | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
|
||
// Simulate how PHPStorm runs a test class. | ||
$process = proc_open( | ||
[ | ||
PHP_BINARY, | ||
__DIR__ . '/../../../../phpunit', | ||
'--do-not-cache-result', | ||
'--no-configuration', | ||
'--filter', | ||
'PHPUnit\\\\TestFixture\\\\DataProviderFilterTest', | ||
'--test-suffix', | ||
'DataProviderFilterTest.php', | ||
__DIR__ . '/../../../_files', | ||
'--teamcity', | ||
], | ||
[ | ||
1 => ['pipe', 'w'], | ||
], | ||
$pipes, | ||
); | ||
|
||
$stdout = stream_get_contents($pipes[1]); | ||
fclose($pipes[1]); | ||
proc_close($process); | ||
|
||
if (preg_match("/##teamcity\\[testStarted name='testTrue with data set #1' locationHint='([^']+)'/", $stdout, $matches) !== 1) { | ||
echo "Failed to find locationHint.\n"; | ||
echo $stdout; | ||
|
||
return 0; | ||
} | ||
|
||
if (preg_match('#php_qn://(?:[A-Z]:)?[^:]*::\\\\(.*)#', $matches[1], $locationHintMatches) !== 1) { | ||
echo "Failed to parse locationHint.\n"; | ||
echo $matches[1]; | ||
|
||
return 0; | ||
} | ||
|
||
// Simulate how PHPStorm runs an individual numbered test case | ||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--no-configuration'; | ||
$_SERVER['argv'][] = '--filter'; | ||
$_SERVER['argv'][] = '/' . preg_quote($locationHintMatches[1], '/') . '$/'; | ||
$_SERVER['argv'][] = '--test-suffix'; | ||
$_SERVER['argv'][] = 'DataProviderFilterTest.php'; | ||
$_SERVER['argv'][] = __DIR__ . '/../../../_files'; | ||
$_SERVER['argv'][] = '--teamcity'; | ||
|
||
require_once __DIR__ . '/../../../bootstrap.php'; | ||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
--EXPECTF-- | ||
PHPUnit %s by Sebastian Bergmann and contributors. | ||
|
||
Runtime: PHP %s | ||
|
||
##teamcity[testCount count='1' flowId='%s'] | ||
##teamcity[testSuiteStarted name='CLI Arguments' flowId='%d'] | ||
##teamcity[testSuiteStarted name='PHPUnit\TestFixture\DataProviderFilterTest' locationHint='php_qn://%sDataProviderFilterTest.php::\PHPUnit\TestFixture\DataProviderFilterTest' flowId='%d'] | ||
##teamcity[testSuiteStarted name='testTrue' locationHint='php_qn://%sDataProviderFilterTest.php::\PHPUnit\TestFixture\DataProviderFilterTest::testTrue' flowId='%d'] | ||
##teamcity[testStarted name='testTrue with data set #1' locationHint='php_qn://%sDataProviderFilterTest.php::\PHPUnit\TestFixture\DataProviderFilterTest::testTrue with data set #1' flowId='%d'] | ||
##teamcity[testFinished name='testTrue with data set #1' duration='%s' flowId='%d'] | ||
##teamcity[testSuiteFinished name='testTrue' flowId='%d'] | ||
##teamcity[testSuiteFinished name='PHPUnit\TestFixture\DataProviderFilterTest' flowId='%d'] | ||
##teamcity[testSuiteFinished name='CLI Arguments' flowId='%d'] | ||
Time: %s, Memory: %s | ||
|
||
OK (1 test, 1 assertion) |
72 changes: 72 additions & 0 deletions
72
tests/end-to-end/cli/filter/filter-dataprovider-by-phpstorm-regex-string-key.phpt
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--TEST-- | ||
https://github.com/sebastianbergmann/phpunit/pull/6364 | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
|
||
// Simulate how PHPStorm runs a test class. | ||
$process = proc_open( | ||
[ | ||
PHP_BINARY, | ||
__DIR__ . '/../../../../phpunit', | ||
'--do-not-cache-result', | ||
'--no-configuration', | ||
'--filter', | ||
'PHPUnit\\\\TestFixture\\\\DataProviderFilterTest', | ||
'--test-suffix', | ||
'DataProviderFilterTest.php', | ||
__DIR__ . '/../../../_files', | ||
'--teamcity', | ||
], | ||
[ | ||
1 => ['pipe', 'w'], | ||
], | ||
$pipes, | ||
); | ||
|
||
$stdout = stream_get_contents($pipes[1]); | ||
fclose($pipes[1]); | ||
proc_close($process); | ||
|
||
if (preg_match("/##teamcity\\[testStarted name='testFalse with data set \"false test\"' locationHint='([^']+)'/", $stdout, $matches) !== 1) { | ||
echo "Failed to find locationHint.\n"; | ||
echo $stdout; | ||
|
||
return 0; | ||
} | ||
|
||
if (preg_match('#php_qn://(?:[A-Z]:)?[^:]*::\\\\(.*)#', $matches[1], $locationHintMatches) !== 1) { | ||
echo "Failed to parse locationHint.\n"; | ||
echo $matches[1]; | ||
|
||
return 0; | ||
} | ||
|
||
// Simulate how PHPStorm runs an individual named test case | ||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--no-configuration'; | ||
$_SERVER['argv'][] = '--filter'; | ||
$_SERVER['argv'][] = '/' . preg_quote($locationHintMatches[1], '/') . '$/'; | ||
$_SERVER['argv'][] = '--test-suffix'; | ||
$_SERVER['argv'][] = 'DataProviderFilterTest.php'; | ||
$_SERVER['argv'][] = __DIR__ . '/../../../_files'; | ||
$_SERVER['argv'][] = '--teamcity'; | ||
|
||
require_once __DIR__ . '/../../../bootstrap.php'; | ||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
--EXPECTF-- | ||
PHPUnit %s by Sebastian Bergmann and contributors. | ||
|
||
Runtime: PHP %s | ||
|
||
##teamcity[testCount count='1' flowId='%s'] | ||
##teamcity[testSuiteStarted name='CLI Arguments' flowId='%d'] | ||
##teamcity[testSuiteStarted name='PHPUnit\TestFixture\DataProviderFilterTest' locationHint='php_qn://%sDataProviderFilterTest.php::\PHPUnit\TestFixture\DataProviderFilterTest' flowId='%d'] | ||
##teamcity[testSuiteStarted name='testFalse' locationHint='php_qn://%sDataProviderFilterTest.php::\PHPUnit\TestFixture\DataProviderFilterTest::testFalse' flowId='%d'] | ||
##teamcity[testStarted name='testFalse with data set "false test"' locationHint='php_qn://%sDataProviderFilterTest.php::\PHPUnit\TestFixture\DataProviderFilterTest::testFalse with data set "false test"' flowId='%d'] | ||
##teamcity[testFinished name='testFalse with data set "false test"' duration='%s' flowId='%d'] | ||
##teamcity[testSuiteFinished name='testFalse' flowId='%d'] | ||
##teamcity[testSuiteFinished name='PHPUnit\TestFixture\DataProviderFilterTest' flowId='%d'] | ||
##teamcity[testSuiteFinished name='CLI Arguments' flowId='%d'] | ||
Time: %s, Memory: %s | ||
|
||
OK (1 test, 1 assertion) |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.