From c98fa15aab0ad334ffcbd0c2a53878dfc7a4a43c Mon Sep 17 00:00:00 2001 From: Art4 Date: Tue, 8 Oct 2024 13:29:54 +0200 Subject: [PATCH] Fix tests --- src/Redmine/Serializer/XmlSerializer.php | 4 ++-- tests/Integration/Psr18ClientRequestGenerationTest.php | 2 +- tests/Unit/Client/NativeCurlClientTest.php | 2 +- tests/Unit/Client/Psr18ClientTest.php | 2 +- tests/Unit/Serializer/JsonSerializerTest.php | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Redmine/Serializer/XmlSerializer.php b/src/Redmine/Serializer/XmlSerializer.php index f0b10050..5d686136 100644 --- a/src/Redmine/Serializer/XmlSerializer.php +++ b/src/Redmine/Serializer/XmlSerializer.php @@ -144,9 +144,9 @@ private function denormalize(array $normalized): void } /** - * @param array $params + * @param string|array $params */ - private function createXmlElement(string $rootElementName, array $params): SimpleXMLElement + private function createXmlElement(string $rootElementName, $params): SimpleXMLElement { $value = ''; if (! is_array($params)) { diff --git a/tests/Integration/Psr18ClientRequestGenerationTest.php b/tests/Integration/Psr18ClientRequestGenerationTest.php index c98edbe6..1d98fe5a 100644 --- a/tests/Integration/Psr18ClientRequestGenerationTest.php +++ b/tests/Integration/Psr18ClientRequestGenerationTest.php @@ -69,7 +69,7 @@ public function testPsr18ClientCreatesCorrectRequests( return new Request($method, $uri); }); - $streamFactory = new class () implements StreamFactoryInterface { + $streamFactory = new class implements StreamFactoryInterface { public function createStream(string $content = ''): StreamInterface { return Utils::streamFor($content); diff --git a/tests/Unit/Client/NativeCurlClientTest.php b/tests/Unit/Client/NativeCurlClientTest.php index 0cfd6c8b..1f4c234d 100644 --- a/tests/Unit/Client/NativeCurlClientTest.php +++ b/tests/Unit/Client/NativeCurlClientTest.php @@ -767,7 +767,7 @@ public function testGetApiShouldThrowException(): void ); $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('`do_not_exist` is not a valid api. Possible apis are `attachment`, `group`, `custom_fields`, `issue`, `issue_category`, `issue_priority`, `issue_relation`, `issue_status`, `membership`, `news`, `project`, `query`, `role`, `time_entry`, `time_entry_activity`, `tracker`, `user`, `version`, `wiki`, `search`'); + $this->expectExceptionMessage('`do_not_exist` is not a valid api. Possible apis are `attachment`, `group`, `custom_fields`, `issue`, `issue_category`, `issue_priority`, `issue_relation`, `issue_status`, `membership`, `news`, `project`, `query`, `role`, `search`, `time_entry`, `time_entry_activity`, `tracker`, `user`, `version`, `wiki`'); $client->getApi('do_not_exist'); } diff --git a/tests/Unit/Client/Psr18ClientTest.php b/tests/Unit/Client/Psr18ClientTest.php index fd1f260c..3f5b6592 100644 --- a/tests/Unit/Client/Psr18ClientTest.php +++ b/tests/Unit/Client/Psr18ClientTest.php @@ -303,7 +303,7 @@ public function testGetApiShouldThrowException(): void ); $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('`do_not_exist` is not a valid api. Possible apis are `attachment`, `group`, `custom_fields`, `issue`, `issue_category`, `issue_priority`, `issue_relation`, `issue_status`, `membership`, `news`, `project`, `query`, `role`, `time_entry`, `time_entry_activity`, `tracker`, `user`, `version`, `wiki`, `search`'); + $this->expectExceptionMessage('`do_not_exist` is not a valid api. Possible apis are `attachment`, `group`, `custom_fields`, `issue`, `issue_category`, `issue_priority`, `issue_relation`, `issue_status`, `membership`, `news`, `project`, `query`, `role`, `search`, `time_entry`, `time_entry_activity`, `tracker`, `user`, `version`, `wiki`'); $client->getApi('do_not_exist'); } diff --git a/tests/Unit/Serializer/JsonSerializerTest.php b/tests/Unit/Serializer/JsonSerializerTest.php index 58c2ae65..81f7df7c 100644 --- a/tests/Unit/Serializer/JsonSerializerTest.php +++ b/tests/Unit/Serializer/JsonSerializerTest.php @@ -63,7 +63,7 @@ public static function getEncodedToNormalizedData(): array * @dataProvider getEncodedToNormalizedData */ #[DataProvider('getEncodedToNormalizedData')] - public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, string $expected): void + public function testCreateFromStringDecodesToExpectedNormalizedData(string $data, $expected): void { $serializer = JsonSerializer::createFromString($data); @@ -184,7 +184,7 @@ public static function getNormalizedToEncodedData(): array * @dataProvider getNormalizedToEncodedData */ #[DataProvider('getNormalizedToEncodedData')] - public function testCreateFromArrayEncodesToExpectedString(array $data, string $expected): void + public function testCreateFromArrayEncodesToExpectedString(array $data, $expected): void { $serializer = JsonSerializer::createFromArray($data);