Skip to content

Commit

Permalink
Bump to phunit 10
Browse files Browse the repository at this point in the history
  • Loading branch information
veewee committed Sep 16, 2024
1 parent 0b65f56 commit 3fb8ce5
Show file tree
Hide file tree
Showing 57 changed files with 64,732 additions and 70,072 deletions.
2 changes: 1 addition & 1 deletion .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpunit" version="^9.5.19" installed="9.6.19" location="./tools/phpunit.phar" copy="true"/>
<phar name="phpunit" version="^10.5.26" installed="10.5.26" location="./tools/phpunit.phar" copy="true"/>
<phar name="infection" version="^0.29" installed="0.29.6" location="./tools/infection.phar" copy="true"/>
<phar name="php-cs-fixer" version="^3.3.2" installed="3.59.3" location="./tools/php-cs-fixer.phar" copy="true"/>
</phive>
39 changes: 20 additions & 19 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
bootstrap="tests/bootstrap.php"
executionOrder="random"
forceCoversAnnotation="false"
beStrictAboutCoversAnnotation="false"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
verbose="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="tests/bootstrap.php"
executionOrder="random"
beStrictAboutOutputDuringTests="true"
cacheDirectory=".phpunit.cache"
requireCoverageMetadata="false"
beStrictAboutCoverageMetadata="false"
displayDetailsOnTestsThatTriggerWarnings="true"
>
<coverage cacheDirectory=".phpunit.cache/code-coverage"
processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
<exclude>
<file>src/bootstrap.php</file>
</exclude>
<coverage>
<report>
<clover outputFile=".phpunit.cache/clover/clover.xml" />
<html outputDirectory=".phpunit.cache/report" lowUpperBound="99" highLowerBound="99" />
<clover outputFile=".phpunit.cache/clover/clover.xml"/>
<html outputDirectory=".phpunit.cache/report" lowUpperBound="99" highLowerBound="99"/>
</report>
</coverage>
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests/Xml</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
<exclude>
<file>src/bootstrap.php</file>
</exclude>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion src/Xml/Reader/Configurator/xsd_schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function xsd_schema(string $schemaFile): Closure
Assert::fileExists($schemaFile);

disallow_libxml_false_returns(
$reader->setSchema($schemaFile),
@$reader->setSchema($schemaFile),
'Unable to apply XSD schema to the XML Reader.'
);

Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Assert/AssertCDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function test_it_knows_cdata(?\DOM\Node $node, bool $expected): void
static::assertSame($node, $actual);
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Assert/AssertDocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function test_it_knows_documents(?\DOM\Node $node, bool $expected): void
static::assertSame($node, $actual);
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Assert/AssertElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function test_it_knows_elements(?\DOM\Node $node, bool $expected): void
static::assertSame($node, $actual);
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Configurator/CanonicalizeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function test_it_can_canonicalize(string $input, string $expected): void
static::assertSame($expected, $actual);
}

