From dd643faa5cf513154b9039a336ed4345587fd924 Mon Sep 17 00:00:00 2001 From: Fabio Ivona Date: Wed, 22 Sep 2021 10:17:44 +0200 Subject: [PATCH 1/8] adds a new --ci option to pest binary --- bin/pest | 7 ++++--- src/Repositories/TestRepository.php | 4 ++++ src/TestSuite.php | 10 +++++++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/bin/pest b/bin/pest index 2735abfc..d34ddad6 100755 --- a/bin/pest +++ b/bin/pest @@ -31,7 +31,8 @@ use Symfony\Component\Console\Output\OutputInterface; $rootPath = dirname($autoloadPath, 2); $argv = new ArgvInput(); - $testSuite = TestSuite::getInstance($rootPath, $argv->getParameterOption('--test-directory', 'tests')); + $workingEnv = $argv->hasParameterOption('--ci') ? 'ci' : 'local'; + $testSuite = TestSuite::getInstance($rootPath, $argv->getParameterOption('--test-directory', 'tests'), $workingEnv); $isDecorated = $argv->getParameterOption('--colors', 'always') !== 'never'; $output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, $isDecorated); @@ -45,9 +46,9 @@ use Symfony\Component\Console\Output\OutputInterface; $args = $_SERVER['argv']; // Let's remove any arguments that PHPUnit does not understand - if ($argv->hasParameterOption('--test-directory')) { + if ($argv->hasParameterOption(['--test-directory', '--ci'])) { foreach ($args as $key => $value) { - if (strpos($value, '--test-directory') !== false) { + if (strpos($value, '--test-directory') !== false || strpos($value, '--ci') !== false) { unset($args[$key]); } } diff --git a/src/Repositories/TestRepository.php b/src/Repositories/TestRepository.php index e522677a..502b9fd1 100644 --- a/src/Repositories/TestRepository.php +++ b/src/Repositories/TestRepository.php @@ -119,6 +119,10 @@ final class TestRepository */ private function testsUsingOnly(): array { + if (TestSuite::getInstance()->workingEnv === 'ci') { + return []; + } + return array_filter($this->state, function ($testFactory): bool { return $testFactory->only; }); diff --git a/src/TestSuite.php b/src/TestSuite.php index f2b5ccde..d91395d3 100644 --- a/src/TestSuite.php +++ b/src/TestSuite.php @@ -73,6 +73,13 @@ final class TestSuite */ public $testPath; + /** + * Holds the current working environment identifier. + * + * @var string + */ + public $workingEnv; + /** * Holds an instance of the test suite. * @@ -98,10 +105,11 @@ final class TestSuite /** * Returns the current instance of the test suite. */ - public static function getInstance(string $rootPath = null, string $testPath = null): TestSuite + public static function getInstance(string $rootPath = null, string $testPath = null, string $workingEnv = null): TestSuite { if (is_string($rootPath) && is_string($testPath)) { self::$instance = new TestSuite($rootPath, $testPath); + self::$instance->workingEnv = $workingEnv; foreach (Plugin::$callables as $callable) { $callable(); From b22f5e0c85f422f9afe23dbf64d7fee005f89553 Mon Sep 17 00:00:00 2001 From: Fabio Ivona Date: Wed, 22 Sep 2021 10:38:21 +0200 Subject: [PATCH 2/8] adds test for CI env runs --- tests/.snapshots/success.txt | 3 ++- tests/Unit/TestSuite.php | 21 +++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 4442bbb9..686d701e 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -648,6 +648,7 @@ ✓ it alerts users about tests with arguments but no input ✓ it can return an array of all test suite filenames ✓ it can filter the test suite filenames to those with the only method + ✓ it does not filter the test suite filenames to those with the only method when working in CI pipeline PASS Tests\Visual\Help ✓ visual snapshot of help command output @@ -681,5 +682,5 @@ ✓ it is a test ✓ it uses correct parent class - Tests: 4 incompleted, 9 skipped, 447 passed + Tests: 4 incompleted, 9 skipped, 448 passed \ No newline at end of file diff --git a/tests/Unit/TestSuite.php b/tests/Unit/TestSuite.php index 7d6c88a9..383506a3 100644 --- a/tests/Unit/TestSuite.php +++ b/tests/Unit/TestSuite.php @@ -24,7 +24,7 @@ it('alerts users about tests with arguments but no input', function () { ); it('can return an array of all test suite filenames', function () { - $testSuite = new TestSuite(getcwd(), 'tests'); + $testSuite = TestSuite::getInstance(getcwd(), 'tests'); $test = function () {}; $testSuite->tests->set(new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test)); $testSuite->tests->set(new \Pest\Factories\TestCaseFactory(__FILE__, 'bar', $test)); @@ -36,7 +36,7 @@ it('can return an array of all test suite filenames', function () { }); it('can filter the test suite filenames to those with the only method', function () { - $testSuite = new TestSuite(getcwd(), 'tests'); + $testSuite = TestSuite::getInstance(getcwd(), 'tests'); $test = function () {}; $testWithOnly = new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test); @@ -49,3 +49,20 @@ it('can filter the test suite filenames to those with the only method', function __FILE__, ]); }); + +it('does not filter the test suite filenames to those with the only method when working in CI pipeline', function(){ + $testSuite = TestSuite::getInstance(getcwd(), 'tests', 'ci'); + + $test = function () {}; + + $testWithOnly = new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test); + $testWithOnly->only = true; + $testSuite->tests->set($testWithOnly); + + $testSuite->tests->set(new \Pest\Factories\TestCaseFactory('Baz/Bar/Boo.php', 'bar', $test)); + + expect($testSuite->tests->getFilenames())->toEqual([ + __FILE__, + 'Baz/Bar/Boo.php', + ]); +}); From 1bde49b3c46ff8460310527636a41de63816f7f7 Mon Sep 17 00:00:00 2001 From: Fabio Ivona Date: Wed, 22 Sep 2021 11:00:41 +0200 Subject: [PATCH 3/8] types fix --- src/TestSuite.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TestSuite.php b/src/TestSuite.php index d91395d3..d25dfe23 100644 --- a/src/TestSuite.php +++ b/src/TestSuite.php @@ -100,6 +100,7 @@ final class TestSuite $this->rootPath = (string) realpath($rootPath); $this->testPath = $testPath; + $this->workingEnv = 'local'; } /** @@ -109,7 +110,7 @@ final class TestSuite { if (is_string($rootPath) && is_string($testPath)) { self::$instance = new TestSuite($rootPath, $testPath); - self::$instance->workingEnv = $workingEnv; + self::$instance->workingEnv = $workingEnv ?? 'local'; foreach (Plugin::$callables as $callable) { $callable(); From 05c1c82ae2e3042e8d5a9423cad66bd6f79cac51 Mon Sep 17 00:00:00 2001 From: Fabio Ivona Date: Wed, 22 Sep 2021 11:05:04 +0200 Subject: [PATCH 4/8] lint --- src/TestSuite.php | 6 +++--- tests/Unit/TestSuite.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/TestSuite.php b/src/TestSuite.php index d25dfe23..252d40be 100644 --- a/src/TestSuite.php +++ b/src/TestSuite.php @@ -98,8 +98,8 @@ final class TestSuite $this->afterEach = new AfterEachRepository(); $this->afterAll = new AfterAllRepository(); - $this->rootPath = (string) realpath($rootPath); - $this->testPath = $testPath; + $this->rootPath = (string) realpath($rootPath); + $this->testPath = $testPath; $this->workingEnv = 'local'; } @@ -109,7 +109,7 @@ final class TestSuite public static function getInstance(string $rootPath = null, string $testPath = null, string $workingEnv = null): TestSuite { if (is_string($rootPath) && is_string($testPath)) { - self::$instance = new TestSuite($rootPath, $testPath); + self::$instance = new TestSuite($rootPath, $testPath); self::$instance->workingEnv = $workingEnv ?? 'local'; foreach (Plugin::$callables as $callable) { diff --git a/tests/Unit/TestSuite.php b/tests/Unit/TestSuite.php index 383506a3..15c3848f 100644 --- a/tests/Unit/TestSuite.php +++ b/tests/Unit/TestSuite.php @@ -50,7 +50,7 @@ it('can filter the test suite filenames to those with the only method', function ]); }); -it('does not filter the test suite filenames to those with the only method when working in CI pipeline', function(){ +it('does not filter the test suite filenames to those with the only method when working in CI pipeline', function () { $testSuite = TestSuite::getInstance(getcwd(), 'tests', 'ci'); $test = function () {}; From 601c4b01fcc9f19ec1fa8ecc29a10dcda3fe8b0d Mon Sep 17 00:00:00 2001 From: Fabio Ivona Date: Wed, 22 Sep 2021 14:53:16 +0200 Subject: [PATCH 5/8] refactors to use a Plugin to parse --ci option --- bin/pest | 7 ++--- composer.json | 3 +- src/Plugins/Context.php | 47 +++++++++++++++++++++++++++++ src/Repositories/TestRepository.php | 3 +- src/TestSuite.php | 13 ++------ tests/.snapshots/success.txt | 6 +++- tests/Unit/Plugins/Context.php | 23 ++++++++++++++ tests/Unit/TestSuite.php | 26 ++++++++++------ 8 files changed, 100 insertions(+), 28 deletions(-) create mode 100644 src/Plugins/Context.php create mode 100644 tests/Unit/Plugins/Context.php diff --git a/bin/pest b/bin/pest index d34ddad6..2735abfc 100755 --- a/bin/pest +++ b/bin/pest @@ -31,8 +31,7 @@ use Symfony\Component\Console\Output\OutputInterface; $rootPath = dirname($autoloadPath, 2); $argv = new ArgvInput(); - $workingEnv = $argv->hasParameterOption('--ci') ? 'ci' : 'local'; - $testSuite = TestSuite::getInstance($rootPath, $argv->getParameterOption('--test-directory', 'tests'), $workingEnv); + $testSuite = TestSuite::getInstance($rootPath, $argv->getParameterOption('--test-directory', 'tests')); $isDecorated = $argv->getParameterOption('--colors', 'always') !== 'never'; $output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, $isDecorated); @@ -46,9 +45,9 @@ use Symfony\Component\Console\Output\OutputInterface; $args = $_SERVER['argv']; // Let's remove any arguments that PHPUnit does not understand - if ($argv->hasParameterOption(['--test-directory', '--ci'])) { + if ($argv->hasParameterOption('--test-directory')) { foreach ($args as $key => $value) { - if (strpos($value, '--test-directory') !== false || strpos($value, '--ci') !== false) { + if (strpos($value, '--test-directory') !== false) { unset($args[$key]); } } diff --git a/composer.json b/composer.json index d9ac0d22..cf6b5b79 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,8 @@ "plugins": [ "Pest\\Plugins\\Coverage", "Pest\\Plugins\\Init", - "Pest\\Plugins\\Version" + "Pest\\Plugins\\Version", + "Pest\\Plugins\\Context" ] }, "laravel": { diff --git a/src/Plugins/Context.php b/src/Plugins/Context.php new file mode 100644 index 00000000..f7bafbe5 --- /dev/null +++ b/src/Plugins/Context.php @@ -0,0 +1,47 @@ + $argument) { + if ($argument === '--ci') { + unset($arguments[$index]); + self::getInstance()->env = 'ci'; + } + } + + return array_values($arguments); + } +} diff --git a/src/Repositories/TestRepository.php b/src/Repositories/TestRepository.php index 502b9fd1..f10012a9 100644 --- a/src/Repositories/TestRepository.php +++ b/src/Repositories/TestRepository.php @@ -11,6 +11,7 @@ use Pest\Exceptions\TestAlreadyExist; use Pest\Exceptions\TestCaseAlreadyInUse; use Pest\Exceptions\TestCaseClassOrTraitNotFound; use Pest\Factories\TestCaseFactory; +use Pest\Plugins\Context; use Pest\Support\Reflection; use Pest\Support\Str; use Pest\TestSuite; @@ -119,7 +120,7 @@ final class TestRepository */ private function testsUsingOnly(): array { - if (TestSuite::getInstance()->workingEnv === 'ci') { + if (Context::getInstance()->env === Context::ENV_CI) { return []; } diff --git a/src/TestSuite.php b/src/TestSuite.php index 252d40be..dc2c5a5a 100644 --- a/src/TestSuite.php +++ b/src/TestSuite.php @@ -73,13 +73,6 @@ final class TestSuite */ public $testPath; - /** - * Holds the current working environment identifier. - * - * @var string - */ - public $workingEnv; - /** * Holds an instance of the test suite. * @@ -100,17 +93,15 @@ final class TestSuite $this->rootPath = (string) realpath($rootPath); $this->testPath = $testPath; - $this->workingEnv = 'local'; } /** * Returns the current instance of the test suite. */ - public static function getInstance(string $rootPath = null, string $testPath = null, string $workingEnv = null): TestSuite + public static function getInstance(string $rootPath = null, string $testPath = null): TestSuite { if (is_string($rootPath) && is_string($testPath)) { - self::$instance = new TestSuite($rootPath, $testPath); - self::$instance->workingEnv = $workingEnv ?? 'local'; + self::$instance = new TestSuite($rootPath, $testPath); foreach (Plugin::$callables as $callable) { $callable(); diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 686d701e..d7a866b9 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -623,6 +623,10 @@ ✓ it show the actual dataset of multiple non-named datasets in their description ✓ it show the correct description for mixed named and not-named datasets + PASS Tests\Unit\Plugins\Context + ✓ environment is set to CI when --ci option is used + ✓ environment is set to Local when --ci option is not used + PASS Tests\Unit\Plugins\Version ✓ it outputs the version when --version is used ✓ it do not outputs version when --version is not used @@ -682,5 +686,5 @@ ✓ it is a test ✓ it uses correct parent class - Tests: 4 incompleted, 9 skipped, 448 passed + Tests: 4 incompleted, 9 skipped, 450 passed \ No newline at end of file diff --git a/tests/Unit/Plugins/Context.php b/tests/Unit/Plugins/Context.php new file mode 100644 index 00000000..13f2f783 --- /dev/null +++ b/tests/Unit/Plugins/Context.php @@ -0,0 +1,23 @@ +env; + + $plugin = new Context(); + + $plugin->handleArguments(['foo', '--ci', 'bar']); + + expect(Context::getInstance()->env)->toBe(Context::ENV_CI); + + Context::getInstance()->env = $old_env; +}); + +test('environment is set to Local when --ci option is not used', function () { + $plugin = new Context(); + + $plugin->handleArguments(['foo', 'bar', 'baz']); + + expect(Context::getInstance()->env)->toBe(Context::ENV_LOCAL); +}); diff --git a/tests/Unit/TestSuite.php b/tests/Unit/TestSuite.php index 15c3848f..7e58f93d 100644 --- a/tests/Unit/TestSuite.php +++ b/tests/Unit/TestSuite.php @@ -2,13 +2,15 @@ use Pest\Exceptions\DatasetMissing; use Pest\Exceptions\TestAlreadyExist; +use Pest\Factories\TestCaseFactory; +use Pest\Plugins\Context; use Pest\TestSuite; it('does not allow to add the same test description twice', function () { $testSuite = new TestSuite(getcwd(), 'tests'); $test = function () {}; - $testSuite->tests->set(new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test)); - $testSuite->tests->set(new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test)); + $testSuite->tests->set(new TestCaseFactory(__FILE__, 'foo', $test)); + $testSuite->tests->set(new TestCaseFactory(__FILE__, 'foo', $test)); })->throws( TestAlreadyExist::class, sprintf('A test with the description `%s` already exist in the filename `%s`.', 'foo', __FILE__), @@ -17,7 +19,7 @@ it('does not allow to add the same test description twice', function () { it('alerts users about tests with arguments but no input', function () { $testSuite = new TestSuite(getcwd(), 'tests'); $test = function (int $arg) {}; - $testSuite->tests->set(new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test)); + $testSuite->tests->set(new TestCaseFactory(__FILE__, 'foo', $test)); })->throws( DatasetMissing::class, sprintf("A test with the description '%s' has %d argument(s) ([%s]) and no dataset(s) provided in %s", 'foo', 1, 'int $arg', __FILE__), @@ -26,8 +28,8 @@ it('alerts users about tests with arguments but no input', function () { it('can return an array of all test suite filenames', function () { $testSuite = TestSuite::getInstance(getcwd(), 'tests'); $test = function () {}; - $testSuite->tests->set(new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test)); - $testSuite->tests->set(new \Pest\Factories\TestCaseFactory(__FILE__, 'bar', $test)); + $testSuite->tests->set(new TestCaseFactory(__FILE__, 'foo', $test)); + $testSuite->tests->set(new TestCaseFactory(__FILE__, 'bar', $test)); expect($testSuite->tests->getFilenames())->toEqual([ __FILE__, @@ -39,11 +41,11 @@ it('can filter the test suite filenames to those with the only method', function $testSuite = TestSuite::getInstance(getcwd(), 'tests'); $test = function () {}; - $testWithOnly = new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test); + $testWithOnly = new TestCaseFactory(__FILE__, 'foo', $test); $testWithOnly->only = true; $testSuite->tests->set($testWithOnly); - $testSuite->tests->set(new \Pest\Factories\TestCaseFactory('Baz/Bar/Boo.php', 'bar', $test)); + $testSuite->tests->set(new TestCaseFactory('Baz/Bar/Boo.php', 'bar', $test)); expect($testSuite->tests->getFilenames())->toEqual([ __FILE__, @@ -51,18 +53,22 @@ it('can filter the test suite filenames to those with the only method', function }); it('does not filter the test suite filenames to those with the only method when working in CI pipeline', function () { - $testSuite = TestSuite::getInstance(getcwd(), 'tests', 'ci'); + $old_env = Context::getInstance()->env; + Context::getInstance()->env = Context::ENV_CI; + $testSuite = TestSuite::getInstance(getcwd(), 'tests'); $test = function () {}; - $testWithOnly = new \Pest\Factories\TestCaseFactory(__FILE__, 'foo', $test); + $testWithOnly = new TestCaseFactory(__FILE__, 'foo', $test); $testWithOnly->only = true; $testSuite->tests->set($testWithOnly); - $testSuite->tests->set(new \Pest\Factories\TestCaseFactory('Baz/Bar/Boo.php', 'bar', $test)); + $testSuite->tests->set(new TestCaseFactory('Baz/Bar/Boo.php', 'bar', $test)); expect($testSuite->tests->getFilenames())->toEqual([ __FILE__, 'Baz/Bar/Boo.php', ]); + + Context::getInstance()->env = $old_env; }); From 0d72b5197c8b5f8c09b81bf942e60537996b7875 Mon Sep 17 00:00:00 2001 From: Fabio Ivona Date: Sat, 25 Sep 2021 08:55:57 +0200 Subject: [PATCH 6/8] merge conflict --- tests/.snapshots/success.txt | 690 ----------------------------------- 1 file changed, 690 deletions(-) delete mode 100644 tests/.snapshots/success.txt diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt deleted file mode 100644 index d7a866b9..00000000 --- a/tests/.snapshots/success.txt +++ /dev/null @@ -1,690 +0,0 @@ - - PASS Tests\CustomTestCase\ExecutedTest - ✓ that gets executed - - PASS Tests\Features\AfterAll - ✓ deletes file after all - - PASS Tests\Features\AfterEach - ✓ it does not get executed before the test - ✓ it gets executed after the test - - PASS Tests\Features\BeforeAll - ✓ it gets executed before tests - ✓ it do not get executed before each test - - PASS Tests\Features\BeforeEach - ✓ it gets executed before each test - ✓ it gets executed before each test once again - - PASS Tests\Features\Coverage - ✓ it has plugin - ✓ it adds coverage if --coverage exist - ✓ it adds coverage if --min exist - ✓ it generates coverage based on file input - - PASS Tests\Features\Datasets - ✓ it throws exception if dataset does not exist - ✓ it throws exception if dataset already exist - ✓ it sets closures - ✓ it sets arrays - ✓ it gets bound to test case object with ('a') - ✓ it gets bound to test case object with ('b') - ✓ it truncates the description with ('FoooFoooFoooFoooFoooFoooFoooF...ooFooo') - ✓ lazy datasets with (1) - ✓ lazy datasets with (2) - ✓ lazy datasets did the job right - ✓ eager datasets with (1) - ✓ eager datasets with (2) - ✓ eager datasets did the job right - ✓ lazy registered datasets with (1) - ✓ lazy registered datasets with (2) - ✓ lazy registered datasets did the job right - ✓ eager registered datasets with (1) - ✓ eager registered datasets with (2) - ✓ eager registered datasets did the job right - ✓ eager wrapped registered datasets with (1) - ✓ eager wrapped registered datasets with (2) - ✓ eager registered wrapped datasets did the job right - ✓ named datasets with data set "one" - ✓ named datasets with data set "two" - ✓ named datasets did the job right - ✓ lazy named datasets with (Bar Object (...)) - ✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #1 - ✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #2 - ✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), false) - ✓ it creates unique test case names with ('Name 2', Pest\Plugin Object (), false) - ✓ it creates unique test case names with ('Name 2', Pest\Plugin Object (), true) - ✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #3 - ✓ it creates unique test case names - count - ✓ lazy multiple datasets with (1) / (3) - ✓ lazy multiple datasets with (1) / (4) - ✓ lazy multiple datasets with (2) / (3) - ✓ lazy multiple datasets with (2) / (4) - ✓ lazy multiple datasets did the job right - ✓ eager multiple datasets with (1) / (3) - ✓ eager multiple datasets with (1) / (4) - ✓ eager multiple datasets with (2) / (3) - ✓ eager multiple datasets with (2) / (4) - ✓ eager multiple datasets did the job right - ✓ lazy registered multiple datasets with (1) / (1) - ✓ lazy registered multiple datasets with (1) / (2) - ✓ lazy registered multiple datasets with (2) / (1) - ✓ lazy registered multiple datasets with (2) / (2) - ✓ lazy registered multiple datasets did the job right - ✓ eager registered multiple datasets with (1) / (1) - ✓ eager registered multiple datasets with (1) / (2) - ✓ eager registered multiple datasets with (2) / (1) - ✓ eager registered multiple datasets with (2) / (2) - ✓ eager registered multiple datasets did the job right - ✓ eager wrapped registered multiple datasets with (1) / (1) - ✓ eager wrapped registered multiple datasets with (1) / (2) - ✓ eager wrapped registered multiple datasets with (2) / (1) - ✓ eager wrapped registered multiple datasets with (2) / (2) - ✓ eager wrapped registered multiple datasets did the job right - ✓ named multiple datasets with data set "one" / data set "three" - ✓ named multiple datasets with data set "one" / data set "four" - ✓ named multiple datasets with data set "two" / data set "three" - ✓ named multiple datasets with data set "two" / data set "four" - ✓ named multiple datasets did the job right - ✓ more than two datasets with (1) / (3) / (5) - ✓ more than two datasets with (1) / (3) / (6) - ✓ more than two datasets with (1) / (4) / (5) - ✓ more than two datasets with (1) / (4) / (6) - ✓ more than two datasets with (2) / (3) / (5) - ✓ more than two datasets with (2) / (3) / (6) - ✓ more than two datasets with (2) / (4) / (5) - ✓ more than two datasets with (2) / (4) / (6) - ✓ more than two datasets did the job right - ✓ it can resolve a dataset after the test case is available with (Closure Object (...)) - ✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #1 - ✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #2 - ✓ it can resolve a dataset after the test case is available with shared array sets with (Closure Object (...)) #1 - ✓ it can resolve a dataset after the test case is available with shared array sets with (Closure Object (...)) #2 - - PASS Tests\Features\Exceptions - ✓ it gives access the the underlying expectException - ✓ it catch exceptions - ✓ it catch exceptions and messages - ✓ it can just define the message - - PASS Tests\Features\Expect\HigherOrder\methods - ✓ it can access methods - ✓ it can access multiple methods - ✓ it works with not - ✓ it can accept arguments - ✓ it works with each - ✓ it works inside of each - ✓ it works with sequence - ✓ it can compose complex expectations - ✓ it can handle nested method calls - ✓ it works with higher order tests - - PASS Tests\Features\Expect\HigherOrder\methodsAndProperties - ✓ it can access methods and properties - ✓ it can handle nested methods and properties - ✓ it works with higher order tests - ✓ it can start a new higher order expectation using the and syntax - ✓ it can start a new higher order expectation using the and syntax in higher order tests - - PASS Tests\Features\Expect\HigherOrder\properties - ✓ it allows properties to be accessed from the value - ✓ it can access multiple properties from the value - ✓ it works with not - ✓ it works with each - ✓ it works inside of each - ✓ it works with sequence - ✓ it can compose complex expectations - ✓ it works with objects - ✓ it works with nested properties - ✓ it works with higher order tests - - PASS Tests\Features\Expect\each - ✓ an exception is thrown if the the type is not iterable - ✓ it expects on each item - ✓ it chains expectations on each item - ✓ opposite expectations on each item - ✓ chained opposite and non-opposite expectations - ✓ it can add expectations via "and" - ✓ it accepts callables - - PASS Tests\Features\Expect\extend - ✓ it macros true is true - ✓ it macros false is not true - ✓ it macros true is true with argument - ✓ it macros false is not true with argument - - PASS Tests\Features\Expect\json - ✓ it properly parses json string - ✓ fails with broken json string - - PASS Tests\Features\Expect\not - ✓ not property calls - - PASS Tests\Features\Expect\ray - ✓ ray calls do not fail when ray is not installed - - PASS Tests\Features\Expect\sequence - ✓ an exception is thrown if the the type is not iterable - ✓ allows for sequences of checks to be run on iterable data - ✓ loops back to the start if it runs out of sequence items - ✓ it works if the number of items in the iterable is smaller than the number of expectations - ✓ it works with associative arrays - ✓ it can be passed non-callable values - ✓ it can be passed a mixture of value types - - PASS Tests\Features\Expect\toBe - ✓ strict comparisons - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeArray - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeBool - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeCallable - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeDirectory - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeEmpty - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeFalse - ✓ strict comparisons - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeFalsy - ✓ passes as falsy with (false) - ✓ passes as falsy with ('') - ✓ passes as falsy with (null) - ✓ passes as falsy with (0) - ✓ passes as falsy with ('0') - ✓ passes as not falsy with (true) - ✓ passes as not falsy with (1) #1 - ✓ passes as not falsy with ('false') - ✓ passes as not falsy with (1) #2 - ✓ passes as not falsy with (-1) - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeFile - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeFloat - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeGreatherThan - ✓ passes - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeGreatherThanOrEqual - ✓ passes - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeIn - ✓ passes - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeInfinite - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeInstanceOf - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeInt - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeIterable - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeJson - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeLessThan - ✓ passes - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeLessThanOrEqual - ✓ passes - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeNAN - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeNull - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeNumeric - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeObject - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeReadableDirectory - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeReadableFile - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeResource - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeScalar - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeString - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeTrue - ✓ strict comparisons - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeTruthy - ✓ passes as truthy with (true) - ✓ passes as truthy with (1) #1 - ✓ passes as truthy with ('false') - ✓ passes as truthy with (1) #2 - ✓ passes as truthy with (-1) - ✓ passes as not truthy with (false) - ✓ passes as not truthy with ('') - ✓ passes as not truthy with (null) - ✓ passes as not truthy with (0) - ✓ passes as not truthy with ('0') - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeWritableDirectory - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toBeWritableFile - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toContain - ✓ passes strings - ✓ passes strings with multiple needles - ✓ passes arrays - ✓ passes arrays with multiple needles - ✓ passes with array needles - ✓ failures - ✓ failures with multiple needles (all failing) - ✓ failures with multiple needles (some failing) - ✓ not failures - ✓ not failures with multiple needles (all failing) - ✓ not failures with multiple needles (some failing) - - PASS Tests\Features\Expect\toEndWith - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toEqual - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toEqualCanonicalizing - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toEqualWithDelta - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toHaveCount - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toHaveKey - ✓ pass - ✓ pass with nested key - ✓ pass with plain key with dots - ✓ pass with value check - ✓ pass with value check and nested key - ✓ pass with value check and plain key with dots - ✓ failures - ✓ failures with nested key - ✓ failures with plain key with dots - ✓ fails with wrong value - ✓ fails with wrong value and nested key - ✓ fails with wrong value and plain key with dots - ✓ not failures - ✓ not failures with nested key - ✓ not failures with plain key with dots - ✓ not failures with correct value - ✓ not failures with correct value and with nested key - ✓ not failures with correct value and with plain key with dots - - PASS Tests\Features\Expect\toHaveKeys - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toHaveLength - ✓ it passes with ('Fortaleza') - ✓ it passes with ('Sollefteå') - ✓ it passes with ('Ιεράπετρα') - ✓ it passes with (stdClass Object (...)) - ✓ it passes with (Illuminate\Support\Collection Object (...)) - ✓ it passes with array - ✓ it passes with *not* - ✓ it properly fails with *not* - ✓ it fails with (1) - ✓ it fails with (1.5) - ✓ it fails with (true) - ✓ it fails with (null) - - PASS Tests\Features\Expect\toHaveProperties - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toHaveProperty - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toMatch - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toMatchArray - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toMatchConstraint - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toMatchObject - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toStartWith - ✓ pass - ✓ failures - ✓ not failures - - PASS Tests\Features\Expect\toThrow - ✓ passes - ✓ failures 1 - ✓ failures 2 - ✓ failures 3 - ✓ failures 4 - ✓ failures 5 - ✓ failures 6 - ✓ failures 7 - ✓ not failures - ✓ closure missing parameter - ✓ closure missing type-hint - - PASS Tests\Features\Helpers - ✓ it can set/get properties on $this - ✓ it throws error if property do not exist - ✓ it allows to call underlying protected/private methods - ✓ it throws error if method do not exist - ✓ it can forward unexpected calls to any global function - ✓ it can use helpers from helpers file - - PASS Tests\Features\HigherOrderTests - ✓ it proxies calls to object - ✓ it is capable doing multiple assertions - ✓ it resolves expect callables correctly - ✓ does not treat method names as callables - ✓ it can tap into the test - ✓ it can pass datasets into the expect callables with (1, 2, 3) - ✓ it can pass datasets into the tap callable with (1, 2, 3) - ✓ it can pass shared datasets into callables with (1) - ✓ it can pass shared datasets into callables with (2) - - WARN Tests\Features\Incompleted - … incompleted - … it is incompleted - … it is incompleted even with method calls like skip - … it is incompleted even with method calls like group - ✓ it is not incompleted because of expect - ✓ it is not incompleted because of assert - ✓ it is not incompleted because of test with assertions - - PASS Tests\Features\It - ✓ it is a test - ✓ it is a higher order message test - - PASS Tests\Features\Macro - ✓ it can call chained macro method - ✓ it will throw exception from call if no macro exists - - PASS Tests\Features\PendingHigherOrderTests - ✓ get 'foo' - ✓ get 'foo' → get 'bar' → expect true → toBeTrue - ✓ get 'foo' → expect true → toBeTrue - - WARN Tests\Features\Skip - ✓ it do not skips - - it skips with truthy - - it skips with truthy condition by default - - it skips with message → skipped because bar - - it skips with truthy closure condition - ✓ it do not skips with falsy closure condition - - it skips with condition and message → skipped because foo - - it skips when skip after assertion - - it can use something in the test case as a condition → This test was skipped - - it can user higher order callables and skip - - PASS Tests\Features\Test - ✓ a test - ✓ higher order message test - - PASS Tests\Fixtures\DirectoryWithTests\ExampleTest - ✓ it example 1 - - PASS Tests\Fixtures\ExampleTest - ✓ it example 2 - - PASS Tests\Hooks\AfterAllTest - ✓ global afterAll execution order - ✓ it only gets called once per file - - PASS Tests\Hooks\AfterEachTest - ✓ global afterEach execution order - - PASS Tests\Hooks\BeforeAllTest - ✓ global beforeAll execution order - ✓ it only gets called once per file - - PASS Tests\Hooks\BeforeEachTest - ✓ global beforeEach execution order - - PASS Tests\PHPUnit\CustomAffixes\InvalidTestName - ✓ it runs file names like `@#$%^&()-_=+.php` - - PASS Tests\PHPUnit\CustomAffixes\ATestWithSpaces - ✓ it runs file names like `A Test With Spaces.php` - - PASS Tests\PHPUnit\CustomAffixes\AdditionalFileExtensionspec - ✓ it runs file names like `AdditionalFileExtension.spec.php` - - PASS Tests\PHPUnit\CustomAffixes\FolderWithAn\ExampleTest - ✓ custom traits can be used - ✓ trait applied in this file - - PASS Tests\PHPUnit\CustomAffixes\ManyExtensionsclasstest - ✓ it runs file names like `ManyExtensions.class.test.php` - - PASS Tests\PHPUnit\CustomAffixes\TestCaseWithQuotes - ✓ it runs file names like `Test 'Case' With Quotes.php` - - PASS Tests\PHPUnit\CustomAffixes\kebabcasespec - ✓ it runs file names like `kebab-case-spec.php` - - PASS Tests\PHPUnit\CustomAffixes\snakecasespec - ✓ it runs file names like `snake_case_spec.php` - - PASS Tests\PHPUnit\CustomTestCase\UsesPerDirectory - ✓ closure was bound to CustomTestCase - - PASS Tests\PHPUnit\CustomTestCaseInSubFolders\SubFolder\SubFolder\UsesPerSubDirectory - ✓ closure was bound to CustomTestCase - - PASS Tests\PHPUnit\CustomTestCaseInSubFolders\SubFolder2\UsesPerFile - ✓ custom traits can be used - ✓ trait applied in this file - - PASS Tests\Playground - ✓ basic - - PASS Tests\Plugins\Traits - ✓ it allows global uses - ✓ it allows multiple global uses registered in the same path - - PASS Tests\Unit\Actions\AddsDefaults - ✓ it sets defaults - ✓ it does not override options - - PASS Tests\Unit\Actions\AddsTests - ✓ default php unit tests - ✓ it removes warnings - - PASS Tests\Unit\Actions\ValidatesConfiguration - ✓ it throws exception when configuration not found - ✓ it throws exception when `process isolation` is true - ✓ it do not throws exception when `process isolation` is false - - PASS Tests\Unit\Console\Help - ✓ it outputs the help information when --help is used - - PASS Tests\Unit\Datasets - ✓ it show only the names of named datasets in their description - ✓ it show the actual dataset of non-named datasets in their description - ✓ it show only the names of multiple named datasets in their description - ✓ it show the actual dataset of multiple non-named datasets in their description - ✓ it show the correct description for mixed named and not-named datasets - - PASS Tests\Unit\Plugins\Context - ✓ environment is set to CI when --ci option is used - ✓ environment is set to Local when --ci option is not used - - PASS Tests\Unit\Plugins\Version - ✓ it outputs the version when --version is used - ✓ it do not outputs version when --version is not used - - PASS Tests\Unit\Support\Backtrace - ✓ it gets file name from called file - - PASS Tests\Unit\Support\Container - ✓ it exists - ✓ it gets an instance - ✓ autowire - ✓ it creates an instance and resolves parameters - ✓ it creates an instance and resolves also sub parameters - ✓ it can resolve builtin value types - ✓ it cannot resolve a parameter without type - - PASS Tests\Unit\Support\Reflection - ✓ it gets file name from closure - ✓ it gets property values - - PASS Tests\Unit\TestSuite - ✓ it does not allow to add the same test description twice - ✓ it alerts users about tests with arguments but no input - ✓ it can return an array of all test suite filenames - ✓ it can filter the test suite filenames to those with the only method - ✓ it does not filter the test suite filenames to those with the only method when working in CI pipeline - - PASS Tests\Visual\Help - ✓ visual snapshot of help command output - - PASS Tests\Visual\JUnit - ✓ it is can successfully call all public methods - - PASS Tests\Visual\SingleTestOrDirectory - ✓ allows to run a single test - ✓ allows to run a directory - ✓ it has ascii chars - ✓ it disable decorating printer when colors is set to never - - WARN Tests\Visual\Success - - visual snapshot of test suite on success - - PASS Tests\Visual\TeamCity - ✓ it is can successfully call all public methods - - PASS Tests\Features\Depends - ✓ first - ✓ second - ✓ it asserts true is true - ✓ depends - ✓ depends with ...params - ✓ depends with defined arguments - ✓ depends run test only once - ✓ depends works with the correct test name - - PASS Tests\Features\DependsInheritance - ✓ it is a test - ✓ it uses correct parent class - - Tests: 4 incompleted, 9 skipped, 450 passed - \ No newline at end of file From 6f42e336c9e0adf4765b252e151a865a2f063e55 Mon Sep 17 00:00:00 2001 From: Fabio Ivona Date: Sat, 25 Sep 2021 08:57:55 +0200 Subject: [PATCH 7/8] merge conflict --- tests/.snapshots/success.txt | 690 +++++++++++++++++++++++++++++++++++ 1 file changed, 690 insertions(+) create mode 100644 tests/.snapshots/success.txt diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt new file mode 100644 index 00000000..d7a866b9 --- /dev/null +++ b/tests/.snapshots/success.txt @@ -0,0 +1,690 @@ + + PASS Tests\CustomTestCase\ExecutedTest + ✓ that gets executed + + PASS Tests\Features\AfterAll + ✓ deletes file after all + + PASS Tests\Features\AfterEach + ✓ it does not get executed before the test + ✓ it gets executed after the test + + PASS Tests\Features\BeforeAll + ✓ it gets executed before tests + ✓ it do not get executed before each test + + PASS Tests\Features\BeforeEach + ✓ it gets executed before each test + ✓ it gets executed before each test once again + + PASS Tests\Features\Coverage + ✓ it has plugin + ✓ it adds coverage if --coverage exist + ✓ it adds coverage if --min exist + ✓ it generates coverage based on file input + + PASS Tests\Features\Datasets + ✓ it throws exception if dataset does not exist + ✓ it throws exception if dataset already exist + ✓ it sets closures + ✓ it sets arrays + ✓ it gets bound to test case object with ('a') + ✓ it gets bound to test case object with ('b') + ✓ it truncates the description with ('FoooFoooFoooFoooFoooFoooFoooF...ooFooo') + ✓ lazy datasets with (1) + ✓ lazy datasets with (2) + ✓ lazy datasets did the job right + ✓ eager datasets with (1) + ✓ eager datasets with (2) + ✓ eager datasets did the job right + ✓ lazy registered datasets with (1) + ✓ lazy registered datasets with (2) + ✓ lazy registered datasets did the job right + ✓ eager registered datasets with (1) + ✓ eager registered datasets with (2) + ✓ eager registered datasets did the job right + ✓ eager wrapped registered datasets with (1) + ✓ eager wrapped registered datasets with (2) + ✓ eager registered wrapped datasets did the job right + ✓ named datasets with data set "one" + ✓ named datasets with data set "two" + ✓ named datasets did the job right + ✓ lazy named datasets with (Bar Object (...)) + ✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #1 + ✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #2 + ✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), false) + ✓ it creates unique test case names with ('Name 2', Pest\Plugin Object (), false) + ✓ it creates unique test case names with ('Name 2', Pest\Plugin Object (), true) + ✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #3 + ✓ it creates unique test case names - count + ✓ lazy multiple datasets with (1) / (3) + ✓ lazy multiple datasets with (1) / (4) + ✓ lazy multiple datasets with (2) / (3) + ✓ lazy multiple datasets with (2) / (4) + ✓ lazy multiple datasets did the job right + ✓ eager multiple datasets with (1) / (3) + ✓ eager multiple datasets with (1) / (4) + ✓ eager multiple datasets with (2) / (3) + ✓ eager multiple datasets with (2) / (4) + ✓ eager multiple datasets did the job right + ✓ lazy registered multiple datasets with (1) / (1) + ✓ lazy registered multiple datasets with (1) / (2) + ✓ lazy registered multiple datasets with (2) / (1) + ✓ lazy registered multiple datasets with (2) / (2) + ✓ lazy registered multiple datasets did the job right + ✓ eager registered multiple datasets with (1) / (1) + ✓ eager registered multiple datasets with (1) / (2) + ✓ eager registered multiple datasets with (2) / (1) + ✓ eager registered multiple datasets with (2) / (2) + ✓ eager registered multiple datasets did the job right + ✓ eager wrapped registered multiple datasets with (1) / (1) + ✓ eager wrapped registered multiple datasets with (1) / (2) + ✓ eager wrapped registered multiple datasets with (2) / (1) + ✓ eager wrapped registered multiple datasets with (2) / (2) + ✓ eager wrapped registered multiple datasets did the job right + ✓ named multiple datasets with data set "one" / data set "three" + ✓ named multiple datasets with data set "one" / data set "four" + ✓ named multiple datasets with data set "two" / data set "three" + ✓ named multiple datasets with data set "two" / data set "four" + ✓ named multiple datasets did the job right + ✓ more than two datasets with (1) / (3) / (5) + ✓ more than two datasets with (1) / (3) / (6) + ✓ more than two datasets with (1) / (4) / (5) + ✓ more than two datasets with (1) / (4) / (6) + ✓ more than two datasets with (2) / (3) / (5) + ✓ more than two datasets with (2) / (3) / (6) + ✓ more than two datasets with (2) / (4) / (5) + ✓ more than two datasets with (2) / (4) / (6) + ✓ more than two datasets did the job right + ✓ it can resolve a dataset after the test case is available with (Closure Object (...)) + ✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #1 + ✓ it can resolve a dataset after the test case is available with shared yield sets with (Closure Object (...)) #2 + ✓ it can resolve a dataset after the test case is available with shared array sets with (Closure Object (...)) #1 + ✓ it can resolve a dataset after the test case is available with shared array sets with (Closure Object (...)) #2 + + PASS Tests\Features\Exceptions + ✓ it gives access the the underlying expectException + ✓ it catch exceptions + ✓ it catch exceptions and messages + ✓ it can just define the message + + PASS Tests\Features\Expect\HigherOrder\methods + ✓ it can access methods + ✓ it can access multiple methods + ✓ it works with not + ✓ it can accept arguments + ✓ it works with each + ✓ it works inside of each + ✓ it works with sequence + ✓ it can compose complex expectations + ✓ it can handle nested method calls + ✓ it works with higher order tests + + PASS Tests\Features\Expect\HigherOrder\methodsAndProperties + ✓ it can access methods and properties + ✓ it can handle nested methods and properties + ✓ it works with higher order tests + ✓ it can start a new higher order expectation using the and syntax + ✓ it can start a new higher order expectation using the and syntax in higher order tests + + PASS Tests\Features\Expect\HigherOrder\properties + ✓ it allows properties to be accessed from the value + ✓ it can access multiple properties from the value + ✓ it works with not + ✓ it works with each + ✓ it works inside of each + ✓ it works with sequence + ✓ it can compose complex expectations + ✓ it works with objects + ✓ it works with nested properties + ✓ it works with higher order tests + + PASS Tests\Features\Expect\each + ✓ an exception is thrown if the the type is not iterable + ✓ it expects on each item + ✓ it chains expectations on each item + ✓ opposite expectations on each item + ✓ chained opposite and non-opposite expectations + ✓ it can add expectations via "and" + ✓ it accepts callables + + PASS Tests\Features\Expect\extend + ✓ it macros true is true + ✓ it macros false is not true + ✓ it macros true is true with argument + ✓ it macros false is not true with argument + + PASS Tests\Features\Expect\json + ✓ it properly parses json string + ✓ fails with broken json string + + PASS Tests\Features\Expect\not + ✓ not property calls + + PASS Tests\Features\Expect\ray + ✓ ray calls do not fail when ray is not installed + + PASS Tests\Features\Expect\sequence + ✓ an exception is thrown if the the type is not iterable + ✓ allows for sequences of checks to be run on iterable data + ✓ loops back to the start if it runs out of sequence items + ✓ it works if the number of items in the iterable is smaller than the number of expectations + ✓ it works with associative arrays + ✓ it can be passed non-callable values + ✓ it can be passed a mixture of value types + + PASS Tests\Features\Expect\toBe + ✓ strict comparisons + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeArray + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeBool + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeCallable + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeDirectory + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeEmpty + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeFalse + ✓ strict comparisons + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeFalsy + ✓ passes as falsy with (false) + ✓ passes as falsy with ('') + ✓ passes as falsy with (null) + ✓ passes as falsy with (0) + ✓ passes as falsy with ('0') + ✓ passes as not falsy with (true) + ✓ passes as not falsy with (1) #1 + ✓ passes as not falsy with ('false') + ✓ passes as not falsy with (1) #2 + ✓ passes as not falsy with (-1) + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeFile + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeFloat + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeGreatherThan + ✓ passes + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeGreatherThanOrEqual + ✓ passes + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeIn + ✓ passes + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeInfinite + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeInstanceOf + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeInt + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeIterable + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeJson + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeLessThan + ✓ passes + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeLessThanOrEqual + ✓ passes + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeNAN + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeNull + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeNumeric + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeObject + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeReadableDirectory + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeReadableFile + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeResource + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeScalar + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeString + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeTrue + ✓ strict comparisons + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeTruthy + ✓ passes as truthy with (true) + ✓ passes as truthy with (1) #1 + ✓ passes as truthy with ('false') + ✓ passes as truthy with (1) #2 + ✓ passes as truthy with (-1) + ✓ passes as not truthy with (false) + ✓ passes as not truthy with ('') + ✓ passes as not truthy with (null) + ✓ passes as not truthy with (0) + ✓ passes as not truthy with ('0') + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeWritableDirectory + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeWritableFile + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toContain + ✓ passes strings + ✓ passes strings with multiple needles + ✓ passes arrays + ✓ passes arrays with multiple needles + ✓ passes with array needles + ✓ failures + ✓ failures with multiple needles (all failing) + ✓ failures with multiple needles (some failing) + ✓ not failures + ✓ not failures with multiple needles (all failing) + ✓ not failures with multiple needles (some failing) + + PASS Tests\Features\Expect\toEndWith + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toEqual + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toEqualCanonicalizing + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toEqualWithDelta + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toHaveCount + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toHaveKey + ✓ pass + ✓ pass with nested key + ✓ pass with plain key with dots + ✓ pass with value check + ✓ pass with value check and nested key + ✓ pass with value check and plain key with dots + ✓ failures + ✓ failures with nested key + ✓ failures with plain key with dots + ✓ fails with wrong value + ✓ fails with wrong value and nested key + ✓ fails with wrong value and plain key with dots + ✓ not failures + ✓ not failures with nested key + ✓ not failures with plain key with dots + ✓ not failures with correct value + ✓ not failures with correct value and with nested key + ✓ not failures with correct value and with plain key with dots + + PASS Tests\Features\Expect\toHaveKeys + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toHaveLength + ✓ it passes with ('Fortaleza') + ✓ it passes with ('Sollefteå') + ✓ it passes with ('Ιεράπετρα') + ✓ it passes with (stdClass Object (...)) + ✓ it passes with (Illuminate\Support\Collection Object (...)) + ✓ it passes with array + ✓ it passes with *not* + ✓ it properly fails with *not* + ✓ it fails with (1) + ✓ it fails with (1.5) + ✓ it fails with (true) + ✓ it fails with (null) + + PASS Tests\Features\Expect\toHaveProperties + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toHaveProperty + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toMatch + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toMatchArray + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toMatchConstraint + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toMatchObject + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toStartWith + ✓ pass + ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toThrow + ✓ passes + ✓ failures 1 + ✓ failures 2 + ✓ failures 3 + ✓ failures 4 + ✓ failures 5 + ✓ failures 6 + ✓ failures 7 + ✓ not failures + ✓ closure missing parameter + ✓ closure missing type-hint + + PASS Tests\Features\Helpers + ✓ it can set/get properties on $this + ✓ it throws error if property do not exist + ✓ it allows to call underlying protected/private methods + ✓ it throws error if method do not exist + ✓ it can forward unexpected calls to any global function + ✓ it can use helpers from helpers file + + PASS Tests\Features\HigherOrderTests + ✓ it proxies calls to object + ✓ it is capable doing multiple assertions + ✓ it resolves expect callables correctly + ✓ does not treat method names as callables + ✓ it can tap into the test + ✓ it can pass datasets into the expect callables with (1, 2, 3) + ✓ it can pass datasets into the tap callable with (1, 2, 3) + ✓ it can pass shared datasets into callables with (1) + ✓ it can pass shared datasets into callables with (2) + + WARN Tests\Features\Incompleted + … incompleted + … it is incompleted + … it is incompleted even with method calls like skip + … it is incompleted even with method calls like group + ✓ it is not incompleted because of expect + ✓ it is not incompleted because of assert + ✓ it is not incompleted because of test with assertions + + PASS Tests\Features\It + ✓ it is a test + ✓ it is a higher order message test + + PASS Tests\Features\Macro + ✓ it can call chained macro method + ✓ it will throw exception from call if no macro exists + + PASS Tests\Features\PendingHigherOrderTests + ✓ get 'foo' + ✓ get 'foo' → get 'bar' → expect true → toBeTrue + ✓ get 'foo' → expect true → toBeTrue + + WARN Tests\Features\Skip + ✓ it do not skips + - it skips with truthy + - it skips with truthy condition by default + - it skips with message → skipped because bar + - it skips with truthy closure condition + ✓ it do not skips with falsy closure condition + - it skips with condition and message → skipped because foo + - it skips when skip after assertion + - it can use something in the test case as a condition → This test was skipped + - it can user higher order callables and skip + + PASS Tests\Features\Test + ✓ a test + ✓ higher order message test + + PASS Tests\Fixtures\DirectoryWithTests\ExampleTest + ✓ it example 1 + + PASS Tests\Fixtures\ExampleTest + ✓ it example 2 + + PASS Tests\Hooks\AfterAllTest + ✓ global afterAll execution order + ✓ it only gets called once per file + + PASS Tests\Hooks\AfterEachTest + ✓ global afterEach execution order + + PASS Tests\Hooks\BeforeAllTest + ✓ global beforeAll execution order + ✓ it only gets called once per file + + PASS Tests\Hooks\BeforeEachTest + ✓ global beforeEach execution order + + PASS Tests\PHPUnit\CustomAffixes\InvalidTestName + ✓ it runs file names like `@#$%^&()-_=+.php` + + PASS Tests\PHPUnit\CustomAffixes\ATestWithSpaces + ✓ it runs file names like `A Test With Spaces.php` + + PASS Tests\PHPUnit\CustomAffixes\AdditionalFileExtensionspec + ✓ it runs file names like `AdditionalFileExtension.spec.php` + + PASS Tests\PHPUnit\CustomAffixes\FolderWithAn\ExampleTest + ✓ custom traits can be used + ✓ trait applied in this file + + PASS Tests\PHPUnit\CustomAffixes\ManyExtensionsclasstest + ✓ it runs file names like `ManyExtensions.class.test.php` + + PASS Tests\PHPUnit\CustomAffixes\TestCaseWithQuotes + ✓ it runs file names like `Test 'Case' With Quotes.php` + + PASS Tests\PHPUnit\CustomAffixes\kebabcasespec + ✓ it runs file names like `kebab-case-spec.php` + + PASS Tests\PHPUnit\CustomAffixes\snakecasespec + ✓ it runs file names like `snake_case_spec.php` + + PASS Tests\PHPUnit\CustomTestCase\UsesPerDirectory + ✓ closure was bound to CustomTestCase + + PASS Tests\PHPUnit\CustomTestCaseInSubFolders\SubFolder\SubFolder\UsesPerSubDirectory + ✓ closure was bound to CustomTestCase + + PASS Tests\PHPUnit\CustomTestCaseInSubFolders\SubFolder2\UsesPerFile + ✓ custom traits can be used + ✓ trait applied in this file + + PASS Tests\Playground + ✓ basic + + PASS Tests\Plugins\Traits + ✓ it allows global uses + ✓ it allows multiple global uses registered in the same path + + PASS Tests\Unit\Actions\AddsDefaults + ✓ it sets defaults + ✓ it does not override options + + PASS Tests\Unit\Actions\AddsTests + ✓ default php unit tests + ✓ it removes warnings + + PASS Tests\Unit\Actions\ValidatesConfiguration + ✓ it throws exception when configuration not found + ✓ it throws exception when `process isolation` is true + ✓ it do not throws exception when `process isolation` is false + + PASS Tests\Unit\Console\Help + ✓ it outputs the help information when --help is used + + PASS Tests\Unit\Datasets + ✓ it show only the names of named datasets in their description + ✓ it show the actual dataset of non-named datasets in their description + ✓ it show only the names of multiple named datasets in their description + ✓ it show the actual dataset of multiple non-named datasets in their description + ✓ it show the correct description for mixed named and not-named datasets + + PASS Tests\Unit\Plugins\Context + ✓ environment is set to CI when --ci option is used + ✓ environment is set to Local when --ci option is not used + + PASS Tests\Unit\Plugins\Version + ✓ it outputs the version when --version is used + ✓ it do not outputs version when --version is not used + + PASS Tests\Unit\Support\Backtrace + ✓ it gets file name from called file + + PASS Tests\Unit\Support\Container + ✓ it exists + ✓ it gets an instance + ✓ autowire + ✓ it creates an instance and resolves parameters + ✓ it creates an instance and resolves also sub parameters + ✓ it can resolve builtin value types + ✓ it cannot resolve a parameter without type + + PASS Tests\Unit\Support\Reflection + ✓ it gets file name from closure + ✓ it gets property values + + PASS Tests\Unit\TestSuite + ✓ it does not allow to add the same test description twice + ✓ it alerts users about tests with arguments but no input + ✓ it can return an array of all test suite filenames + ✓ it can filter the test suite filenames to those with the only method + ✓ it does not filter the test suite filenames to those with the only method when working in CI pipeline + + PASS Tests\Visual\Help + ✓ visual snapshot of help command output + + PASS Tests\Visual\JUnit + ✓ it is can successfully call all public methods + + PASS Tests\Visual\SingleTestOrDirectory + ✓ allows to run a single test + ✓ allows to run a directory + ✓ it has ascii chars + ✓ it disable decorating printer when colors is set to never + + WARN Tests\Visual\Success + - visual snapshot of test suite on success + + PASS Tests\Visual\TeamCity + ✓ it is can successfully call all public methods + + PASS Tests\Features\Depends + ✓ first + ✓ second + ✓ it asserts true is true + ✓ depends + ✓ depends with ...params + ✓ depends with defined arguments + ✓ depends run test only once + ✓ depends works with the correct test name + + PASS Tests\Features\DependsInheritance + ✓ it is a test + ✓ it uses correct parent class + + Tests: 4 incompleted, 9 skipped, 450 passed + \ No newline at end of file From 7d70b6e95a4def9eb9a4486c42e90c50b69b582d Mon Sep 17 00:00:00 2001 From: Fabio Ivona Date: Sat, 25 Sep 2021 09:04:26 +0200 Subject: [PATCH 8/8] merge from master --- tests/.snapshots/success.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index addf3536..ccef8873 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -657,6 +657,10 @@ ✓ it show the actual dataset of multiple non-named datasets in their description ✓ it show the correct description for mixed named and not-named datasets + PASS Tests\Unit\Plugins\Context + ✓ environment is set to CI when --ci option is used + ✓ environment is set to Local when --ci option is not used + PASS Tests\Unit\Plugins\Version ✓ it outputs the version when --version is used ✓ it do not outputs version when --version is not used @@ -682,6 +686,7 @@ ✓ it alerts users about tests with arguments but no input ✓ it can return an array of all test suite filenames ✓ it can filter the test suite filenames to those with the only method + ✓ it does not filter the test suite filenames to those with the only method when working in CI pipeline PASS Tests\Visual\Help ✓ visual snapshot of help command output @@ -715,5 +720,5 @@ ✓ it is a test ✓ it uses correct parent class - Tests: 4 incompleted, 9 skipped, 475 passed + Tests: 4 incompleted, 9 skipped, 478 passed \ No newline at end of file