Skip to content

Commit

Permalink
Merge branch '6.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 27, 2017
2 parents a19b93d + 0d4a394 commit c728a76
Show file tree
Hide file tree
Showing 3 changed files with 241 additions and 228 deletions.
3 changes: 3 additions & 0 deletions src/Util/Configuration.php
Expand Up @@ -184,6 +184,9 @@ private function __construct(string $filename)
$this->xpath = new DOMXPath($this->document);
}

/**
* @codeCoverageIgnore
*/
private function __clone()
{
}
Expand Down
291 changes: 148 additions & 143 deletions tests/Util/ConfigurationTest.php
Expand Up @@ -75,46 +75,46 @@ public function testFilterConfigurationIsReadCorrectly(): void
{
$this->assertEquals(
[
'whitelist' =>
[
'addUncoveredFilesFromWhitelist' => true,
'processUncoveredFilesFromWhitelist' => false,
'include' =>
[
'directory' =>
[
0 =>
[
'path' => '/path/to/files',
'prefix' => '',
'suffix' => '.php',
'group' => 'DEFAULT'
],
],
'file' =>
[
0 => '/path/to/file',
1 => '/path/to/file',
],
],
'exclude' =>
[
'directory' =>
[
0 =>
[
'path' => '/path/to/files',
'prefix' => '',
'suffix' => '.php',
'group' => 'DEFAULT'
],
],
'file' =>
[
0 => '/path/to/file',
],
],
],
'whitelist' =>
[
'addUncoveredFilesFromWhitelist' => true,
'processUncoveredFilesFromWhitelist' => false,
'include' =>
[
'directory' =>
[
0 =>
[
'path' => '/path/to/files',
'prefix' => '',
'suffix' => '.php',
'group' => 'DEFAULT'
],
],
'file' =>
[
0 => '/path/to/file',
1 => '/path/to/file',
],
],
'exclude' =>
[
'directory' =>
[
0 =>
[
'path' => '/path/to/files',
'prefix' => '',
'suffix' => '.php',
'group' => 'DEFAULT'
],
],
'file' =>
[
0 => '/path/to/file',
],
],
],
],
$this->configuration->getFilterConfiguration()
);
Expand All @@ -124,14 +124,14 @@ public function testGroupConfigurationIsReadCorrectly(): void
{
$this->assertEquals(
[
'include' =>
[
0 => 'name',
],
'exclude' =>
[
0 => 'name',
],
'include' =>
[
0 => 'name',
],
'exclude' =>
[
0 => 'name',
],
],
$this->configuration->getGroupConfiguration()
);
Expand Down Expand Up @@ -163,38 +163,38 @@ public function testListenerConfigurationIsReadCorrectly(): void

$this->assertEquals(
[
0 =>
[
'class' => 'MyListener',
'file' => '/optional/path/to/MyListener.php',
'arguments' =>
[
0 =>
[
'class' => 'MyListener',
'file' => '/optional/path/to/MyListener.php',
'arguments' =>
[
0 =>
[
0 => 'Sebastian',
],
1 => 22,
2 => 'April',
3 => 19.78,
4 => null,
5 => new \stdClass,
6 => \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'MyTestFile.php',
7 => \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'MyRelativePath',
],
],
[
0 => 'Sebastian',
'class' => 'IncludePathListener',
'file' => __FILE__,
'arguments' => []
],
[
'class' => 'CompactArgumentsListener',
'file' => '/CompactArgumentsListener.php',
'arguments' =>
[
0 => 42
],
],
1 => 22,
2 => 'April',
3 => 19.78,
4 => null,
5 => new \stdClass,
6 => \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'MyTestFile.php',
7 => \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'MyRelativePath',
],
],
[
'class' => 'IncludePathListener',
'file' => __FILE__,
'arguments' => []
],
[
'class' => 'CompactArgumentsListener',
'file' => '/CompactArgumentsListener.php',
'arguments' =>
[
0 => 42
],
],
],
$this->configuration->getListenerConfiguration()
);
Expand All @@ -206,17 +206,22 @@ public function testLoggingConfigurationIsReadCorrectly(): void
{
$this->assertEquals(
[
'lowUpperBound' => '50',
'highLowerBound' => '90',
'coverage-html' => '/tmp/report',
'coverage-clover' => '/tmp/clover.xml',
'json' => '/tmp/logfile.json',
'plain' => '/tmp/logfile.txt',
'tap' => '/tmp/logfile.tap',
'junit' => '/tmp/logfile.xml',
'testdox-html' => '/tmp/testdox.html',
'testdox-text' => '/tmp/testdox.txt',
'testdox-xml' => '/tmp/testdox.xml'
'lowUpperBound' => '50',
'highLowerBound' => '90',
'coverage-html' => '/tmp/report',
'coverage-clover' => '/tmp/clover.xml',
'coverage-crap4j' => '/tmp/crap4j.xml',
'crap4jThreshold' => 50,
'coverage-text' => '/tmp/coverage.txt',
'coverageTextShowUncoveredFiles' => true,
'coverageTextShowOnlySummary' => true,
'json' => '/tmp/logfile.json',
'plain' => '/tmp/logfile.txt',
'tap' => '/tmp/logfile.tap',
'junit' => '/tmp/logfile.xml',
'testdox-html' => '/tmp/testdox.html',
'testdox-text' => '/tmp/testdox.txt',
'testdox-xml' => '/tmp/testdox.xml'
],
$this->configuration->getLoggingConfiguration()
);
Expand All @@ -226,21 +231,21 @@ public function testPHPConfigurationIsReadCorrectly(): void
{
$this->assertEquals(
[
'include_path' =>
[
\dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . '.',
'/path/to/lib'
],
'ini' => ['foo' => ['value' => 'bar']],
'const' => ['FOO' => ['value' => false], 'BAR' => ['value' => true]],
'var' => ['foo' => ['value' => false]],
'env' => ['foo' => ['value' => true], 'bar' => ['value' => 'true', 'verbatim' => true], 'foo_force' => ['value' => 'forced', 'force' => true]],
'post' => ['foo' => ['value' => 'bar']],
'get' => ['foo' => ['value' => 'bar']],
'cookie' => ['foo' => ['value' => 'bar']],
'server' => ['foo' => ['value' => 'bar']],
'files' => ['foo' => ['value' => 'bar']],
'request'=> ['foo' => ['value' => 'bar']],
'include_path' =>
[
\dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . '.',
'/path/to/lib'
],
'ini' => ['foo' => ['value' => 'bar']],
'const' => ['FOO' => ['value' => false], 'BAR' => ['value' => true]],
'var' => ['foo' => ['value' => false]],
'env' => ['foo' => ['value' => true], 'bar' => ['value' => 'true', 'verbatim' => true], 'foo_force' => ['value' => 'forced', 'force' => true]],
'post' => ['foo' => ['value' => 'bar']],
'get' => ['foo' => ['value' => 'bar']],
'cookie' => ['foo' => ['value' => 'bar']],
'server' => ['foo' => ['value' => 'bar']],
'files' => ['foo' => ['value' => 'bar']],
'request'=> ['foo' => ['value' => 'bar']],
],
$this->configuration->getPHPConfiguration()
);
Expand All @@ -255,11 +260,11 @@ public function testPHPConfigurationIsHandledCorrectly(): void

$path = \dirname(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . '.' . PATH_SEPARATOR . '/path/to/lib';
$this->assertStringStartsWith($path, \ini_get('include_path'));
$this->assertEquals(false, \FOO);
$this->assertEquals(true, \BAR);
$this->assertEquals(false, $GLOBALS['foo']);
$this->assertEquals(true, $_ENV['foo']);
$this->assertEquals(true, \getenv('foo'));
$this->assertFalse(\FOO);
$this->assertTrue(\BAR);
$this->assertFalse($GLOBALS['foo']);
$this->assertTrue($_ENV['foo']);
$this->assertEquals(1, \getenv('foo'));
$this->assertEquals('bar', $_POST['foo']);
$this->assertEquals('bar', $_GET['foo']);
$this->assertEquals('bar', $_COOKIE['foo']);
Expand All @@ -278,8 +283,8 @@ public function testHandlePHPConfigurationDoesNotOverwrittenExistingEnvArrayVari
$_ENV['foo'] = false;
$this->configuration->handlePHPConfiguration();

$this->assertEquals(false, $_ENV['foo']);
$this->assertEquals(true, \getenv('foo'));
$this->assertFalse($_ENV['foo']);
$this->assertEquals(1, \getenv('foo'));
}

/**
Expand All @@ -306,7 +311,7 @@ public function testHandlePHPConfigurationDoesNotOverriteVariablesFromPutEnv():
\putenv('foo=putenv');
$this->configuration->handlePHPConfiguration();

$this->assertEquals(true, $_ENV['foo']);
$this->assertTrue($_ENV['foo']);
$this->assertEquals('putenv', \getenv('foo'));
}

Expand All @@ -328,38 +333,38 @@ public function testPHPUnitConfigurationIsReadCorrectly(): void
{
$this->assertEquals(
[
'backupGlobals' => true,
'backupStaticAttributes' => false,
'beStrictAboutChangesToGlobalState' => false,
'bootstrap' => '/path/to/bootstrap.php',
'cacheTokens' => false,
'columns' => 80,
'colors' => 'never',
'stderr' => false,
'convertDeprecationsToExceptions' => true,
'convertErrorsToExceptions' => true,
'convertNoticesToExceptions' => true,
'convertWarningsToExceptions' => true,
'forceCoversAnnotation' => false,
'stopOnFailure' => false,
'stopOnWarning' => false,
'reportUselessTests' => false,
'strictCoverage' => false,
'disallowTestOutput' => false,
'enforceTimeLimit' => false,
'extensionsDirectory' => '/tmp',
'printerClass' => 'PHPUnit\TextUI\ResultPrinter',
'testSuiteLoaderClass' => 'PHPUnit\Runner\StandardTestSuiteLoader',
'defaultTestSuite' => 'My Test Suite',
'verbose' => false,
'timeoutForSmallTests' => 1,
'timeoutForMediumTests' => 10,
'timeoutForLargeTests' => 60,
'beStrictAboutResourceUsageDuringSmallTests' => false,
'disallowTodoAnnotatedTests' => false,
'failOnWarning' => false,
'failOnRisky' => false,
'ignoreDeprecatedCodeUnitsFromCodeCoverage' => false
'backupGlobals' => true,
'backupStaticAttributes' => false,
'beStrictAboutChangesToGlobalState' => false,
'bootstrap' => '/path/to/bootstrap.php',
'cacheTokens' => false,
'columns' => 80,
'colors' => 'never',
'stderr' => false,
'convertDeprecationsToExceptions' => true,
'convertErrorsToExceptions' => true,
'convertNoticesToExceptions' => true,
'convertWarningsToExceptions' => true,
'forceCoversAnnotation' => false,
'stopOnFailure' => false,
'stopOnWarning' => false,
'reportUselessTests' => false,
'strictCoverage' => false,
'disallowTestOutput' => false,
'enforceTimeLimit' => false,
'extensionsDirectory' => '/tmp',
'printerClass' => 'PHPUnit\TextUI\ResultPrinter',
'testSuiteLoaderClass' => 'PHPUnit\Runner\StandardTestSuiteLoader',
'defaultTestSuite' => 'My Test Suite',
'verbose' => false,
'timeoutForSmallTests' => 1,
'timeoutForMediumTests' => 10,
'timeoutForLargeTests' => 60,
'beStrictAboutResourceUsageDuringSmallTests' => false,
'disallowTodoAnnotatedTests' => false,
'failOnWarning' => false,
'failOnRisky' => false,
'ignoreDeprecatedCodeUnitsFromCodeCoverage' => false
],
$this->configuration->getPHPUnitConfiguration()
);
Expand Down

0 comments on commit c728a76

Please sign in to comment.