From 19a1569fa8e9aca2ca6ec341b2e2aecb8c2ecd90 Mon Sep 17 00:00:00 2001 From: jordanbrauer <18744334+jordanbrauer@users.noreply.github.com> Date: Sat, 13 Feb 2021 13:31:25 -0600 Subject: [PATCH] cleanup for self-review --- src/Factories/TestCaseFactory.php | 2 +- tests/.snapshots/success.txt | 14 +++++++------- tests/PHPUnit/CustomAffixes/@#$%^&()-_=+.php | 10 +++++++--- tests/PHPUnit/CustomAffixes/A Test With Spaces.php | 3 +-- .../CustomAffixes/AdditionalFileExtension.spec.php | 3 +-- .../CustomAffixes/ManyExtensions.class.test.php | 3 +-- .../CustomAffixes/Test 'Case' With Quotes.php | 3 +-- tests/PHPUnit/CustomAffixes/kebab-case-spec.php | 3 +-- tests/PHPUnit/CustomAffixes/snake_case_spec.php | 3 +-- 9 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/Factories/TestCaseFactory.php b/src/Factories/TestCaseFactory.php index c09730a7..4d628e5a 100644 --- a/src/Factories/TestCaseFactory.php +++ b/src/Factories/TestCaseFactory.php @@ -179,7 +179,7 @@ final class TestCaseFactory // Strip out any %-encoded octets. $relativePath = (string) preg_replace('|%[a-fA-F0-9][a-fA-F0-9]|', '', $relativePath); - // Remove escaped quote sequences + // Remove escaped quote sequences (maintain namespace) $relativePath = str_replace(array_map(function (string $quote): string { return sprintf('\\%s', $quote); }, ['\'', '"']), '', $relativePath); diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index cfe2a393..f4db6877 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -104,25 +104,25 @@ ✓ it example 2 PASS Tests\PHPUnit\CustomAffixes\InvalidTestName - ✓ this runs file names like "@#$%^&()-_=+.php" + ✓ it runs file names like `@#$%^&()-_=+.php` PASS Tests\PHPUnit\CustomAffixes\ATestWithSpaces - ✓ this runs file names like "A Test With Spaces.php" + ✓ it runs file names like `A Test With Spaces.php` PASS Tests\PHPUnit\CustomAffixes\AdditionalFileExtensionspec - ✓ this runs file names like "AdditionalFileExtension.spec.php" + ✓ it runs file names like `AdditionalFileExtension.spec.php` PASS Tests\PHPUnit\CustomAffixes\ManyExtensionsclasstest - ✓ this runs file names like "ManyExtensions.class.test.php" + ✓ it runs file names like `ManyExtensions.class.test.php` PASS Tests\PHPUnit\CustomAffixes\TestCaseWithQuotes - ✓ this runs file names like "Test 'Case' With Quotes.php" + ✓ it runs file names like `Test 'Case' With Quotes.php` PASS Tests\PHPUnit\CustomAffixes\kebabcasespec - ✓ this runs file names like "kebab-case-spec.php" + ✓ it runs file names like `kebab-case-spec.php` PASS Tests\PHPUnit\CustomAffixes\snakecasespec - ✓ this runs file names like "snake_case_spec.php" + ✓ it runs file names like `snake_case_spec.php` PASS Tests\PHPUnit\CustomTestCase\UsesPerDirectory ✓ closure was bound to CustomTestCase diff --git a/tests/PHPUnit/CustomAffixes/@#$%^&()-_=+.php b/tests/PHPUnit/CustomAffixes/@#$%^&()-_=+.php index accf5eee..c829124d 100644 --- a/tests/PHPUnit/CustomAffixes/@#$%^&()-_=+.php +++ b/tests/PHPUnit/CustomAffixes/@#$%^&()-_=+.php @@ -1,6 +1,10 @@ assertTrue(true); +/* + * NOTE: To preserve cross-platform testing compatibility we cannot use ! * and + * other Windows reserved characters in this test's filename. + * + * See https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions + */ - //!@#$%^&*()-_=+ +it(sprintf('runs file names like `%s`', basename(__FILE__)))->assertTrue(true); diff --git a/tests/PHPUnit/CustomAffixes/A Test With Spaces.php b/tests/PHPUnit/CustomAffixes/A Test With Spaces.php index 1fa89600..28497a1e 100644 --- a/tests/PHPUnit/CustomAffixes/A Test With Spaces.php +++ b/tests/PHPUnit/CustomAffixes/A Test With Spaces.php @@ -1,4 +1,3 @@ assertTrue(true); +it(sprintf('runs file names like `%s`', basename(__FILE__)))->assertTrue(true); diff --git a/tests/PHPUnit/CustomAffixes/AdditionalFileExtension.spec.php b/tests/PHPUnit/CustomAffixes/AdditionalFileExtension.spec.php index 1fa89600..28497a1e 100644 --- a/tests/PHPUnit/CustomAffixes/AdditionalFileExtension.spec.php +++ b/tests/PHPUnit/CustomAffixes/AdditionalFileExtension.spec.php @@ -1,4 +1,3 @@ assertTrue(true); +it(sprintf('runs file names like `%s`', basename(__FILE__)))->assertTrue(true); diff --git a/tests/PHPUnit/CustomAffixes/ManyExtensions.class.test.php b/tests/PHPUnit/CustomAffixes/ManyExtensions.class.test.php index 1fa89600..28497a1e 100644 --- a/tests/PHPUnit/CustomAffixes/ManyExtensions.class.test.php +++ b/tests/PHPUnit/CustomAffixes/ManyExtensions.class.test.php @@ -1,4 +1,3 @@ assertTrue(true); +it(sprintf('runs file names like `%s`', basename(__FILE__)))->assertTrue(true); diff --git a/tests/PHPUnit/CustomAffixes/Test 'Case' With Quotes.php b/tests/PHPUnit/CustomAffixes/Test 'Case' With Quotes.php index 1fa89600..28497a1e 100644 --- a/tests/PHPUnit/CustomAffixes/Test 'Case' With Quotes.php +++ b/tests/PHPUnit/CustomAffixes/Test 'Case' With Quotes.php @@ -1,4 +1,3 @@ assertTrue(true); +it(sprintf('runs file names like `%s`', basename(__FILE__)))->assertTrue(true); diff --git a/tests/PHPUnit/CustomAffixes/kebab-case-spec.php b/tests/PHPUnit/CustomAffixes/kebab-case-spec.php index 1fa89600..28497a1e 100644 --- a/tests/PHPUnit/CustomAffixes/kebab-case-spec.php +++ b/tests/PHPUnit/CustomAffixes/kebab-case-spec.php @@ -1,4 +1,3 @@ assertTrue(true); +it(sprintf('runs file names like `%s`', basename(__FILE__)))->assertTrue(true); diff --git a/tests/PHPUnit/CustomAffixes/snake_case_spec.php b/tests/PHPUnit/CustomAffixes/snake_case_spec.php index 1fa89600..28497a1e 100644 --- a/tests/PHPUnit/CustomAffixes/snake_case_spec.php +++ b/tests/PHPUnit/CustomAffixes/snake_case_spec.php @@ -1,4 +1,3 @@ assertTrue(true); +it(sprintf('runs file names like `%s`', basename(__FILE__)))->assertTrue(true);