Skip to content

Commit

Permalink
Deprecate --strict option
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jan 18, 2015
1 parent 1ec8d7d commit 7abe779
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/TextUI/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ protected function handleArguments(array $argv)
$this->arguments['disallowTestOutput'] = true;
$this->arguments['enforceTimeLimit'] = true;
$this->arguments['disallowTodoAnnotatedTests'] = true;
$this->arguments['deprecatedStrictModeOption'] = true;
}
break;

Expand Down Expand Up @@ -906,7 +907,6 @@ protected function showHelp()
--disallow-test-output Be strict about output during tests.
--enforce-time-limit Enforce time limit based on test size.
--disallow-todo-tests Disallow @todo-annotated tests.
--strict Run tests in strict mode (enables all of the above).
--process-isolation Run each test in a separate PHP process.
--no-globals-backup Do not backup and restore \$GLOBALS for each test.
Expand Down
12 changes: 12 additions & 0 deletions src/TextUI/TestRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ class_exists($arguments['printer'], false)) {
)
);
}

if (isset($arguments['deprecatedStrictModeOption'])) {
print "Deprecated option \"--strict\" used\n\n";
}

if (isset($arguments['deprecatedStrictModeSetting'])) {
print "Deprecated configuration setting \"strict\" used\n\n";
}
}

foreach ($arguments['listeners'] as $listener) {
Expand Down Expand Up @@ -564,6 +572,10 @@ protected function handleConfiguration(array &$arguments)

$phpunitConfiguration = $arguments['configuration']->getPHPUnitConfiguration();

if (isset($phpunitConfiguration['deprecatedStrictModeSetting'])) {
$arguments['deprecatedStrictModeSetting'] = true;
}

if (isset($phpunitConfiguration['backupGlobals']) &&
!isset($arguments['backupGlobals'])) {
$arguments['backupGlobals'] = $phpunitConfiguration['backupGlobals'];
Expand Down
11 changes: 6 additions & 5 deletions src/Util/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -731,11 +731,12 @@ public function getPHPUnitConfiguration()
(string) $root->getAttribute('strict'), false
);

$result['reportUselessTests'] = $flag;
$result['strictCoverage'] = $flag;
$result['disallowTestOutput'] = $flag;
$result['enforceTimeLimit'] = $flag;
$result['disallowTodoAnnotatedTests'] = $flag;
$result['reportUselessTests'] = $flag;
$result['strictCoverage'] = $flag;
$result['disallowTestOutput'] = $flag;
$result['enforceTimeLimit'] = $flag;
$result['disallowTodoAnnotatedTests'] = $flag;
$result['deprecatedStrictModeSetting'] = true;
}

if ($root->hasAttribute('verbose')) {
Expand Down
1 change: 0 additions & 1 deletion tests/TextUI/help.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ Test Execution Options:
--disallow-test-output Be strict about output during tests.
--enforce-time-limit Enforce time limit based on test size.
--disallow-todo-tests Disallow @todo-annotated tests.
--strict Run tests in strict mode (enables all of the above).

--process-isolation Run each test in a separate PHP process.
--no-globals-backup Do not backup and restore $GLOBALS for each test.
Expand Down
1 change: 0 additions & 1 deletion tests/TextUI/help2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ Test Execution Options:
--disallow-test-output Be strict about output during tests.
--enforce-time-limit Enforce time limit based on test size.
--disallow-todo-tests Disallow @todo-annotated tests.
--strict Run tests in strict mode (enables all of the above).

--process-isolation Run each test in a separate PHP process.
--no-globals-backup Do not backup and restore $GLOBALS for each test.
Expand Down
6 changes: 5 additions & 1 deletion tests/_files/configuration_xinclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60"
strict="false"
beStrictAboutTestsThatDoNotTestAnything="false"
beStrictAboutOutputDuringTests="false"
beStrictAboutTestSize="false"
beStrictAboutTodoAnnotatedTests="false"
checkForUnintentionallyCoveredCode="false"
verbose="false">
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="configuration.xml"
Expand Down

0 comments on commit 7abe779

Please sign in to comment.