Skip to content

Commit

Permalink
Consistently configure command-line options for PHPT end-to-end tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed May 3, 2021
1 parent 91dc96f commit 0856cf6
Show file tree
Hide file tree
Showing 173 changed files with 636 additions and 738 deletions.
4 changes: 2 additions & 2 deletions tests/end-to-end/assertion.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ if (ini_get('assert.exception') != 1) {
}
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = __DIR__ . '/../_files/AssertionExampleTest.php';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = __DIR__ . '/../_files/AssertionExampleTest.php';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
6 changes: 3 additions & 3 deletions tests/end-to-end/cli/columns-max.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
phpunit --columns=max ../../_files/BankAccountTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--columns=max';
$_SERVER['argv'][3] = __DIR__ . '/../../_files/BankAccountTest.php';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--columns=max';
$_SERVER['argv'][] = __DIR__ . '/../../_files/BankAccountTest.php';

require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
6 changes: 3 additions & 3 deletions tests/end-to-end/cli/columns.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
phpunit --columns=40 ../../_files/BankAccountTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--columns=40';
$_SERVER['argv'][3] = __DIR__ . '/../../_files/BankAccountTest.php';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--columns=40';
$_SERVER['argv'][] = __DIR__ . '/../../_files/BankAccountTest.php';

require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
4 changes: 2 additions & 2 deletions tests/end-to-end/cli/generate-configuration.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ phpunit --generate-configuration

--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--generate-configuration';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--generate-configuration';

