Skip to content

Commit

Permalink
Closes #2190
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Aug 21, 2016
1 parent feda2df commit 3320e0c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
3 changes: 3 additions & 0 deletions ChangeLog-6.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ All notable changes of the PHPUnit 6.0 release series are documented in this fil
### Added

* Added the `--dont-report-useless-tests` commandline option
* Added the `--globals-backup` commandline option

### Changed

* PHPUnit is now strict about useless tests by default
* Global and super-global variables are no longer backed up before and restored after each test by default
* `PHPUnit\Framework\Assert::fail()` now increments the assertion counter
* `setUpBeforeClass()` is now invoked after all methods annotated with `@beforeClass`
* `setUp()` is now invoked after all methods annotated with `@before`
Expand All @@ -28,6 +30,7 @@ All notable changes of the PHPUnit 6.0 release series are documented in this fil
* Removed the `checkForUnintentionallyCoveredCode` configuration setting (deprecated in PHPUnit 5.2)
* Removed the `--self-update` and `--self-upgrade` commandline options
* Removed the `--report-useless-tests` commandline option
* Removed the `--no-globals-backup` commandline option
* PHPUnit is no longer supported on PHP 5.6

[6.0.0]: https://github.com/sebastianbergmann/phpunit/compare/5.7...6.0.0
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="phpunit.xsd"
bootstrap="tests/bootstrap.php"
backupGlobals="false"
verbose="true">
<testsuites>
<testsuite name="small">
Expand Down
8 changes: 4 additions & 4 deletions src/TextUI/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class PHPUnit_TextUI_Command
*/
protected $longOptions = [
'atleast-version=' => null,
'backup-globals' => null,
'bootstrap=' => null,
'colors==' => null,
'columns=' => null,
Expand Down Expand Up @@ -66,7 +67,6 @@ class PHPUnit_TextUI_Command
'log-teamcity=' => null,
'no-configuration' => null,
'no-coverage' => null,
'no-globals-backup' => null,
'printer=' => null,
'process-isolation' => null,
'repeat=' => null,
Expand Down Expand Up @@ -547,8 +547,8 @@ protected function handleArguments(array $argv)
$this->arguments['noCoverage'] = true;
break;

case '--no-globals-backup':
$this->arguments['backupGlobals'] = false;
case '--globals-backup':
$this->arguments['backupGlobals'] = true;
break;

case '--static-backup':
Expand Down Expand Up @@ -967,7 +967,7 @@ protected function showHelp()
--disallow-todo-tests Disallow @todo-annotated tests.
--process-isolation Run each test in a separate PHP process.
--no-globals-backup Do not backup and restore \$GLOBALS for each test.
--globals-backup Backup and restore \$GLOBALS for each test.
--static-backup Backup and restore static attributes for each test.
--colors=<flag> Use colors in output ("never", "auto" or "always").
Expand Down
4 changes: 2 additions & 2 deletions src/TextUI/TestRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ public function doRun(PHPUnit_Framework_Test $suite, array $arguments = [], $exi
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $arguments['bootstrap'];
}

if ($arguments['backupGlobals'] === false) {
$suite->setBackupGlobals(false);
if ($arguments['backupGlobals'] === true) {
$suite->setBackupGlobals(true);
}

if ($arguments['backupStaticAttributes'] === true) {
Expand Down
4 changes: 2 additions & 2 deletions src/Util/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* <code>
* <?xml version="1.0" encoding="utf-8" ?>
*
* <phpunit backupGlobals="true"
* <phpunit backupGlobals="false"
* backupStaticAttributes="false"
* bootstrap="/path/to/bootstrap.php"
* cacheTokens="false"
Expand Down Expand Up @@ -592,7 +592,7 @@ public function getPHPUnitConfiguration()
if ($root->hasAttribute('backupGlobals')) {
$result['backupGlobals'] = $this->getBoolean(
(string) $root->getAttribute('backupGlobals'),
true
false
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/TextUI/help.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Test Execution Options:
--disallow-todo-tests Disallow @todo-annotated tests.

--process-isolation Run each test in a separate PHP process.
--no-globals-backup Do not backup and restore $GLOBALS for each test.
--globals-backup Backup and restore $GLOBALS for each test.
--static-backup Backup and restore static attributes for each test.

--colors=<flag> Use colors in output ("never", "auto" or "always").
Expand Down
2 changes: 1 addition & 1 deletion tests/TextUI/help2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Test Execution Options:
--disallow-todo-tests Disallow @todo-annotated tests.

--process-isolation Run each test in a separate PHP process.
--no-globals-backup Do not backup and restore $GLOBALS for each test.
--globals-backup Backup and restore $GLOBALS for each test.
--static-backup Backup and restore static attributes for each test.

--colors=<flag> Use colors in output ("never", "auto" or "always").
Expand Down

0 comments on commit 3320e0c

Please sign in to comment.