Skip to content

Commit

Permalink
Move some more CLI tests together
Browse files Browse the repository at this point in the history
  • Loading branch information
epdenouden authored and sebastianbergmann committed Dec 24, 2018
1 parent 8a3cea5 commit ca8441f
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 47 deletions.
2 changes: 1 addition & 1 deletion tests/_files/configuration.one-file-suite.xml
@@ -1,7 +1,7 @@
<phpunit>
<testsuites>
<testsuite name="One File Suite">
<file>../../tests/end-to-end/debug.phpt</file>
<file>../../tests/end-to-end/loggers/debug.phpt</file>
</testsuite>
</testsuites>
</phpunit>
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/end-to-end/cli/help.phpt
Expand Up @@ -7,4 +7,4 @@ phpunit
require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF_EXTERNAL--
output-cli-usage.txt
_files/output-cli-usage.txt
2 changes: 1 addition & 1 deletion tests/end-to-end/cli/help2.phpt
Expand Up @@ -7,4 +7,4 @@ phpunit --help
require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF_EXTERNAL--
output-cli-usage.txt
_files/output-cli-usage.txt
27 changes: 27 additions & 0 deletions tests/end-to-end/cli/mycommand.phpt
@@ -0,0 +1,27 @@
--TEST--
phpunit BankAccountTest ../../_files/BankAccountTest.php
--FILE--
<?php
$arguments = [
'--no-configuration',
'--my-option=123',
'--my-other-option',
'BankAccountTest',
\realpath(__DIR__ . '/../../_files/BankAccountTest.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);

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

require __DIR__ . '/_files/MyCommand.php';
MyCommand::main();
?>
--EXPECTF--
MyCommand::myHandler 123
PHPUnit %s by Sebastian Bergmann and contributors.

... 3 / 3 (100%)

Time: %s, Memory: %s

OK (3 tests, 3 assertions)
Expand Up @@ -2,11 +2,14 @@
phpunit BankAccountTest ../../_files/BankAccountTest.php --colors
--FILE--
<?php
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = __DIR__ . '/../_files/BankAccountTest.php';
$_SERVER['argv'][3] = '--colors=always';
$arguments = [
'--no-configuration',
\realpath(__DIR__ . '/../../_files/BankAccountTest.php'),
'--colors=always',
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);

require __DIR__ . '/../bootstrap.php';
require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.
Expand Down
Expand Up @@ -2,13 +2,16 @@
phpunit --repeat 3 BankAccountTest ../../_files/BankAccountTest.php
--FILE--
<?php
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--repeat';
$_SERVER['argv'][3] = '3';
$_SERVER['argv'][4] = 'BankAccountTest';
$_SERVER['argv'][5] = __DIR__ . '/../_files/BankAccountTest.php';
$arguments = [
'--no-configuration',
'--repeat',
'3',
'BankAccountTest',
\realpath(__DIR__ . '/../../_files/BankAccountTest.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);

require __DIR__ . '/../bootstrap.php';
require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -2,12 +2,15 @@
phpunit --debug BankAccountTest ../../_files/BankAccountTest.php
--FILE--
<?php
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--debug';
$_SERVER['argv'][3] = 'BankAccountTest';
$_SERVER['argv'][4] = __DIR__ . '/../_files/BankAccountTest.php';
$arguments = [
'--no-configuration',
'--debug',
'BankAccountTest',
\realpath(__DIR__ . '/../../_files/BankAccountTest.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);

require __DIR__ . '/../bootstrap.php';
require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.
Expand Down
Expand Up @@ -2,12 +2,15 @@
phpunit --configuration _files/hooks.xml HookTest _files/HookTest.php
--FILE--
<?php
$_SERVER['argv'][1] = '--configuration';
$_SERVER['argv'][2] = __DIR__ . '/_files/hooks.xml';
$_SERVER['argv'][3] = 'HookTest';
$_SERVER['argv'][4] = __DIR__ . '/_files/HookTest.php';
$arguments = [
'--configuration',
\realpath(__DIR__ . '/_files/hooks.xml'),
'HookTest',
\realpath(__DIR__ . '/_files/HookTest.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);

require __DIR__ . '/../bootstrap.php';
require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.
Expand Down
24 changes: 0 additions & 24 deletions tests/end-to-end/mycommand.phpt

This file was deleted.

0 comments on commit ca8441f

Please sign in to comment.