From d328704885595cadd1412eaa7619995970dce426 Mon Sep 17 00:00:00 2001 From: Volodymyr Stolyarchuk Date: Tue, 15 Jul 2025 19:49:50 +0300 Subject: [PATCH] fix: remove explode by space --- src/Subscribers/AttributeResolverTrait.php | 2 -- tests/AttributeDeclaredOnMethodsTest.php | 1 + .../test-case-with-spaces | 24 +++++++++++++++++++ ...arated_cassettes-test-case-with-spaces.yml | 24 +++++++++++++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 tests/fixtures/on_methods_without_extension_with_data_provider/test-case-with-spaces create mode 100644 tests/fixtures/with_data_provider_and_separated_cassettes-test-case-with-spaces.yml diff --git a/src/Subscribers/AttributeResolverTrait.php b/src/Subscribers/AttributeResolverTrait.php index 92099b6..c513392 100644 --- a/src/Subscribers/AttributeResolverTrait.php +++ b/src/Subscribers/AttributeResolverTrait.php @@ -47,8 +47,6 @@ private function getTestCaseCassetteParameters(string $test): ?TestCaseParameter private function parseMethod(string $test): TestMethodInfo { - $test = explode(" ", $test)[0]; - $methoDetails = explode("#", $test); return new TestMethodInfo( method: $methoDetails[0], diff --git a/tests/AttributeDeclaredOnMethodsTest.php b/tests/AttributeDeclaredOnMethodsTest.php index 7268ff6..fd8f4f1 100644 --- a/tests/AttributeDeclaredOnMethodsTest.php +++ b/tests/AttributeDeclaredOnMethodsTest.php @@ -89,5 +89,6 @@ public static function namedUrls(): iterable { yield 'example.com' => ["https://example.com"]; yield 'example.org' => ["https://example.org"]; + yield 'test case with spaces' => ["https://example.org"]; } } diff --git a/tests/fixtures/on_methods_without_extension_with_data_provider/test-case-with-spaces b/tests/fixtures/on_methods_without_extension_with_data_provider/test-case-with-spaces new file mode 100644 index 0000000..748aa65 --- /dev/null +++ b/tests/fixtures/on_methods_without_extension_with_data_provider/test-case-with-spaces @@ -0,0 +1,24 @@ +- + request: + method: GET + url: 'https://example.org' + headers: + Host: example.org + response: + status: + code: 200 + message: '' + headers: + age: '331432' + cache-control: max-age=604800 + content-type: 'text/html; charset=UTF-8' + date: 'Sun, 12 Mar 2023 10:17:02 GMT' + etag: '"3147526947+ident"' + expires: 'Sun, 19 Mar 2023 10:17:02 GMT' + last-modified: 'Thu, 17 Oct 2019 07:18:26 GMT' + server: 'ECS (dcb/7F83)' + vary: Accept-Encoding + x-cache: HIT + content-length: '1256' + body: "Example body for \"https://example.org\"" + index: 0 diff --git a/tests/fixtures/with_data_provider_and_separated_cassettes-test-case-with-spaces.yml b/tests/fixtures/with_data_provider_and_separated_cassettes-test-case-with-spaces.yml new file mode 100644 index 0000000..92f524a --- /dev/null +++ b/tests/fixtures/with_data_provider_and_separated_cassettes-test-case-with-spaces.yml @@ -0,0 +1,24 @@ +- + request: + method: GET + url: 'https://example.org' + headers: + Host: example.org + response: + status: + code: 200 + message: '' + headers: + age: '331432' + cache-control: max-age=604800 + content-type: 'text/html; charset=UTF-8' + date: 'Sun, 12 Mar 2023 10:17:02 GMT' + etag: '"3147526947+ident"' + expires: 'Sun, 19 Mar 2023 10:17:02 GMT' + last-modified: 'Thu, 17 Oct 2019 07:18:26 GMT' + server: 'ECS (dcb/7F83)' + vary: Accept-Encoding + x-cache: HIT + content-length: '1256' + body: "Example body for \"https://example.org\"" + index: 0