Skip to content

Commit

Permalink
Move logger and printer tests together; nicer ARGV handling
Browse files Browse the repository at this point in the history
  • Loading branch information
epdenouden authored and sebastianbergmann committed Dec 24, 2018
1 parent 7f73fea commit 0395f41
Show file tree
Hide file tree
Showing 46 changed files with 300 additions and 243 deletions.
17 changes: 10 additions & 7 deletions tests/end-to-end/cache-result.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ phpunit --order-by=no-depends,reverse --cache-result --cache-result-file MultiDe
<?php
$target = tempnam(sys_get_temp_dir(), __FILE__);

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

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main(false);
Expand Down
7 changes: 2 additions & 5 deletions tests/end-to-end/cli/help.phpt
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
--TEST--
phpunit
--ARGS--
--no-configuration
--FILE--
<?php
$arguments = [
'--no-configuration',
];
array_splice($_SERVER['argv'], 1, count($arguments), $arguments);

require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF_EXTERNAL--
Expand Down
8 changes: 2 additions & 6 deletions tests/end-to-end/cli/help2.phpt
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
--TEST--
phpunit --help
--ARGS--
--no-configuration --help
--FILE--
<?php
$arguments = [
'--no-configuration',
'--help'
];
array_splice($_SERVER['argv'], 1, count($arguments), $arguments);

require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF_EXTERNAL--
Expand Down
19 changes: 0 additions & 19 deletions tests/end-to-end/depends-as-parameter-with-isolation.phpt

This file was deleted.

18 changes: 0 additions & 18 deletions tests/end-to-end/depends-as-parameter.phpt

This file was deleted.

19 changes: 0 additions & 19 deletions tests/end-to-end/depends-multiple-parameter-with-isolation.phpt

This file was deleted.

19 changes: 0 additions & 19 deletions tests/end-to-end/depends-multiple-parameters.phpt

This file was deleted.

2 changes: 1 addition & 1 deletion tests/end-to-end/execution-order-options-via-config.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ $_SERVER['argv'][1] = '--debug';
$_SERVER['argv'][2] = '-c';
$_SERVER['argv'][3] = __DIR__ . '/../_files/configuration_execution_order_options.xml';
$_SERVER['argv'][4] = 'MultiDependencyTest';
$_SERVER['argv'][5] = __DIR__ . '/../_files/MultiDependencyTest.php';
$_SERVER['argv'][5] = __DIR__ . '/loggers/_files/MultiDependencyTest.php';

require __DIR__ . '/../bootstrap.php';
PHPUnit\TextUI\Command::main();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,37 @@ Runtime: %s
│
│ Failed asserting that false is true.
│
│ %stests%e_files%eStatusTest.php:24
│ %stests%eend-to-end%eloggers%e_files%eStatusTest.php:24
│

✘ Error  %f ms
│
│ RuntimeException:
│
│ %stests%e_files%eStatusTest.php:29
│ %stests%eend-to-end%eloggers%e_files%eStatusTest.php:29
│

∅ Incomplete  %f ms
│
│ %stests%e_files%eStatusTest.php:34
│ %stests%eend-to-end%eloggers%e_files%eStatusTest.php:34
│

→ Skipped  %f ms
│
│ %stests%e_files%eStatusTest.php:39
│ %stests%eend-to-end%eloggers%e_files%eStatusTest.php:39
│

☢ Risky  %f ms
│
│ This test did not perform any assertions%w
│%w
│ %stests%e_files%eStatusTest.php:42
│
│ %stests%eend-to-end%eloggers%e_files%eStatusTest.php:42%w
│%w
│

✘ Warning  %f ms
│
│ %stests%e_files%eStatusTest.php:48
│ %stests%eend-to-end%eloggers%e_files%eStatusTest.php:48
│

Time: %s, Memory: %s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@
phpunit --order-by=defects MultiDependencyTest ./tests/_files/MultiDependencyTest.php
--FILE--
<?php
$tmpResultCache = tempnam(sys_get_temp_dir(), __FILE__);
file_put_contents($tmpResultCache, file_get_contents(__DIR__ . '/../_files/MultiDependencyTest_result_cache.txt'));
$tmpResultCache = \tempnam(sys_get_temp_dir(), __FILE__);
\file_put_contents($tmpResultCache, file_get_contents(__DIR__ . '/_files/MultiDependencyTest_result_cache.txt'));

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