require __DIR__ . '/../../bootstrap.php';
chdir(sys_get_temp_dir());
Expand Down
13 changes: 5 additions & 8 deletions tests/end-to-end/cli/mycommand.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
phpunit ../../_files/BankAccountTest.php
--FILE--
<?php declare(strict_types=1);
$arguments = [
'--no-configuration',
'--my-option=123',
'--my-other-option',
\realpath(__DIR__ . '/../../_files/BankAccountTest.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--my-option=123';
$_SERVER['argv'][] = '--my-other-option';
$_SERVER['argv'][] = \realpath(__DIR__ . '/../../_files/BankAccountTest.php');

require __DIR__ . '/../../bootstrap.php';

require __DIR__ . '/_files/MyCommand.php';

MyCommand::main();
--EXPECTF--
MyCommand::myHandler 123
Expand Down
10 changes: 4 additions & 6 deletions tests/end-to-end/cli/options-after-arguments.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
phpunit ../../_files/BankAccountTest.php --colors
--FILE--
<?php declare(strict_types=1);
$arguments = [
'--no-configuration',
\realpath(__DIR__ . '/../../_files/BankAccountTest.php'),
'--colors=always',
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = \realpath(__DIR__ . '/../../_files/BankAccountTest.php');
$_SERVER['argv'][] = '--colors=always';

require __DIR__ . '/../../bootstrap.php';

PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.
Expand Down
4 changes: 2 additions & 2 deletions tests/end-to-end/concrete-test-class.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
phpunit ../../_files/ConcreteTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = __DIR__ . '/../_files/ConcreteTest.php';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = __DIR__ . '/../_files/ConcreteTest.php';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
4 changes: 2 additions & 2 deletions tests/end-to-end/dataprovider-issue-2833.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
phpunit ../../_files/DataProviderIssue2833/
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = __DIR__ . '/../_files/DataProviderIssue2833/';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = __DIR__ . '/../_files/DataProviderIssue2833/';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
4 changes: 2 additions & 2 deletions tests/end-to-end/dataprovider-issue-2859.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
phpunit -c ../../_files/DataProviderIssue2859/phpunit.xml
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '-c';
$_SERVER['argv'][2] = __DIR__ . '/../_files/DataProviderIssue2859/phpunit.xml';
$_SERVER['argv'][] = '-c';
$_SERVER['argv'][] = __DIR__ . '/../_files/DataProviderIssue2859/phpunit.xml';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
6 changes: 3 additions & 3 deletions tests/end-to-end/dataprovider-issue-2922.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
phpunit --exclude-group=foo ../../_files/DataProviderIssue2922/
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--exclude-group=foo';
$_SERVER['argv'][3] = __DIR__ . '/../_files/DataProviderIssue2922/';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--exclude-group=foo';
$_SERVER['argv'][] = __DIR__ . '/../_files/DataProviderIssue2922/';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
10 changes: 5 additions & 5 deletions tests/end-to-end/dataprovider-log-xml-isolation.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
phpunit --process-isolation --log-junit php://stdout ../../_files/DataProviderTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--process-isolation';
$_SERVER['argv'][3] = '--log-junit';
$_SERVER['argv'][4] = 'php://stdout';
$_SERVER['argv'][5] = __DIR__ . '/../_files/DataProviderTest.php';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--process-isolation';
$_SERVER['argv'][] = '--log-junit';
$_SERVER['argv'][] = 'php://stdout';
$_SERVER['argv'][] = __DIR__ . '/../_files/DataProviderTest.php';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
8 changes: 4 additions & 4 deletions tests/end-to-end/dataprovider-log-xml.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
phpunit --log-junit php://stdout ../../_files/DataProviderTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--log-junit';
$_SERVER['argv'][3] = 'php://stdout';
$_SERVER['argv'][4] = __DIR__ . '/../_files/DataProviderTest.php';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--log-junit';
$_SERVER['argv'][] = 'php://stdout';
$_SERVER['argv'][] = __DIR__ . '/../_files/DataProviderTest.php';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
6 changes: 3 additions & 3 deletions tests/end-to-end/default-isolation.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
phpunit --process-isolation ../../_files/BankAccountTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--process-isolation';
$_SERVER['argv'][3] = __DIR__ . '/../_files/BankAccountTest.php';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--process-isolation';
$_SERVER['argv'][] = __DIR__ . '/../_files/BankAccountTest.php';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
4 changes: 2 additions & 2 deletions tests/end-to-end/default.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
phpunit ../../_files/BankAccountTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = __DIR__ . '/../_files/BankAccountTest.php';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = __DIR__ . '/../_files/BankAccountTest.php';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
10 changes: 5 additions & 5 deletions tests/end-to-end/defaulttestsuite-using-testsuite.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
phpunit --testdox --configuration=__DIR__.'/../_files/configuration.defaulttestsuite.xml' --testsuite 'First'
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--testdox';
$_SERVER['argv'][2] = '--configuration';
$_SERVER['argv'][3] = __DIR__.'/../_files/configuration.defaulttestsuite.xml';
$_SERVER['argv'][4] = '--testsuite';
$_SERVER['argv'][5] = 'First';
$_SERVER['argv'][] = '--testdox';
$_SERVER['argv'][] = '--configuration';
$_SERVER['argv'][] = __DIR__.'/../_files/configuration.defaulttestsuite.xml';
$_SERVER['argv'][] = '--testsuite';
$_SERVER['argv'][] = 'First';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
6 changes: 3 additions & 3 deletions tests/end-to-end/defaulttestsuite.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
phpunit --testdox --configuration=__DIR__.'/../_files/configuration.defaulttestsuite.xml'
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--testdox';
$_SERVER['argv'][2] = '--configuration';
$_SERVER['argv'][3] = __DIR__.'/../_files/configuration.defaulttestsuite.xml';
$_SERVER['argv'][] = '--testdox';
$_SERVER['argv'][] = '--configuration';
$_SERVER['argv'][] = __DIR__.'/../_files/configuration.defaulttestsuite.xml';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
8 changes: 4 additions & 4 deletions tests/end-to-end/dump-xdebug-filter.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ if (!extension_loaded('xdebug')) {
}
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '-c';
$_SERVER['argv'][2] = __DIR__ . '/../_files/configuration_whitelist.xml';
$_SERVER['argv'][3] = '--dump-xdebug-filter';
$_SERVER['argv'][4] = 'php://stderr';
$_SERVER['argv'][] = '-c';
$_SERVER['argv'][] = __DIR__ . '/../_files/configuration_whitelist.xml';
$_SERVER['argv'][] = '--dump-xdebug-filter';
$_SERVER['argv'][] = 'php://stderr';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
4 changes: 2 additions & 2 deletions tests/end-to-end/empty-testcase.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
phpunit ../../_files/EmptyTestCaseTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = __DIR__ . '/../_files/EmptyTestCaseTest.php';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = __DIR__ . '/../_files/EmptyTestCaseTest.php';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
4 changes: 2 additions & 2 deletions tests/end-to-end/exception-stack.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
phpunit ../../_files/ExceptionStackTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = __DIR__ . '/../_files/ExceptionStackTest.php';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = __DIR__ . '/../_files/ExceptionStackTest.php';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
10 changes: 5 additions & 5 deletions tests/end-to-end/exclude-group-isolation.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
phpunit --process-isolation --exclude-group balanceIsInitiallyZero ../../_files/BankAccountTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--process-isolation';
$_SERVER['argv'][3] = '--exclude-group';
$_SERVER['argv'][4] = 'balanceIsInitiallyZero';
$_SERVER['argv'][5] = __DIR__ . '/../_files/BankAccountTest.php';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--process-isolation';
$_SERVER['argv'][] = '--exclude-group';
$_SERVER['argv'][] = 'balanceIsInitiallyZero';
$_SERVER['argv'][] = __DIR__ . '/../_files/BankAccountTest.php';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
8 changes: 4 additions & 4 deletions tests/end-to-end/exclude-group.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
phpunit --exclude-group balanceIsInitiallyZero ../../_files/BankAccountTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--exclude-group';
$_SERVER['argv'][3] = 'balanceIsInitiallyZero';
$_SERVER['argv'][4] = __DIR__ . '/../_files/BankAccountTest.php';
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--exclude-group';
$_SERVER['argv'][] = 'balanceIsInitiallyZero';
$_SERVER['argv'][] = __DIR__ . '/../_files/BankAccountTest.php';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
16 changes: 7 additions & 9 deletions tests/end-to-end/execution-order/cache-result.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ phpunit --order-by=no-depends,reverse --cache-result --cache-result-file ./tests
<?php declare(strict_types=1);
$target = tempnam(sys_get_temp_dir(), __FILE__);

$arguments = [
'--no-configuration',
'--ignore-dependencies', // keep coverage for legacy CLI option
'--order-by=reverse',
'--cache-result',
'--cache-result-file=' . $target,
realpath(__DIR__ . '/../execution-order/_files/MultiDependencyTest.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--ignore-dependencies'; // keep coverage for legacy CLI option
$_SERVER['argv'][] = '--order-by=reverse';
$_SERVER['argv'][] = '--cache-result';
$_SERVER['argv'][] = '--cache-result-file=' . $target;
$_SERVER['argv'][] = realpath(__DIR__ . '/../execution-order/_files/MultiDependencyTest.php');

require __DIR__ . '/../../bootstrap.php';

PHPUnit\TextUI\Command::main(false);

print file_get_contents($target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ phpunit --order-by=defects ./tests/_files/MultiDependencyTest.php
$tmpResultCache = \tempnam(sys_get_temp_dir(), __FILE__);
\file_put_contents($tmpResultCache, file_get_contents(__DIR__ . '/_files/MultiDependencyTest_result_cache.txt'));

$arguments = [
'--no-configuration',
'--debug',
'--order-by=defects',
'--cache-result',
'--cache-result-file=' . $tmpResultCache,
\realpath(__DIR__ . '/_files/MultiDependencyTest.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--debug';
$_SERVER['argv'][] = '--order-by=defects';
$_SERVER['argv'][] = '--cache-result';
$_SERVER['argv'][] = '--cache-result-file=' . $tmpResultCache;
$_SERVER['argv'][] = \realpath(__DIR__ . '/_files/MultiDependencyTest.php');

require __DIR__ . '/../../bootstrap.php';

PHPUnit\TextUI\Command::main();

\unlink($tmpResultCache);
Expand Down
10 changes: 4 additions & 6 deletions tests/end-to-end/execution-order/dependencies-clone.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
phpunit --verbose ../../_files/ClonedDependencyTest.php
--FILE--
<?php declare(strict_types=1);
$arguments = [
'--no-configuration',
'--verbose',
\realpath(__DIR__ . '/_files/ClonedDependencyTest.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--verbose';
$_SERVER['argv'][] = \realpath(__DIR__ . '/_files/ClonedDependencyTest.php');

require __DIR__ . '/../../bootstrap.php';

PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.
Expand Down
12 changes: 5 additions & 7 deletions tests/end-to-end/execution-order/dependencies-isolation.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
phpunit --process-isolation --verbose ../../_files/DependencyTestSuite.php
--FILE--
<?php declare(strict_types=1);
$arguments = [
'--no-configuration',
'--process-isolation',
'--verbose',
\realpath(__DIR__ . '/_files/DependencyTestSuite.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--process-isolation';
$_SERVER['argv'][] = '--verbose';
$_SERVER['argv'][] = \realpath(__DIR__ . '/_files/DependencyTestSuite.php');

require __DIR__ . '/../../bootstrap.php';

PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
phpunit --process-isolation _files/StackTest.php
--FILE--
<?php declare(strict_types=1);
$arguments = [
'--no-configuration',
'--process-isolation',
\realpath(__DIR__ . '/_files/StackTest.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);
$_SERVER['argv'][] = '--no-configuration';
$_SERVER['argv'][] = '--process-isolation';
$_SERVER['argv'][] = \realpath(__DIR__ . '/_files/StackTest.php');

require __DIR__ . '/../../bootstrap.php';

PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.
Expand Down
Loading

0 comments on commit 0856cf6

Please sign in to comment.