public function provideXmls()
public static function provideXmls()
{
yield 'no-action' => [
'<hello/>',
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Configurator/ComparableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function test_it_can_canonicalize(string $input, string $expected): void
static::assertSame($expected, $actual);
}

public function provideXmls()
public static function provideXmls()
{
yield 'no-action' => [
'<hello/>',
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Configurator/OptimizeNamespacesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function test_it_can_optimize_namespaces(string $input, string $expected)
static::assertSame($expected, $actual);
}

public function provideXmls()
public static function provideXmls()
{
yield 'no-action' => [
'<hello/>',
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Locator/Attribute/AttributesListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function test_it_can_fetch_xmlns_attribute_list_from_node(\DOM\Node $node
static::assertEquals($expected, [...$actual]);
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function test_it_can_fetch_xmlns_attribute_list_from_node(\DOM\Node $node
static::assertEquals($expected, [...$actual]);
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function test_it_can_optimize_namespaces(string $input, string $expected)
static::assertSame($expected, $actual);
}

public function provideXmls()
public static function provideXmls()
{
yield 'no-action' => [
'<hello/>',
Expand Down
4 changes: 0 additions & 4 deletions tests/Xml/Dom/Manipulator/Node/RenameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,8 @@ public function test_it_can_rename_namespaced_attributes(): void
static::assertSame($root->getAttributeNode('a:you'), $result);
}

/**
* https://github.com/php/php-src/blob/1c8bb6d6818c10a691d6836b336bcee003478b44/ext/dom/element.c#L663
*/
public function test_it_can_not_rename_namespaced_attribute_prefix_when_the_xmlns_is_still_available(): void
{
$this->markAsRisky('Broken DOM functionality');
$doc = Document::fromXmlString('<hello a:who="world" xmlns:a="http://a"/>');
$root = $doc->map(document_element());
$node = $root->getAttributeNode('a:who');
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Manipulator/Xmlns/RenameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function test_it_can_rename_namespaces(string $input, string $expected):
static::assertSame($expected, $actual);
}

public function provideXmls()
public static function provideXmls()
{
yield 'simple' => [
'<hello xmlns:replace="http://replace"/>',
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Predicate/IsAttributeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function test_it_knows_attributes(\DOM\Node $node, bool $expected): void
static::assertSame($expected, is_attribute($node));
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Predicate/IsCDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function test_it_knows_cdata(?\DOM\Node $node, bool $expected): void
static::assertSame($expected, $actual);
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Predicate/IsDefaultXmlnsAttributeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function test_it_knows_default_xmlns_attribute(\DOM\Node|\DOM\NameSpaceNo
static::assertSame($expected, is_default_xmlns_attribute($node));
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Predicate/IsDocumentElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function test_it_knows_document_elements(\DOM\Node $node, bool $expected)
static::assertSame($expected, is_document_element($node));
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Predicate/IsDocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function test_it_knows_documents(\DOM\Node $node, bool $expected): void
static::assertSame($expected, is_document($node));
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Predicate/IsElementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function test_it_knows_elements(\DOM\Node $node, bool $expected): void
static::assertSame($expected, is_element($node));
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Predicate/IsNonEmptyTextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function test_it_knows_text(\DOM\Node $node, bool $expected): void
static::assertSame($expected, is_non_empty_text($node));
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Predicate/IsTextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function test_it_knows_text(\DOM\Node $node, bool $expected): void
static::assertSame($expected, is_text($node));
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Predicate/IsWhitespaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function test_it_knows_whitespaces(\DOM\Node $node, bool $expected): void
static::assertSame($expected, is_whitespace($node));
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Predicate/IsXmlnsAttributeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function test_it_knows_xmlns_attributes(\DOM\Node|\DOM\NameSpaceNode $nod
static::assertSame($expected, is_xmlns_attribute($node));
}

public function provideTestCases()
public static function provideTestCases()
{
$doc = Document::fromXmlString(
<<<EOXML
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Validator/InternalXsdValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function test_it_can_validate_internal_xsds(string $xml, int $errors): vo
/**
* @return array
*/
public function provideSchemeValidation()
public static function provideSchemeValidation()
{
yield 'valid' => [
'xml' => 'xml-valid.xml',
Expand Down
10 changes: 5 additions & 5 deletions tests/Xml/Dom/Validator/ValidatorChainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function test_it_can_validate_multiple_validators(callable $validator, in
static::assertCount($errors, $issues);
}

public function provideErrorCases()
public static function provideErrorCases()
{
yield 'empty' => [
'validator' => validator_chain(),
Expand All @@ -47,7 +47,7 @@ public function provideErrorCases()
'validator' => validator_chain(
static fn (DOMDocument $document) => new IssueCollection(),
fn (DOMDocument $document) => new IssueCollection(
$this->createIssue(Level::fatal())
self::createIssue(Level::fatal())
),
static fn (DOMDocument $document) => new IssueCollection(),
static fn (DOMDocument $document) => new IssueCollection()
Expand All @@ -57,11 +57,11 @@ public function provideErrorCases()
yield 'allFails' => [
'validator' => validator_chain(
fn (DOMDocument $document) => new IssueCollection(
$this->createIssue(Level::fatal())
self::createIssue(Level::fatal())
),
fn (DOMDocument $document) => new IssueCollection(
$this->createIssue(Level::fatal()),
$this->createIssue(Level::fatal())
self::createIssue(Level::fatal()),
self::createIssue(Level::fatal())
),
),
'errors' => 3,
Expand Down
2 changes: 1 addition & 1 deletion tests/Xml/Dom/Validator/XsdValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function test_it_can_validate_xsds(string $xml, string $xsd, int $errors)
/**
* @return array
*/
public function provideSchemeValidation()
public static function provideSchemeValidation()
{
yield 'valid' => [
'xml' => 'xml-valid.xml',
Expand Down
26 changes: 13 additions & 13 deletions tests/Xml/Encoding/EncodingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ public function test_it_errors_while_encoding_invalid_xml_element(string $xml, a
/**
* @dataProvider provideInvalidXml
*/
public function test_it_errors_while_decoding_invalid_xml(string $xml)
public function test_it_errors_while_decoding_invalid_xml(string $xml, array $data)
{
$this->expectException(EncodingException::class);
xml_decode($xml);
}

public function provideBidirectionalCases()
public static function provideBidirectionalCases()
{
yield 'empty' => [
'xml' => '<hello />',
Expand Down Expand Up @@ -239,19 +239,13 @@ public function provideBidirectionalCases()
]
]
];
yield 'cdata' => [
'xml' => '<hello><![CDATA[<html>world</html>]]></hello>',
'data' => ['hello' => [
'@cdata' => '<html>world</html>'
]]
];
yield 'mixed cdata' => [
'xml' => '<hello>hello <![CDATA[<html>world</html>]]></hello>',
'data' => ['hello' => 'hello <html>world</html>']
];
}

public function provideRiskyBidirectionalCases()
public static function provideRiskyBidirectionalCases()
{
yield 'namespaced' => [
'xml' => <<<EOXML
Expand All @@ -278,7 +272,7 @@ public function provideRiskyBidirectionalCases()
];
}

public function provideEncodingOnly()
public static function provideEncodingOnly()
{
yield 'normalizable-types' => [
'xml' => <<<EOXML
Expand Down Expand Up @@ -335,17 +329,23 @@ public function jsonSerialize(): mixed
]
]
];
yield 'cdata' => [
'xml' => '<hello><![CDATA[<html>world</html>]]></hello>',
'data' => ['hello' => [
'@cdata' => '<html>world</html>'
]]
];
}

public function provideDecodingOnly()
public static function provideDecodingOnly()
{
yield 'cdata' => [
'xml' => '<hello><![CDATA[Jos & Bos]]></hello>',
'data' => ['hello' => 'Jos & Bos']
];
}

public function provideRiskyDecodingOnly()
public static function provideRiskyDecodingOnly()
{
yield 'falsy namespaced' => [
'xml' => <<<EOXML
Expand Down Expand Up @@ -421,7 +421,7 @@ public function provideRiskyDecodingOnly()
];
}

public function provideInvalidXml()
public static function provideInvalidXml()
{
yield 'items-in-root' => [
'xml' => <<<EOXML
Expand Down
Loading

0 comments on commit 3fb8ce5

Please sign in to comment.