Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sebastianbergmann/phpunit
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4.8.10
Choose a base ref
...
head repository: sebastianbergmann/phpunit
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4.8.11
Choose a head ref
  • 11 commits
  • 12 files changed
  • 3 contributors

Commits on Oct 2, 2015

  1. This is a fix for issue #1013 which causes phpunit to loose any php v…

    …alue configured in configuration xml to be lost when test is ran in isolation and preserve globals is disabled.
    Iman Ghatami authored and sebastianbergmann committed Oct 2, 2015
    Copy the full SHA
    d309486 View commit details
  2. #1013 some minor refactoring and coding style fixes

    Iman Ghatami authored and sebastianbergmann committed Oct 2, 2015
    Copy the full SHA
    9955761 View commit details
  3. Update ChangeLog

    sebastianbergmann committed Oct 2, 2015
    Copy the full SHA
    e529cb7 View commit details
  4. Fix CS/WS issue

    sebastianbergmann committed Oct 2, 2015
    Copy the full SHA
    ff2b20a View commit details
  5. Closes #1879

    sebastianbergmann committed Oct 2, 2015
    1
    Copy the full SHA
    4ecd63c View commit details

Commits on Oct 5, 2015

  1. Only use the first word after @use or @Covers

    Attempt to fix #1857
    David Stockton authored and sebastianbergmann committed Oct 5, 2015
    Copy the full SHA
    475a73d View commit details
  2. Copy the full SHA
    000d0d3 View commit details
  3. Update ChangeLog

    sebastianbergmann committed Oct 5, 2015
    Copy the full SHA
    def7611 View commit details

Commits on Oct 6, 2015

  1. Closes #1898

    sebastianbergmann committed Oct 6, 2015
    Copy the full SHA
    43f0f64 View commit details

Commits on Oct 7, 2015

  1. Closes #1901

    sebastianbergmann committed Oct 7, 2015
    Copy the full SHA
    34e6d36 View commit details
  2. Prepare release

    sebastianbergmann committed Oct 7, 2015
    Copy the full SHA
    bdd1994 View commit details
11 changes: 11 additions & 0 deletions ChangeLog-4.8.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,16 @@

All notable changes of the PHPUnit 4.8 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## [4.8.11] - 2015-10-07

### Fixed

