Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPUnit 9.3 breaks backward compatibility for assertXmlStringEqualsXmlFile() #4407

Closed
morozov opened this issue Aug 7, 2020 · 0 comments
Closed
Assignees
Labels
feature/assertion Issues related to assertions and expectations type/bug Something is broken

Comments

@morozov
Copy link
Contributor

morozov commented Aug 7, 2020

Q A
PHPUnit version 9.3.2
PHP version 7.4.9
Installation Method Composer

Summary

The usage of a DOMDocument value for the $actualXml argument of assertXmlStringEqualsXmlFile() is broken (c331d28).

How to reproduce

<?php

declare(strict_types=1);

use DOMDocument;
use PHPUnit\Framework\TestCase;

class XmlTest extends TestCase
{
    public function test(): void
    {
        $this->assertXmlStringEqualsXmlFile(
            __DIR__ . '/phpunit.xml',
            new DOMDocument()
        );
    }
}
$ phpunit XmlTest.php
PHPUnit 9.3.2 by Sebastian Bergmann and contributors.

E                                                                                   1 / 1 (100%)

Time: 00:00.003, Memory: 8.00 MB

There was 1 error:

1) XmlTest::test
TypeError: Argument 1 passed to PHPUnit\Util\Xml\Loader::load() must be of the type string, object given, called in vendor/phpunit/phpunit/src/Framework/Assert.php on line 2126

Expected behavior

Only a deprecation warning is triggered. The usage of DOMDocument is supported by all PHPUnit 9.x releases.

@morozov morozov added the type/bug Something is broken label Aug 7, 2020
@sebastianbergmann sebastianbergmann added the feature/assertion Issues related to assertions and expectations label Aug 8, 2020
@sebastianbergmann sebastianbergmann self-assigned this Aug 8, 2020
sebastianbergmann added a commit that referenced this issue Aug 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/assertion Issues related to assertions and expectations type/bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants