From 869a4bf772fd7fdd83e99f878b0bc0afd5040e65 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 19 Mar 2024 21:20:54 +0100 Subject: [PATCH] Migrate phpunit metadata to attributes --- composer.json | 2 +- src/TestUtils/SchemaValidationTestTrait.php | 4 ++-- src/TestUtils/SerializableElementTestTrait.php | 6 +++--- tests/XML/Base64ElementTraitTest.php | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 172013d..57cbd22 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "simplesamlphp/assert": "^1.1" }, "require-dev": { - "simplesamlphp/simplesamlphp-test-framework": "^1.5" + "simplesamlphp/simplesamlphp-test-framework": "^1.6" }, "support": { "issues": "https://github.com/simplesamlphp/xml-common/issues", diff --git a/src/TestUtils/SchemaValidationTestTrait.php b/src/TestUtils/SchemaValidationTestTrait.php index c9ebf8d..bf5048e 100644 --- a/src/TestUtils/SchemaValidationTestTrait.php +++ b/src/TestUtils/SchemaValidationTestTrait.php @@ -7,6 +7,7 @@ use DOMDocument; use Exception; use LibXMLError; // Officially spelled with a lower-case `l`, but that breaks composer-require-checker +use PHPUnit\Framework\Attributes\Depends; use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Exception\SchemaViolationException; use XMLReader; @@ -37,9 +38,8 @@ trait SchemaValidationTestTrait /** * Test schema validation. - * - * @depends testSerialization */ + #[Depends('testSerialization')] public function testSchemaValidation(): void { if (!class_exists(self::$testedClass)) { diff --git a/src/TestUtils/SerializableElementTestTrait.php b/src/TestUtils/SerializableElementTestTrait.php index 27736a1..ede744e 100644 --- a/src/TestUtils/SerializableElementTestTrait.php +++ b/src/TestUtils/SerializableElementTestTrait.php @@ -5,6 +5,7 @@ namespace SimpleSAML\XML\TestUtils; use DOMDocument; +use PHPUnit\Framework\Attributes\Depends; use function class_exists; @@ -56,10 +57,9 @@ public function testUnmarshalling(): void /** * Test serialization / unserialization. - * - * @depends testMarshalling - * @depends testUnmarshalling */ + #[Depends('testMarshalling')] + #[Depends('testUnmarshalling')] public function testSerialization(): void { if (!class_exists(self::$testedClass)) { diff --git a/tests/XML/Base64ElementTraitTest.php b/tests/XML/Base64ElementTraitTest.php index 8765f81..b642fe6 100644 --- a/tests/XML/Base64ElementTraitTest.php +++ b/tests/XML/Base64ElementTraitTest.php @@ -4,6 +4,7 @@ namespace SimpleSAML\Test\XML; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use SimpleSAML\Test\XML\XMLDumper; use SimpleSAML\XML\DOMDocumentFactory; @@ -65,8 +66,8 @@ public function testUnmarshalling(): void /** * @param non-empty-string $xml - * @dataProvider provideBase64Cases */ + #[DataProvider('provideBase64Cases')] public function testBase64Cases(string $xml): void { $xmlRepresentation = DOMDocumentFactory::fromString($xml);