* Merged [#1885](https://github.com/sebastianbergmann/phpunit/issues/1885): Fixed handling of PHP configuration settings for process isolation
* Fixed [#1857](https://github.com/sebastianbergmann/phpunit/issues/1857): `@covers` and `@uses` should only take a single word
* Fixed [#1879](https://github.com/sebastianbergmann/phpunit/issues/1879): `assertEqualXMLStructure()` cannot compare nodes with an ID
* Fixed [#1898](https://github.com/sebastianbergmann/phpunit/issues/1898): `@covers` and `@uses` cannot be used for namespaced functions
* Fixed [#1901](https://github.com/sebastianbergmann/phpunit/issues/1901): `--self-update` updates to PHPUnit 5, even on PHP < 5.6

## [4.8.10] - 2015-10-01

### Fixed
@@ -75,6 +85,7 @@ New PHAR release due to updated dependencies
* Made the argument check of `assertContains()` and `assertNotContains()` more strict to prevent undefined behavior such as [#1808](https://github.com/sebastianbergmann/phpunit/issues/1808)
* Changed the name of the default group from `__nogroup__` to `default`

[4.8.11]: https://github.com/sebastianbergmann/phpunit/compare/4.8.10...4.8.11
[4.8.10]: https://github.com/sebastianbergmann/phpunit/compare/4.8.9...4.8.10
[4.8.9]: https://github.com/sebastianbergmann/phpunit/compare/4.8.8...4.8.9
[4.8.8]: https://github.com/sebastianbergmann/phpunit/compare/4.8.7...4.8.8
9 changes: 7 additions & 2 deletions src/Framework/Assert.php
Original file line number Diff line number Diff line change
@@ -1795,8 +1795,13 @@ public static function assertXmlStringNotEqualsXmlString($expectedXml, $actualXm
*/
public static function assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, $checkAttributes = false, $message = '')
{
$expectedElement = clone $expectedElement;
$actualElement = clone $actualElement;
$tmp = new DOMDocument;
$expectedElement = $tmp->importNode($expectedElement, true);

$tmp = new DOMDocument;
$actualElement= $tmp->importNode($actualElement, true);

unset($tmp);

self::assertEquals(
$expectedElement->tagName,
5 changes: 4 additions & 1 deletion src/Framework/TestCase.php
Original file line number Diff line number Diff line change
@@ -670,6 +670,8 @@ public function run(PHPUnit_Framework_TestResult $result = null)
$includePath = "'." . $includePath . ".'";
$codeCoverageFilter = "'." . $codeCoverageFilter . ".'";

$configurationFilePath = (isset($GLOBALS['__PHPUNIT_CONFIGURATION_FILE']) ? $GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] : '');

$template->setVar(
array(
'composerAutoload' => $composerAutoload,
@@ -690,7 +692,8 @@ public function run(PHPUnit_Framework_TestResult $result = null)
'isStrictAboutOutputDuringTests' => $isStrictAboutOutputDuringTests,
'isStrictAboutTestSize' => $isStrictAboutTestSize,
'isStrictAboutTodoAnnotatedTests' => $isStrictAboutTodoAnnotatedTests,
'codeCoverageFilter' => $codeCoverageFilter
'codeCoverageFilter' => $codeCoverageFilter,
'configurationFilePath' => $configurationFilePath
)
);

2 changes: 1 addition & 1 deletion src/Runner/Version.php
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ public static function id()
}

if (self::$version === null) {
$version = new SebastianBergmann\Version('4.8.10', dirname(dirname(__DIR__)));
$version = new SebastianBergmann\Version('4.8.11', dirname(dirname(__DIR__)));
self::$version = $version->getVersion();
}

9 changes: 5 additions & 4 deletions src/TextUI/Command.php
Original file line number Diff line number Diff line change
@@ -786,10 +786,11 @@ protected function handleSelfUpdate()
exit(PHPUnit_TextUI_TestRunner::EXCEPTION_EXIT);
}

$remoteFilename = sprintf(
'https://phar.phpunit.de/phpunit%s.phar',
PHPUnit_Runner_Version::getReleaseChannel()
);
if (PHP_VERSION_ID < 50600) {
$remoteFilename = sprintf('https://phar.phpunit.de/phpunit-old.phar');
} else {
$remoteFilename = sprintf('https://phar.phpunit.de/phpunit.phar');
}

$tempFilename = tempnam(sys_get_temp_dir(), 'phpunit') . '.phar';

4 changes: 4 additions & 0 deletions src/TextUI/TestRunner.php
Original file line number Diff line number Diff line change
@@ -142,6 +142,10 @@ private function processSuiteFilters(PHPUnit_Framework_TestSuite $suite, array $
*/
public function doRun(PHPUnit_Framework_Test $suite, array $arguments = array())
{
if (isset($arguments['configuration'])) {
$GLOBALS['__PHPUNIT_CONFIGURATION_FILE'] = $arguments['configuration'];
}

$this->handleConfiguration($arguments);

$this->processSuiteFilters($suite, $arguments);
7 changes: 7 additions & 0 deletions src/Util/PHP/Template/TestCaseMethod.tpl.dist
Original file line number Diff line number Diff line change
@@ -70,6 +70,13 @@ function __phpunit_run_isolated_test()
);
}

$configurationFilePath = '{configurationFilePath}';

if ('' !== $configurationFilePath) {
$configuration = PHPUnit_Util_Configuration::getInstance($configurationFilePath);
$configuration->handlePHPConfiguration();
}

{constants}
{included_files}
{globals}
6 changes: 5 additions & 1 deletion src/Util/Test.php
Original file line number Diff line number Diff line change
@@ -147,6 +147,8 @@ private static function getLinesToBeCoveredOrUsed($className, $methodName, $mode
}

$element = preg_replace('/[\s()]+$/', '', $element);
$element = explode(' ', $element);
$element = $element[0];

$codeList = array_merge(
$codeList,
@@ -846,7 +848,9 @@ private static function resolveElementToReflectionObjects($element)
{
$codeToCoverList = array();

if (strpos($element, '::') !== false) {
if (strpos($element, '\\') !== false && function_exists($element)) {
$codeToCoverList[] = new ReflectionFunction($element);
} else if (strpos($element, '::') !== false) {
list($className, $methodName) = explode('::', $element);

if (isset($methodName[0]) && $methodName[0] == '<') {
2 changes: 1 addition & 1 deletion src/Util/XML.php
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ public static function load($actual, $isHtml = false, $filename = '', $xinclude
@chdir(dirname($filename));
}

$document = new DOMDocument;
$document = new DOMDocument;
$document->preserveWhiteSpace = false;

$internal = libxml_use_internal_errors(true);
20 changes: 20 additions & 0 deletions tests/Util/TestTest.php
Original file line number Diff line number Diff line change
@@ -16,6 +16,9 @@
);
}

require TEST_FILES_PATH . 'CoverageNamespacedFunctionTest.php';
require TEST_FILES_PATH . 'NamespaceCoveredFunction.php';

/**
* @since Class available since Release 3.3.6
*/
@@ -545,6 +548,23 @@ public function testMethodParenthesesAreAllowedWithWhitespace()
);
}

/**
* @covers PHPUnit_Util_Test::getLinesToBeCovered
* @covers PHPUnit_Util_Test::getLinesToBeCoveredOrUsed
*/
public function testNamespacedFunctionCanBeCoveredOrUsed()
{
$this->assertEquals(
array(
TEST_FILES_PATH . 'NamespaceCoveredFunction.php' => range(4, 7)
),
PHPUnit_Util_Test::getLinesToBeCovered(
'CoverageNamespacedFunctionTest',
'testFunc'
)
);
}

public function getLinesToBeCoveredProvider()
{
return array(
11 changes: 11 additions & 0 deletions tests/_files/CoverageNamespacedFunctionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
class CoverageNamespacedFunctionTest extends PHPUnit_Framework_TestCase
{
/**
* @covers foo\func()
*/
public function testFunc()
{
foo\func();
}
}
7 changes: 7 additions & 0 deletions tests/_files/NamespaceCoveredFunction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
namespace foo;

function func()
{
return true;
}