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.7
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.8
Choose a head ref
  • 3 commits
  • 6 files changed
  • 1 contributor

Commits on Sep 15, 2015

  1. Closes #1852

    sebastianbergmann committed Sep 15, 2015
    Copy the full SHA
    032a3de View commit details

Commits on Sep 19, 2015

  1. Closes #1860

    sebastianbergmann committed Sep 19, 2015
    5

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a15d638 View commit details
  2. Prepare release

    sebastianbergmann committed Sep 19, 2015
    Copy the full SHA
    5217202 View commit details
Showing with 42 additions and 65 deletions.
  1. +7 −0 ChangeLog-4.8.md
  2. +12 −52 src/Framework/Assert.php
  3. +1 −1 src/Runner/Version.php
  4. +9 −9 src/Util/Configuration.php
  5. +3 −3 src/Util/XML.php
  6. +10 −0 tests/Framework/AssertTest.php
7 changes: 7 additions & 0 deletions ChangeLog-4.8.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,12 @@

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.8] - 2015-09-19

### Fixed

* Fixed [#1860](https://github.com/sebastianbergmann/phpunit/issues/1860): Not well-formed XML strings are always considered equal by `PHPUnit_Framework_Assert::assertXmlStringEqualsXmlString()`

## [4.8.7] - 2015-09-14

New PHAR release due to updated dependencies
@@ -57,6 +63,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.8]: https://github.com/sebastianbergmann/phpunit/compare/4.8.7...4.8.8
[4.8.7]: https://github.com/sebastianbergmann/phpunit/compare/4.8.6...4.8.7
[4.8.6]: https://github.com/sebastianbergmann/phpunit/compare/4.8.5...4.8.6
[4.8.5]: https://github.com/sebastianbergmann/phpunit/compare/4.8.4...4.8.5
64 changes: 12 additions & 52 deletions src/Framework/Assert.php
Original file line number Diff line number Diff line change
@@ -1698,16 +1698,8 @@ public static function assertStringEndsNotWith($suffix, $string, $message = '')
*/
public static function assertXmlFileEqualsXmlFile($expectedFile, $actualFile, $message = '')
{
self::assertFileExists($expectedFile);
self::assertFileExists($actualFile);

$expected = new DOMDocument;
$expected->preserveWhiteSpace = false;
$expected->load($expectedFile);

$actual = new DOMDocument;
$actual->preserveWhiteSpace = false;
$actual->load($actualFile);
$expected = PHPUnit_Util_XML::loadFile($expectedFile);
$actual = PHPUnit_Util_XML::loadFile($actualFile);

self::assertEquals($expected, $actual, $message);
}
@@ -1722,16 +1714,8 @@ public static function assertXmlFileEqualsXmlFile($expectedFile, $actualFile, $m
*/
public static function assertXmlFileNotEqualsXmlFile($expectedFile, $actualFile, $message = '')
{
self::assertFileExists($expectedFile);
self::assertFileExists($actualFile);

$expected = new DOMDocument;
$expected->preserveWhiteSpace = false;
$expected->load($expectedFile);

$actual = new DOMDocument;
$actual->preserveWhiteSpace = false;
$actual->load($actualFile);
$expected = PHPUnit_Util_XML::loadFile($expectedFile);
$actual = PHPUnit_Util_XML::loadFile($actualFile);

self::assertNotEquals($expected, $actual, $message);
}
@@ -1746,15 +1730,8 @@ public static function assertXmlFileNotEqualsXmlFile($expectedFile, $actualFile,
*/
public static function assertXmlStringEqualsXmlFile($expectedFile, $actualXml, $message = '')
{
self::assertFileExists($expectedFile);

$expected = new DOMDocument;
$expected->preserveWhiteSpace = false;
$expected->load($expectedFile);

$actual = new DOMDocument;
$actual->preserveWhiteSpace = false;
$actual->loadXML($actualXml);
$expected = PHPUnit_Util_XML::loadFile($expectedFile);
$actual = PHPUnit_Util_XML::load($actualXml);

self::assertEquals($expected, $actual, $message);
}
@@ -1769,15 +1746,8 @@ public static function assertXmlStringEqualsXmlFile($expectedFile, $actualXml, $
*/
public static function assertXmlStringNotEqualsXmlFile($expectedFile, $actualXml, $message = '')
{
self::assertFileExists($expectedFile);

$expected = new DOMDocument;
$expected->preserveWhiteSpace = false;
$expected->load($expectedFile);

$actual = new DOMDocument;
$actual->preserveWhiteSpace = false;
$actual->loadXML($actualXml);
$expected = PHPUnit_Util_XML::loadFile($expectedFile);
$actual = PHPUnit_Util_XML::load($actualXml);

self::assertNotEquals($expected, $actual, $message);
}
@@ -1792,13 +1762,8 @@ public static function assertXmlStringNotEqualsXmlFile($expectedFile, $actualXml
*/
public static function assertXmlStringEqualsXmlString($expectedXml, $actualXml, $message = '')
{
$expected = new DOMDocument;
$expected->preserveWhiteSpace = false;
$expected->loadXML($expectedXml);

$actual = new DOMDocument;
$actual->preserveWhiteSpace = false;
$actual->loadXML($actualXml);
$expected = PHPUnit_Util_XML::load($expectedXml);
$actual = PHPUnit_Util_XML::load($actualXml);

self::assertEquals($expected, $actual, $message);
}
@@ -1813,13 +1778,8 @@ public static function assertXmlStringEqualsXmlString($expectedXml, $actualXml,
*/
public static function assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, $message = '')
{
$expected = new DOMDocument;
$expected->preserveWhiteSpace = false;
$expected->loadXML($expectedXml);

$actual = new DOMDocument;
$actual->preserveWhiteSpace = false;
$actual->loadXML($actualXml);
$expected = PHPUnit_Util_XML::load($expectedXml);
$actual = PHPUnit_Util_XML::load($actualXml);

self::assertNotEquals($expected, $actual, $message);
}
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.7', dirname(dirname(__DIR__)));
$version = new SebastianBergmann\Version('4.8.8', dirname(dirname(__DIR__)));
self::$version = $version->getVersion();
}

18 changes: 9 additions & 9 deletions src/Util/Configuration.php
Original file line number Diff line number Diff line change
@@ -293,11 +293,11 @@ public function getGroupConfiguration()
);

foreach ($this->xpath->query('groups/include/group') as $group) {
$groups['include'][] = (string) $group->nodeValue;
$groups['include'][] = (string) $group->textContent;
}

foreach ($this->xpath->query('groups/exclude/group') as $group) {
$groups['exclude'][] = (string) $group->nodeValue;
$groups['exclude'][] = (string) $group->textContent;
}

return $groups;
@@ -331,7 +331,7 @@ public function getListenerConfiguration()
if ($argument instanceof DOMElement) {
if ($argument->tagName == 'file' ||
$argument->tagName == 'directory') {
$arguments[] = $this->toAbsolutePath((string) $argument->nodeValue);
$arguments[] = $this->toAbsolutePath((string) $argument->textContent);
} else {
$arguments[] = PHPUnit_Util_XML::xmlToVariable($argument);
}
@@ -441,7 +441,7 @@ public function getPHPConfiguration()
);

foreach ($this->xpath->query('php/includePath') as $includePath) {
$path = (string) $includePath->nodeValue;
$path = (string) $includePath->textContent;
if ($path) {
$result['include_path'][] = $this->toAbsolutePath($path);
}
@@ -891,7 +891,7 @@ protected function getTestSuite(DOMElement $testSuiteNode, $testSuiteFilter = nu
$exclude = array();

foreach ($testSuiteNode->getElementsByTagName('exclude') as $excludeNode) {
$excludeFile = (string) $excludeNode->nodeValue;
$excludeFile = (string) $excludeNode->textContent;
if ($excludeFile) {
$exclude[] = $this->toAbsolutePath($excludeFile);
}
@@ -904,7 +904,7 @@ protected function getTestSuite(DOMElement $testSuiteNode, $testSuiteFilter = nu
continue;
}

$directory = (string) $directoryNode->nodeValue;
$directory = (string) $directoryNode->textContent;

if (empty($directory)) {
continue;
@@ -952,7 +952,7 @@ protected function getTestSuite(DOMElement $testSuiteNode, $testSuiteFilter = nu
continue;
}

$file = (string) $fileNode->nodeValue;
$file = (string) $fileNode->textContent;

if (empty($file)) {
continue;
@@ -1033,7 +1033,7 @@ protected function readFilterDirectories($query)
$directories = array();

foreach ($this->xpath->query($query) as $directory) {
$directoryPath = (string) $directory->nodeValue;
$directoryPath = (string) $directory->textContent;

if (!$directoryPath) {
continue;
@@ -1078,7 +1078,7 @@ protected function readFilterFiles($query)
$files = array();

foreach ($this->xpath->query($query) as $file) {
$filePath = (string) $file->nodeValue;
$filePath = (string) $file->textContent;
if ($filePath) {
$files[] = $this->toAbsolutePath($filePath);
}
6 changes: 3 additions & 3 deletions src/Util/XML.php
Original file line number Diff line number Diff line change
@@ -157,7 +157,7 @@ public static function load($actual, $isHtml = false, $filename = '', $xinclude
public static function nodeToText(DOMNode $node)
{
if ($node->childNodes->length == 1) {
return $node->nodeValue;
return $node->textContent;
}

$result = '';
@@ -231,13 +231,13 @@ public static function xmlToVariable(DOMElement $element)
break;

case 'boolean':
$variable = $element->nodeValue == 'true' ? true : false;
$variable = $element->textContent == 'true' ? true : false;
break;

case 'integer':
case 'double':
case 'string':
$variable = $element->nodeValue;
$variable = $element->textContent;

settype($variable, $element->tagName);
break;
10 changes: 10 additions & 0 deletions tests/Framework/AssertTest.php
Original file line number Diff line number Diff line change
@@ -1172,6 +1172,16 @@ public function testAssertXmlStringEqualsXmlString()
$this->fail();
}

/**
* @expectedException PHPUnit_Framework_Exception
* @covers PHPUnit_Framework_Assert::assertXmlStringEqualsXmlString
* @ticket 1860
*/
public function testAssertXmlStringEqualsXmlString2()
{
$this->assertXmlStringEqualsXmlString('<a></b>', '<c></d>');
}

/**
* @covers PHPUnit_Framework_Assert::assertXmlStringNotEqualsXmlString
*/