require __DIR__ . '/../bootstrap.php';
require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();

unlink($tmpResultCache);
\unlink($tmpResultCache);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
phpunit --verbose ClonedDependencyTest ../../_files/ClonedDependencyTest.php
--FILE--
<?php
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--verbose';
$_SERVER['argv'][3] = 'ClonedDependencyTest';
$_SERVER['argv'][4] = __DIR__ . '/../_files/ClonedDependencyTest.php';
$arguments = [
'--no-configuration',
'--verbose',
'ClonedDependencyTest',
\realpath(__DIR__ . '/_files/ClonedDependencyTest.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
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
phpunit --process-isolation --verbose DependencyTestSuite ../../_files/DependencyTestSuite.php
--FILE--
<?php
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--process-isolation';
$_SERVER['argv'][3] = '--verbose';
$_SERVER['argv'][4] = 'DependencyTestSuite';
$_SERVER['argv'][5] = __DIR__ . '/../_files/DependencyTestSuite.php';

require __DIR__ . '/../bootstrap.php';
$arguments = [
'--no-configuration',
'--process-isolation',
'--verbose',
'DependencyTestSuite',
\realpath(__DIR__ . '/_files/DependencyTestSuite.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);

require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.
Expand Down
22 changes: 22 additions & 0 deletions tests/end-to-end/loggers/depends-as-parameter-with-isolation.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
phpunit --process-isolation StackTest _files/StackTest.php
--FILE--
<?php
$arguments = [
'--no-configuration',
'--process-isolation',
'StackTest',
\realpath(__DIR__ . '/_files/StackTest.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);

require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

.. 2 / 2 (100%)

Time: %s, Memory: %s

OK (2 tests, 5 assertions)
21 changes: 21 additions & 0 deletions tests/end-to-end/loggers/depends-as-parameter.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
phpunit StackTest _files/StackTest.php
--FILE--
<?php
$arguments = [
'--no-configuration',
'StackTest',
\realpath(__DIR__ . '/_files/StackTest.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);

require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

.. 2 / 2 (100%)

Time: %s, Memory: %s

OK (2 tests, 5 assertions)
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
phpunit --process-isolation MultiDependencyTest _files/MultiDependencyTest.php
--FILE--
<?php
$arguments = [
'--no-configuration',
'--process-isolation',
'MultiDependencyTest',
\realpath(__DIR__ . '/_files/MultiDependencyTest.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);

require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

..... 5 / 5 (100%)

Time: %s, Memory: %s

OK (5 tests, 6 assertions)
22 changes: 22 additions & 0 deletions tests/end-to-end/loggers/depends-multiple-parameters.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
phpunit MultiDependencyTest _files/MultiDependencyTest.php
--FILE--
<?php
$arguments = [
'--no-configuration',
'MultiDependencyTest',
\realpath(__DIR__ . '/_files/MultiDependencyTest.php'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);

require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
?>
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

..... 5 / 5 (100%)

Time: %s, Memory: %s

OK (5 tests, 6 assertions)
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
phpunit --log-junit php://stdout ../end-to-end/phpt-stderr.phpt
--FILE--
<?php
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--log-junit';
$_SERVER['argv'][3] = 'php://stdout';
$_SERVER['argv'][4] = \realpath(__DIR__ . '/../end-to-end/phpt-stderr.phpt');
$arguments = [
'--no-configuration',
'--log-junit',
'php://stdout',
\realpath(__DIR__ . '/../phpt-stderr.phpt'),
];
\array_splice($_SERVER['argv'], 1, count($arguments), $arguments);

require __DIR__ . '/../bootstrap.php';
require __DIR__ . '/../../bootstrap.php';
PHPUnit\TextUI\Command::main();
?>
--EXPECTF--
Expand Down
Loading

0 comments on commit 0395f41

Please sign in to comment.