From b0c964d4d9c527f251c30addaad4562e3341fef0 Mon Sep 17 00:00:00 2001 From: Alex Rock Ancelet Date: Thu, 28 May 2020 23:11:14 +0200 Subject: [PATCH 01/24] Don't use "reapath" in binary for cross-compatibility --- bin/pest | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/pest b/bin/pest index 9b66a2b6..5ff4eea1 100755 --- a/bin/pest +++ b/bin/pest @@ -1,6 +1,7 @@ #!/usr/bin/env php register(); + (new Provider())->register(); $rootPath = getcwd(); From 3d2c83a50135244c31224bb4e605e710f78da8f8 Mon Sep 17 00:00:00 2001 From: Alex Rock Ancelet Date: Thu, 28 May 2020 23:12:16 +0200 Subject: [PATCH 02/24] Make sure test targets are sanitized in a windows-compatible way --- src/PendingObjects/UsesCall.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/PendingObjects/UsesCall.php b/src/PendingObjects/UsesCall.php index d7cfc1f6..56205be8 100644 --- a/src/PendingObjects/UsesCall.php +++ b/src/PendingObjects/UsesCall.php @@ -59,7 +59,17 @@ final class UsesCall public function in(string ...$targets): void { $targets = array_map(function ($path): string { - return $path[0] === DIRECTORY_SEPARATOR + $startChar = DIRECTORY_SEPARATOR; + + if ('\\' === DIRECTORY_SEPARATOR) { + $path = (string) preg_replace_callback('~^(?P[a-z]+:\\\)~i', function ($match): string { + return strtolower($match['drive']); + }, $path); + + $startChar = strtolower((string) preg_replace('~^([a-z]+:\\\).*$~i', '$1', __DIR__)); + } + + return 0 === strpos($path, $startChar) ? $path : implode(DIRECTORY_SEPARATOR, [ dirname($this->filename), @@ -68,12 +78,12 @@ final class UsesCall }, $targets); $this->targets = array_map(function ($target): string { - $realTarget = realpath($target); - if ($realTarget === false) { - throw new InvalidUsesPath($target); + $isValid = is_dir($target) || file_exists($target); + if (!$isValid) { + throw new InvalidUsesPath($target . "\n"); } - return $realTarget; + return $target; }, $targets); } From 163de283381055f50fd8c30f1b58a7d74a4609bb Mon Sep 17 00:00:00 2001 From: Alex Rock Ancelet Date: Sat, 30 May 2020 00:10:48 +0200 Subject: [PATCH 03/24] Make sure PHP is called before calling pest as sub process --- tests/Visual/SingleTestOrDirectory.php | 2 +- tests/Visual/Success.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Visual/SingleTestOrDirectory.php b/tests/Visual/SingleTestOrDirectory.php index d86fc4c9..b2200ed8 100644 --- a/tests/Visual/SingleTestOrDirectory.php +++ b/tests/Visual/SingleTestOrDirectory.php @@ -3,7 +3,7 @@ use Symfony\Component\Process\Process; $run = function (string $target) { - $process = new Process(['./bin/pest', $target], dirname(__DIR__, 2)); + $process = new Process(['php', 'bin/pest', $target], dirname(__DIR__, 2)); $process->run(); diff --git a/tests/Visual/Success.php b/tests/Visual/Success.php index 70d11a52..d327beb5 100644 --- a/tests/Visual/Success.php +++ b/tests/Visual/Success.php @@ -9,7 +9,7 @@ test('visual snapshot of test suite on success', function () { ]); $output = function () use ($testsPath) { - $process = (new Symfony\Component\Process\Process(['./bin/pest'], dirname($testsPath), ['EXCLUDE' => 'integration', 'REBUILD_SNAPSHOTS' => false])); + $process = (new Symfony\Component\Process\Process(['php', 'bin/pest'], dirname($testsPath), ['EXCLUDE' => 'integration', 'REBUILD_SNAPSHOTS' => false])); $process->run(); From 24f85354e28ddf27f00ee23be8afc306a2ecc41b Mon Sep 17 00:00:00 2001 From: Alex Rock Ancelet Date: Sat, 30 May 2020 00:11:26 +0200 Subject: [PATCH 04/24] Normalize Windows dir name in TestCaseFactory --- src/Factories/TestCaseFactory.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Factories/TestCaseFactory.php b/src/Factories/TestCaseFactory.php index e36613ab..3f6e4f0d 100644 --- a/src/Factories/TestCaseFactory.php +++ b/src/Factories/TestCaseFactory.php @@ -158,10 +158,18 @@ final class TestCaseFactory */ public function makeClassFromFilename(string $filename): string { + if ('\\' === DIRECTORY_SEPARATOR) { + // In case Windows, strtolower drive name, like in UsesCall. + $filename = (string) preg_replace_callback('~^(?P[a-z]+:\\\)~i', function ($match): string { + return strtolower($match['drive']); + }, $filename); + } + $rootPath = TestSuite::getInstance()->rootPath; $relativePath = str_replace($rootPath . DIRECTORY_SEPARATOR, '', $filename); // Strip out any %-encoded octets. $relativePath = (string) preg_replace('|%[a-fA-F0-9][a-fA-F0-9]|', '', $relativePath); + $relativePath = str_replace('\\', '/', $relativePath); // Limit to A-Z, a-z, 0-9, '_', '-'. $relativePath = (string) preg_replace('/[^A-Za-z0-9.\/]/', '', $relativePath); From 926d8ecb8db5c2adeb8ec49d622404bf1bf990dd Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Tue, 2 Jun 2020 17:11:30 +0200 Subject: [PATCH 05/24] Call binary as php sub process --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index f832fda5..af259d39 100644 --- a/composer.json +++ b/composer.json @@ -67,9 +67,9 @@ "lint": "rector process src && php-cs-fixer fix -v", "test:lint": "php-cs-fixer fix -v --dry-run && rector process src --dry-run", "test:types": "phpstan analyse --ansi", - "test:unit": "bin/pest --colors=always --exclude-group=integration", - "test:integration": "bin/pest --colors=always --group=integration", - "test:integration:snapshots": "REBUILD_SNAPSHOTS=true bin/pest --colors=always", + "test:unit": "php bin/pest --colors=always --exclude-group=integration", + "test:integration": "php bin/pest --colors=always --group=integration", + "test:integration:snapshots": "REBUILD_SNAPSHOTS=true php bin/pest --colors=always", "test": [ "@test:lint", "@test:types", From a0b80826315f7457011f01bd1281f597fe5b48f2 Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Tue, 2 Jun 2020 18:01:43 +0200 Subject: [PATCH 06/24] Fix issue with case-insensitive windows paths --- src/Factories/TestCaseFactory.php | 1 + src/TestSuite.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Factories/TestCaseFactory.php b/src/Factories/TestCaseFactory.php index 3f6e4f0d..05859fdd 100644 --- a/src/Factories/TestCaseFactory.php +++ b/src/Factories/TestCaseFactory.php @@ -165,6 +165,7 @@ final class TestCaseFactory }, $filename); } + $filename = realpath($filename); $rootPath = TestSuite::getInstance()->rootPath; $relativePath = str_replace($rootPath . DIRECTORY_SEPARATOR, '', $filename); // Strip out any %-encoded octets. diff --git a/src/TestSuite.php b/src/TestSuite.php index 2d2bbfd8..e3d9f772 100644 --- a/src/TestSuite.php +++ b/src/TestSuite.php @@ -83,7 +83,7 @@ final class TestSuite $this->afterEach = new AfterEachRepository(); $this->afterAll = new AfterAllRepository(); - $this->rootPath = $rootPath; + $this->rootPath = realpath($rootPath); } /** From f6859eeb3b39ffebc2aa2cf2d95112db7e0cead4 Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Tue, 2 Jun 2020 18:25:29 +0200 Subject: [PATCH 07/24] Launch pest as php subprocess --- tests/Visual/SingleTestOrDirectory.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Visual/SingleTestOrDirectory.php b/tests/Visual/SingleTestOrDirectory.php index b2200ed8..5cf1e6f3 100644 --- a/tests/Visual/SingleTestOrDirectory.php +++ b/tests/Visual/SingleTestOrDirectory.php @@ -33,6 +33,7 @@ EOF, $run('tests/Fixtures')); it('has ascii chars (decorated printer)', function () { $process = new Process([ + 'php', './bin/pest', 'tests/Fixtures/DirectoryWithTests/ExampleTest.php', ], dirname(__DIR__, 2)); @@ -49,6 +50,7 @@ EOF, $output); it('disable decorating printer when colors is set to never', function () { $process = new Process([ + 'php', './bin/pest', '--colors=never', 'tests/Fixtures/DirectoryWithTests/ExampleTest.php', From c05df43217936429cb5d0d4db58c7dc79c5e2ada Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Tue, 2 Jun 2020 18:29:50 +0200 Subject: [PATCH 08/24] Compare lines without involving linebreaks Fixes tests failing under Windows environments for any linebreak character differences --- .../DirectoryWithTests/ExampleTest.php | 2 +- tests/Fixtures/ExampleTest.php | 2 +- tests/Visual/SingleTestOrDirectory.php | 43 +++++++------------ 3 files changed, 18 insertions(+), 29 deletions(-) diff --git a/tests/Fixtures/DirectoryWithTests/ExampleTest.php b/tests/Fixtures/DirectoryWithTests/ExampleTest.php index 8553ad34..81ce02ff 100644 --- a/tests/Fixtures/DirectoryWithTests/ExampleTest.php +++ b/tests/Fixtures/DirectoryWithTests/ExampleTest.php @@ -1,3 +1,3 @@ assertTrue(true); +it('example 1')->assertTrue(true); diff --git a/tests/Fixtures/ExampleTest.php b/tests/Fixtures/ExampleTest.php index 8553ad34..a2704020 100644 --- a/tests/Fixtures/ExampleTest.php +++ b/tests/Fixtures/ExampleTest.php @@ -1,3 +1,3 @@ assertTrue(true); +it('example 2')->assertTrue(true); diff --git a/tests/Visual/SingleTestOrDirectory.php b/tests/Visual/SingleTestOrDirectory.php index 5cf1e6f3..40ab399c 100644 --- a/tests/Visual/SingleTestOrDirectory.php +++ b/tests/Visual/SingleTestOrDirectory.php @@ -11,24 +11,19 @@ $run = function (string $target) { }; test('allows to run a single test', function () use ($run) { - assertStringContainsString(<<run(); $output = $process->getOutput(); - assertStringContainsString(<<run(); $output = $process->getOutput(); - assertStringContainsString(<< Date: Tue, 2 Jun 2020 18:33:53 +0200 Subject: [PATCH 09/24] in() does not handle absolute paths under Windows This fixes plugins to be included incorrectly under Windows --- src/PendingObjects/UsesCall.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PendingObjects/UsesCall.php b/src/PendingObjects/UsesCall.php index 56205be8..4523dab5 100644 --- a/src/PendingObjects/UsesCall.php +++ b/src/PendingObjects/UsesCall.php @@ -61,7 +61,7 @@ final class UsesCall $targets = array_map(function ($path): string { $startChar = DIRECTORY_SEPARATOR; - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === DIRECTORY_SEPARATOR || preg_match('~\A[A-Z]:(?![^/\\\\])~i', $path) > 0) { $path = (string) preg_replace_callback('~^(?P[a-z]+:\\\)~i', function ($match): string { return strtolower($match['drive']); }, $path); From 8a42d405069d2abc3ee0dcb3d856250dc1d223ac Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Tue, 2 Jun 2020 18:58:16 +0200 Subject: [PATCH 10/24] traits from Autoload.php not loading on Windows Windows requires realpath() so the case of the paths and filenames are always identical --- src/PendingObjects/UsesCall.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PendingObjects/UsesCall.php b/src/PendingObjects/UsesCall.php index 4523dab5..142c14a3 100644 --- a/src/PendingObjects/UsesCall.php +++ b/src/PendingObjects/UsesCall.php @@ -83,7 +83,7 @@ final class UsesCall throw new InvalidUsesPath($target . "\n"); } - return $target; + return realpath($target); }, $targets); } From 0d198f589d2482b8d57ce2a7ecf3fe2fa1d9f090 Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Tue, 2 Jun 2020 19:30:25 +0200 Subject: [PATCH 11/24] Fix changes in success snapshot --- tests/.snapshots/success.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index e34ef134..1231d8a8 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -81,10 +81,10 @@ ✓ higher order message test PASS Tests\Fixtures\DirectoryWithTests\ExampleTest - ✓ it example + ✓ it example 1 PASS Tests\Fixtures\ExampleTest - ✓ it example + ✓ it example 2 PASS Tests\PHPUnit\CustomTestCase\UsesPerDirectory ✓ closure was bound to custom test case From fe11140fc24e2cdb6039ce652b019d7477fc5ee0 Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Tue, 2 Jun 2020 19:43:06 +0200 Subject: [PATCH 12/24] Adding dom extension to CI --- .github/workflows/formats.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/formats.yml b/.github/workflows/formats.yml index f3598b3b..bbdd5771 100644 --- a/.github/workflows/formats.yml +++ b/.github/workflows/formats.yml @@ -30,7 +30,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: mbstring, zip + extensions: dom, mbstring, zip tools: prestissimo coverage: pcov diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 10188221..8c600d9d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,7 +29,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: mbstring, zip + extensions: dom, mbstring, zip coverage: none - name: Install Composer dependencies From d35320c6971deaf7e2ba477b08b44b3b3e2f4114 Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Fri, 5 Jun 2020 17:25:53 +0200 Subject: [PATCH 13/24] Compare filename correctly on all OS --- src/Support/Backtrace.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Support/Backtrace.php b/src/Support/Backtrace.php index 0347932f..0e87e849 100644 --- a/src/Support/Backtrace.php +++ b/src/Support/Backtrace.php @@ -24,7 +24,7 @@ final class Backtrace $current = null; foreach (debug_backtrace() as $trace) { - if (Str::endsWith($trace[self::FILE], 'vendor/phpunit/phpunit/src/Util/FileLoader.php')) { + if (Str::endsWith($trace[self::FILE], realpath('vendor/phpunit/phpunit/src/Util/FileLoader.php'))) { break; } From 6e18912ea6f1083cf9c9e361ce6d3ab97c28c7b3 Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Fri, 5 Jun 2020 17:38:59 +0200 Subject: [PATCH 14/24] Test to check if the full test path is shown --- tests/Visual/SingleTestOrDirectory.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/Visual/SingleTestOrDirectory.php b/tests/Visual/SingleTestOrDirectory.php index 40ab399c..6298f98e 100644 --- a/tests/Visual/SingleTestOrDirectory.php +++ b/tests/Visual/SingleTestOrDirectory.php @@ -10,6 +10,11 @@ $run = function (string $target) { return preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput()); }; +test('output contains full test path', function() use ($run) { + $output = $run('tests/Fixtures/DirectoryWithTests/ExampleTest.php'); + assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output); +}); + test('allows to run a single test', function () use ($run) { $output = $run('tests/Fixtures/DirectoryWithTests/ExampleTest.php'); assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output); From dff9bbc1349b8600cd93d48fad7b36266020a06e Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Fri, 5 Jun 2020 18:24:03 +0200 Subject: [PATCH 15/24] Fix file paths not being used properly basename() will strip full path information on some systems. What is needed is to use both dirname() & basename() on paths, as recognized by all systems, and only afterwards do any replacements. --- src/Factories/TestCaseFactory.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Factories/TestCaseFactory.php b/src/Factories/TestCaseFactory.php index 05859fdd..022c0d1a 100644 --- a/src/Factories/TestCaseFactory.php +++ b/src/Factories/TestCaseFactory.php @@ -165,18 +165,18 @@ final class TestCaseFactory }, $filename); } - $filename = realpath($filename); + $filename = realpath($filename); $rootPath = TestSuite::getInstance()->rootPath; $relativePath = str_replace($rootPath . DIRECTORY_SEPARATOR, '', $filename); + $relativePath = dirname(ucfirst($relativePath)) . DIRECTORY_SEPARATOR . basename($relativePath, '.php'); + $relativePath = str_replace(DIRECTORY_SEPARATOR, '\\', $relativePath); + // Strip out any %-encoded octets. $relativePath = (string) preg_replace('|%[a-fA-F0-9][a-fA-F0-9]|', '', $relativePath); - $relativePath = str_replace('\\', '/', $relativePath); - // Limit to A-Z, a-z, 0-9, '_', '-'. - $relativePath = (string) preg_replace('/[^A-Za-z0-9.\/]/', '', $relativePath); - - $classFQN = 'P\\' . basename(ucfirst(str_replace(DIRECTORY_SEPARATOR, '\\', $relativePath)), '.php'); + $relativePath = (string) preg_replace('/[^A-Za-z0-9.\\\]/', '', $relativePath); + $classFQN = 'P\\' . $relativePath; if (class_exists($classFQN)) { return $classFQN; } From ffa3f1d6836e586d7fbd8be3a92d7cc3f0f54cdc Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Fri, 5 Jun 2020 18:26:52 +0200 Subject: [PATCH 16/24] Skip visual snapshot test on Windows --- tests/Visual/Success.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Visual/Success.php b/tests/Visual/Success.php index d327beb5..f8678973 100644 --- a/tests/Visual/Success.php +++ b/tests/Visual/Success.php @@ -24,4 +24,5 @@ test('visual snapshot of test suite on success', function () { array_pop($output); assertStringContainsString(implode("\n", $output), file_get_contents($snapshot)); } -})->skip(!getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE')); +})->skip(!getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE')) + ->skip(PHP_OS_FAMILY === 'Windows', 'File sorting algorithm causes different test order on Windows'); From 38584bec935a74886a989538478aa78b7a07a90d Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Fri, 5 Jun 2020 18:29:57 +0200 Subject: [PATCH 17/24] Updating success.txt snapshot --- tests/.snapshots/success.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 1231d8a8..eb00d006 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -126,6 +126,7 @@ ✓ it does not allow to add the same test description twice PASS Tests\Visual\SingleTestOrDirectory + ✓ output contains full test path ✓ allows to run a single test ✓ allows to run a directory ✓ it has ascii chars (decorated printer) @@ -134,5 +135,5 @@ WARN Tests\Visual\Success s visual snapshot of test suite on success - Tests: 6 skipped, 71 passed + Tests: 6 skipped, 72 passed Time: 2.89s From d24830121e1efea2e3e5ccda9f3dc89ab3b6d007 Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Fri, 5 Jun 2020 19:24:56 +0200 Subject: [PATCH 18/24] Reverting changes from c05df432 --- tests/.snapshots/success.txt | 3 +- tests/Visual/SingleTestOrDirectory.php | 48 +++++++++++++++----------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index eb00d006..1231d8a8 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -126,7 +126,6 @@ ✓ it does not allow to add the same test description twice PASS Tests\Visual\SingleTestOrDirectory - ✓ output contains full test path ✓ allows to run a single test ✓ allows to run a directory ✓ it has ascii chars (decorated printer) @@ -135,5 +134,5 @@ WARN Tests\Visual\Success s visual snapshot of test suite on success - Tests: 6 skipped, 72 passed + Tests: 6 skipped, 71 passed Time: 2.89s diff --git a/tests/Visual/SingleTestOrDirectory.php b/tests/Visual/SingleTestOrDirectory.php index 6298f98e..8f287ddd 100644 --- a/tests/Visual/SingleTestOrDirectory.php +++ b/tests/Visual/SingleTestOrDirectory.php @@ -10,25 +10,25 @@ $run = function (string $target) { return preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput()); }; -test('output contains full test path', function() use ($run) { - $output = $run('tests/Fixtures/DirectoryWithTests/ExampleTest.php'); - assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output); -}); - test('allows to run a single test', function () use ($run) { - $output = $run('tests/Fixtures/DirectoryWithTests/ExampleTest.php'); - assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output); - assertStringContainsString(' ✓ it example 1', $output); - assertStringContainsString(' Tests: 1 passed', $output); + assertStringContainsString(<<run(); $output = $process->getOutput(); - assertStringContainsString(" \e[30;42;1m PASS \e[39;49;22m\e[39m Tests\Fixtures\DirectoryWithTests\ExampleTest\e[39m", $output); - assertStringContainsString(" \e[32;1m✓\e[39;22m\e[39m \e[2mit example 1\e[22m\e[39m", $output); - assertStringContainsString(" \e[37;1mTests: \e[39;22m\e[32;1m1 passed\e[39;22m", $output); + assertStringContainsString(<<run(); $output = $process->getOutput(); - assertStringContainsString(' PASS Tests\Fixtures\DirectoryWithTests\ExampleTest', $output); - assertStringContainsString(" ✓ \e[2mit example 1\e[22m", $output); - assertStringContainsString(' Tests: 1 passed', $output); + assertStringContainsString(<< Date: Fri, 5 Jun 2020 19:29:43 +0200 Subject: [PATCH 19/24] // missing change --- tests/Visual/SingleTestOrDirectory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Visual/SingleTestOrDirectory.php b/tests/Visual/SingleTestOrDirectory.php index 8f287ddd..cefb4a7e 100644 --- a/tests/Visual/SingleTestOrDirectory.php +++ b/tests/Visual/SingleTestOrDirectory.php @@ -42,7 +42,7 @@ it('has ascii chars (decorated printer)', function () { $output = $process->getOutput(); assertStringContainsString(<< Date: Fri, 5 Jun 2020 19:30:35 +0200 Subject: [PATCH 20/24] // unnecessary linebreak --- src/PendingObjects/UsesCall.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PendingObjects/UsesCall.php b/src/PendingObjects/UsesCall.php index 142c14a3..52d81b74 100644 --- a/src/PendingObjects/UsesCall.php +++ b/src/PendingObjects/UsesCall.php @@ -80,7 +80,7 @@ final class UsesCall $this->targets = array_map(function ($target): string { $isValid = is_dir($target) || file_exists($target); if (!$isValid) { - throw new InvalidUsesPath($target . "\n"); + throw new InvalidUsesPath($target); } return realpath($target); From 40a5d067eca4a7ab78f4701b12c22e590fd02858 Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Fri, 5 Jun 2020 19:35:13 +0200 Subject: [PATCH 21/24] // fixing type checks --- src/Factories/TestCaseFactory.php | 2 +- src/PendingObjects/UsesCall.php | 2 +- src/Support/Backtrace.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Factories/TestCaseFactory.php b/src/Factories/TestCaseFactory.php index 022c0d1a..49c6eaad 100644 --- a/src/Factories/TestCaseFactory.php +++ b/src/Factories/TestCaseFactory.php @@ -165,7 +165,7 @@ final class TestCaseFactory }, $filename); } - $filename = realpath($filename); + $filename = (string) realpath($filename); $rootPath = TestSuite::getInstance()->rootPath; $relativePath = str_replace($rootPath . DIRECTORY_SEPARATOR, '', $filename); $relativePath = dirname(ucfirst($relativePath)) . DIRECTORY_SEPARATOR . basename($relativePath, '.php'); diff --git a/src/PendingObjects/UsesCall.php b/src/PendingObjects/UsesCall.php index 52d81b74..f9418fd5 100644 --- a/src/PendingObjects/UsesCall.php +++ b/src/PendingObjects/UsesCall.php @@ -83,7 +83,7 @@ final class UsesCall throw new InvalidUsesPath($target); } - return realpath($target); + return (string) realpath($target); }, $targets); } diff --git a/src/Support/Backtrace.php b/src/Support/Backtrace.php index 0e87e849..cf90ab03 100644 --- a/src/Support/Backtrace.php +++ b/src/Support/Backtrace.php @@ -24,7 +24,7 @@ final class Backtrace $current = null; foreach (debug_backtrace() as $trace) { - if (Str::endsWith($trace[self::FILE], realpath('vendor/phpunit/phpunit/src/Util/FileLoader.php'))) { + if (Str::endsWith($trace[self::FILE], (string) realpath('vendor/phpunit/phpunit/src/Util/FileLoader.php'))) { break; } From b93cd724c1bcadcebf68f7648a820902fcc00eff Mon Sep 17 00:00:00 2001 From: Dimitrios Karvounaris Date: Fri, 5 Jun 2020 19:37:53 +0200 Subject: [PATCH 22/24] // tiny fix --- tests/Visual/SingleTestOrDirectory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Visual/SingleTestOrDirectory.php b/tests/Visual/SingleTestOrDirectory.php index cefb4a7e..10ea1c1b 100644 --- a/tests/Visual/SingleTestOrDirectory.php +++ b/tests/Visual/SingleTestOrDirectory.php @@ -60,7 +60,7 @@ it('disable decorating printer when colors is set to never', function () { assertStringContainsString(<< Date: Fri, 5 Jun 2020 19:42:07 +0200 Subject: [PATCH 23/24] // fixing once more, wrong code pasted :( --- tests/Visual/SingleTestOrDirectory.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Visual/SingleTestOrDirectory.php b/tests/Visual/SingleTestOrDirectory.php index 10ea1c1b..52ccf3e6 100644 --- a/tests/Visual/SingleTestOrDirectory.php +++ b/tests/Visual/SingleTestOrDirectory.php @@ -59,9 +59,9 @@ it('disable decorating printer when colors is set to never', function () { $output = $process->getOutput(); assertStringContainsString(<< Date: Fri, 5 Jun 2020 19:45:58 +0200 Subject: [PATCH 24/24] // fixing type check --- src/TestSuite.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TestSuite.php b/src/TestSuite.php index e3d9f772..b9c232b2 100644 --- a/src/TestSuite.php +++ b/src/TestSuite.php @@ -83,7 +83,7 @@ final class TestSuite $this->afterEach = new AfterEachRepository(); $this->afterAll = new AfterAllRepository(); - $this->rootPath = realpath($rootPath); + $this->rootPath = (string) realpath($rootPath); } /**