From 7ec3460d733f607870630788c69c16c0994b09f3 Mon Sep 17 00:00:00 2001 From: Reza Amini Date: Wed, 21 Jul 2021 13:02:09 +0430 Subject: [PATCH 01/19] Add --force flag to pest:test command --- src/Laravel/Commands/PestTestCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Laravel/Commands/PestTestCommand.php b/src/Laravel/Commands/PestTestCommand.php index 55d9dc3a..5c6196a5 100644 --- a/src/Laravel/Commands/PestTestCommand.php +++ b/src/Laravel/Commands/PestTestCommand.php @@ -21,7 +21,7 @@ final class PestTestCommand extends Command * * @var string */ - protected $signature = 'pest:test {name : The name of the file} {--unit : Create a unit test} {--dusk : Create a Dusk test} {--test-directory=tests : The name of the tests directory}'; + protected $signature = 'pest:test {name : The name of the file} {--unit : Create a unit test} {--dusk : Create a Dusk test} {--test-directory=tests : The name of the tests directory} {--force : Force create}'; /** * The console command description. @@ -56,7 +56,7 @@ final class PestTestCommand extends Command File::makeDirectory(dirname($target), 0777, true, true); } - if (File::exists($target)) { + if (File::exists($target) and !$this->option('force')) { throw new InvalidConsoleArgument(sprintf('%s already exist', $target)); } From 5e0a0855ea685872fe64602c4e7a01a48ab16492 Mon Sep 17 00:00:00 2001 From: Reza Amini Date: Wed, 21 Jul 2021 14:38:11 +0430 Subject: [PATCH 02/19] Add a better description --- src/Laravel/Commands/PestTestCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Laravel/Commands/PestTestCommand.php b/src/Laravel/Commands/PestTestCommand.php index 5c6196a5..c8eebcba 100644 --- a/src/Laravel/Commands/PestTestCommand.php +++ b/src/Laravel/Commands/PestTestCommand.php @@ -21,7 +21,7 @@ final class PestTestCommand extends Command * * @var string */ - protected $signature = 'pest:test {name : The name of the file} {--unit : Create a unit test} {--dusk : Create a Dusk test} {--test-directory=tests : The name of the tests directory} {--force : Force create}'; + protected $signature = 'pest:test {name : The name of the file} {--unit : Create a unit test} {--dusk : Create a Dusk test} {--test-directory=tests : The name of the tests directory} {--force : Overwrite the existing test file with the same name}'; /** * The console command description. From 595bbe32a48b8e419e70b3fb9d26076d46a05ba2 Mon Sep 17 00:00:00 2001 From: Reza Amini Date: Thu, 22 Jul 2021 01:41:12 +0430 Subject: [PATCH 03/19] Add bool to the condition --- src/Laravel/Commands/PestTestCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Laravel/Commands/PestTestCommand.php b/src/Laravel/Commands/PestTestCommand.php index c8eebcba..7561355b 100644 --- a/src/Laravel/Commands/PestTestCommand.php +++ b/src/Laravel/Commands/PestTestCommand.php @@ -56,7 +56,7 @@ final class PestTestCommand extends Command File::makeDirectory(dirname($target), 0777, true, true); } - if (File::exists($target) and !$this->option('force')) { + if (File::exists($target) and !(bool) $this->option('force')) { throw new InvalidConsoleArgument(sprintf('%s already exist', $target)); } From 79ff332afeb8e9ae88d966084e6569b7271e64ea Mon Sep 17 00:00:00 2001 From: jordanbrauer <18744334+jordanbrauer@users.noreply.github.com> Date: Wed, 21 Jul 2021 20:32:39 -0500 Subject: [PATCH 04/19] test: global "all" hooks must only run once (#351) in other words, they can only run once per file --- tests/Hooks/AfterAllTest.php | 30 +++++++++++++++++++++++--- tests/Hooks/BeforeAllTest.php | 40 +++++++++++++++++++++++++++++------ tests/Pest.php | 5 ++++- 3 files changed, 65 insertions(+), 10 deletions(-) diff --git a/tests/Hooks/AfterAllTest.php b/tests/Hooks/AfterAllTest.php index a34a5847..fb8a71d4 100644 --- a/tests/Hooks/AfterAllTest.php +++ b/tests/Hooks/AfterAllTest.php @@ -2,26 +2,50 @@ global $globalHook; +// NOTE: this test does not have a $globalHook->calls offset since it is first +// in the directory and thus will always run before the others. See also the +// BeforeAllTest.php for details. + uses()->afterAll(function () use ($globalHook) { expect($globalHook) ->toHaveProperty('afterAll') ->and($globalHook->afterAll) - ->toBe(0); + ->toBe(0) + ->and($globalHook->calls) + ->afterAll + ->toBe(1); $globalHook->afterAll = 1; + $globalHook->calls->afterAll++; }); afterAll(function () use ($globalHook) { expect($globalHook) ->toHaveProperty('afterAll') ->and($globalHook->afterAll) - ->toBe(1); + ->toBe(1) + ->and($globalHook->calls) + ->afterAll + ->toBe(2); $globalHook->afterAll = 2; + $globalHook->calls->afterAll++; }); test('global afterAll execution order', function () use ($globalHook) { expect($globalHook) ->not() - ->toHaveProperty('afterAll'); + ->toHaveProperty('afterAll') + ->and($globalHook->calls) + ->afterAll + ->toBe(0); +}); + +test('it only gets called once per file', function () use ($globalHook) { + expect($globalHook) + ->not() + ->toHaveProperty('afterAll') + ->and($globalHook->calls) + ->afterAll + ->toBe(0); }); diff --git a/tests/Hooks/BeforeAllTest.php b/tests/Hooks/BeforeAllTest.php index 11c996c5..838d7c14 100644 --- a/tests/Hooks/BeforeAllTest.php +++ b/tests/Hooks/BeforeAllTest.php @@ -1,28 +1,56 @@ beforeAll(function () use ($globalHook) { +// HACK: we have to determine our $globalHook->calls baseline. This is because +// two other tests are executed before this one due to filename ordering. +$args = $_SERVER['argv'] ?? []; +$single = isset($args[1]) && Str::endsWith(__FILE__, $args[1]); +$offset = $single ? 0 : 2; + +uses()->beforeAll(function () use ($globalHook, $offset) { expect($globalHook) ->toHaveProperty('beforeAll') ->and($globalHook->beforeAll) - ->toBe(0); + ->toBe(0) + ->and($globalHook->calls) + ->beforeAll + ->toBe(1 + $offset); $globalHook->beforeAll = 1; + $globalHook->calls->beforeAll++; }); -beforeAll(function () use ($globalHook) { +beforeAll(function () use ($globalHook, $offset) { expect($globalHook) ->toHaveProperty('beforeAll') ->and($globalHook->beforeAll) - ->toBe(1); + ->toBe(1) + ->and($globalHook->calls) + ->beforeAll + ->toBe(2 + $offset); $globalHook->beforeAll = 2; + $globalHook->calls->beforeAll++; }); -test('global beforeAll execution order', function () use ($globalHook) { +test('global beforeAll execution order', function () use ($globalHook, $offset) { expect($globalHook) ->toHaveProperty('beforeAll') ->and($globalHook->beforeAll) - ->toBe(2); + ->toBe(2) + ->and($globalHook->calls) + ->beforeAll + ->toBe(3 + $offset); +}); + +it('only gets called once per file', function () use ($globalHook, $offset) { + expect($globalHook) + ->beforeAll + ->toBe(2) + ->and($globalHook->calls) + ->beforeAll + ->toBe(3 + $offset); }); diff --git a/tests/Pest.php b/tests/Pest.php index a8cd868d..d3fe584f 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -2,7 +2,8 @@ uses()->group('integration')->in('Visual'); -$globalHook = (object) []; // NOTE: global test value container to be mutated and checked across files, as needed +// NOTE: global test value container to be mutated and checked across files, as needed +$globalHook = (object) ['calls' => (object) ['beforeAll' => 0, 'afterAll' => 0]]; uses() ->beforeEach(function () { @@ -10,11 +11,13 @@ uses() }) ->beforeAll(function () use ($globalHook) { $globalHook->beforeAll = 0; + $globalHook->calls->beforeAll++; }) ->afterEach(function () { $this->ith = 0; }) ->afterAll(function () use ($globalHook) { $globalHook->afterAll = 0; + $globalHook->calls->afterAll++; }) ->in('Hooks'); From 60c0ad006f866f7e28dd45b6e324736d63692321 Mon Sep 17 00:00:00 2001 From: jordanbrauer <18744334+jordanbrauer@users.noreply.github.com> Date: Wed, 21 Jul 2021 20:38:20 -0500 Subject: [PATCH 05/19] fix: prevent the global hooks from piling up (#351) this happens due to the global `*All()` hooks (before & after) being defined as static. We should be a good citizen and we need to clean up our mess for the next person in the test instance constructor --- src/Concerns/Testable.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Concerns/Testable.php b/src/Concerns/Testable.php index 5c72e0f3..91b73d72 100644 --- a/src/Concerns/Testable.php +++ b/src/Concerns/Testable.php @@ -73,6 +73,7 @@ trait Testable { $this->__test = $test; $this->__description = $description; + self::$beforeAll = self::$afterAll = null; parent::__construct('__test', $data); } From b6012862c4cbb02b85f8dd0193a4fc819180d83b Mon Sep 17 00:00:00 2001 From: jordanbrauer <18744334+jordanbrauer@users.noreply.github.com> Date: Wed, 21 Jul 2021 20:43:21 -0500 Subject: [PATCH 06/19] style: run linter --- tests/Hooks/BeforeAllTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Hooks/BeforeAllTest.php b/tests/Hooks/BeforeAllTest.php index 838d7c14..05e57252 100644 --- a/tests/Hooks/BeforeAllTest.php +++ b/tests/Hooks/BeforeAllTest.php @@ -6,7 +6,7 @@ global $globalHook; // HACK: we have to determine our $globalHook->calls baseline. This is because // two other tests are executed before this one due to filename ordering. -$args = $_SERVER['argv'] ?? []; +$args = $_SERVER['argv'] ?? []; $single = isset($args[1]) && Str::endsWith(__FILE__, $args[1]); $offset = $single ? 0 : 2; From d217503a6abf126ce6617eb1c783fea0a72bb851 Mon Sep 17 00:00:00 2001 From: jordanbrauer <18744334+jordanbrauer@users.noreply.github.com> Date: Wed, 21 Jul 2021 20:47:48 -0500 Subject: [PATCH 07/19] test: use consistent test descriptors --- tests/Hooks/AfterAllTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Hooks/AfterAllTest.php b/tests/Hooks/AfterAllTest.php index fb8a71d4..b9042815 100644 --- a/tests/Hooks/AfterAllTest.php +++ b/tests/Hooks/AfterAllTest.php @@ -41,7 +41,7 @@ test('global afterAll execution order', function () use ($globalHook) { ->toBe(0); }); -test('it only gets called once per file', function () use ($globalHook) { +it('only gets called once per file', function () use ($globalHook) { expect($globalHook) ->not() ->toHaveProperty('afterAll') From 863ddea50b5269a7b9b7e83067306169cb398b9b Mon Sep 17 00:00:00 2001 From: jordanbrauer <18744334+jordanbrauer@users.noreply.github.com> Date: Thu, 22 Jul 2021 17:54:22 -0500 Subject: [PATCH 08/19] style: split assignment into two lines clarity --- src/Concerns/Testable.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Concerns/Testable.php b/src/Concerns/Testable.php index 91b73d72..d8137311 100644 --- a/src/Concerns/Testable.php +++ b/src/Concerns/Testable.php @@ -73,7 +73,8 @@ trait Testable { $this->__test = $test; $this->__description = $description; - self::$beforeAll = self::$afterAll = null; + self::$beforeAll = null; + self::$afterAll = null; parent::__construct('__test', $data); } From ca9d783cf942a2caabc85ff7a728c7f28350c67a Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 26 Jul 2021 22:02:57 +0100 Subject: [PATCH 09/19] chore: makes `phpunit/phpunit` requirement above `^9.3.7` --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2224ac7f..bee8f8b7 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "php": "^7.3 || ^8.0", "nunomaduro/collision": "^5.4.0", "pestphp/pest-plugin": "^1.0.0", - "phpunit/phpunit": ">= 9.3.7 <= 9.5.6" + "phpunit/phpunit": "^9.3.7" }, "autoload": { "psr-4": { From 09d2b16767e3e1c1a881e96129399cc268da45e4 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 26 Jul 2021 22:45:03 +0100 Subject: [PATCH 10/19] docs: updates changelog --- CHANGELOG.md | 8 ++++++++ src/Laravel/Commands/PestTestCommand.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51343a9f..3c59eb65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [v1.12.0 (2021-07-26)](https://github.com/pestphp/pest/compare/v1.11.0...v1.12.0) +### Added +- `--force` option to override tests in `pest:test` artisan command ([#353](https://github.com/pestphp/pest/pull/353)) +- Support for PHPUnit `^9.3.7` ([ca9d783](https://github.com/pestphp/pest/commit/ca9d783cf942a2caabc85ff7a728c7f28350c67a)) + +### Fixed +- `beforeAll` and `afterAll` behind called multiple times per test ([#357](https://github.com/pestphp/pest/pull/357)) + ## [v1.11.0 (2021-07-21)](https://github.com/pestphp/pest/compare/v1.10.0...v1.11.0) ### Added - Support for interacting with datasets in higher order tests ([#352](https://github.com/pestphp/pest/pull/352)) diff --git a/src/Laravel/Commands/PestTestCommand.php b/src/Laravel/Commands/PestTestCommand.php index 7561355b..ee18e076 100644 --- a/src/Laravel/Commands/PestTestCommand.php +++ b/src/Laravel/Commands/PestTestCommand.php @@ -56,7 +56,7 @@ final class PestTestCommand extends Command File::makeDirectory(dirname($target), 0777, true, true); } - if (File::exists($target) and !(bool) $this->option('force')) { + if (File::exists($target) && !(bool) $this->option('force')) { throw new InvalidConsoleArgument(sprintf('%s already exist', $target)); } From 4ebba1298ae9d4b50f455ed45a6c17706fe76d3d Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 26 Jul 2021 22:46:22 +0100 Subject: [PATCH 11/19] release: v1.12.0 --- src/Pest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pest.php b/src/Pest.php index cdc57677..38526338 100644 --- a/src/Pest.php +++ b/src/Pest.php @@ -6,7 +6,7 @@ namespace Pest; function version(): string { - return '1.11.0'; + return '1.12.0'; } function testDirectory(string $file = ''): string From 4813ab6ffb51632cd2a4f4752143602057585355 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 26 Jul 2021 23:18:55 +0100 Subject: [PATCH 12/19] Add sponsor --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6823ffee..1280737f 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,9 @@ We would like to extend our thanks to the following sponsors for funding Pest de ### Premium Sponsors - **[Akaunting](https://akaunting.com)** -- **[Scout APM](https://scoutapm.com)** +- **[Codecourse](https://codecourse.com/)** - **[Meema](https://meema.io/)** +- **[Scout APM](https://scoutapm.com)** - **[Spatie](https://spatie.be/)** Pest was created by **[Nuno Maduro](https://twitter.com/enunomaduro)** under the **[Sponsorware license](https://github.com/sponsorware/docs)**. It got open-sourced and is now licensed under the **[MIT license](https://opensource.org/licenses/MIT)**. From 6309e6818d8902e9600c719ac66b724f269d65e8 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 26 Jul 2021 23:19:51 +0100 Subject: [PATCH 13/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1280737f..541d9f24 100644 --- a/README.md +++ b/README.md @@ -27,4 +27,4 @@ We would like to extend our thanks to the following sponsors for funding Pest de - **[Scout APM](https://scoutapm.com)** - **[Spatie](https://spatie.be/)** -Pest was created by **[Nuno Maduro](https://twitter.com/enunomaduro)** under the **[Sponsorware license](https://github.com/sponsorware/docs)**. It got open-sourced and is now licensed under the **[MIT license](https://opensource.org/licenses/MIT)**. +Pest is an open-sourced software licensed under the **[MIT license](https://opensource.org/licenses/MIT)**. From 5f574ded814525931c6adc71448437581cdf07b5 Mon Sep 17 00:00:00 2001 From: freek Date: Wed, 28 Jul 2021 00:36:43 +0200 Subject: [PATCH 14/19] add toBeIn --- src/Expectation.php | 10 ++++++++++ tests/Features/Expect/toBeIn.php | 11 +++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/Features/Expect/toBeIn.php diff --git a/src/Expectation.php b/src/Expectation.php index e41f21d0..2e92434e 100644 --- a/src/Expectation.php +++ b/src/Expectation.php @@ -371,6 +371,16 @@ final class Expectation return $this; } + /** + * Asserts that the value is one of the given values. + */ + public function toBeIn(array $possibleValues): Expectation + { + Assert::assertContains($this->value, $possibleValues); + + return $this; + } + /** * Asserts that the value is infinite. */ diff --git a/tests/Features/Expect/toBeIn.php b/tests/Features/Expect/toBeIn.php new file mode 100644 index 00000000..3d34f46a --- /dev/null +++ b/tests/Features/Expect/toBeIn.php @@ -0,0 +1,11 @@ +toBeIn(['a', 'b', 'c']); +}); + +test('failures', function () { + expect('d')->toBeIn(['a', 'b', 'c']); +})->throws(ExpectationFailedException::class); From 2dd77001b7cc8f2824a5ee2b5d754831212e440b Mon Sep 17 00:00:00 2001 From: freek Date: Wed, 28 Jul 2021 00:42:54 +0200 Subject: [PATCH 15/19] static analysis fix --- src/Expectation.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Expectation.php b/src/Expectation.php index 2e92434e..e32a8683 100644 --- a/src/Expectation.php +++ b/src/Expectation.php @@ -373,6 +373,8 @@ final class Expectation /** * Asserts that the value is one of the given values. + * + * @param array $possibleValues */ public function toBeIn(array $possibleValues): Expectation { From 671f3df115bcf5bcba67c59ed3a635abe0ebf755 Mon Sep 17 00:00:00 2001 From: freek Date: Wed, 28 Jul 2021 01:00:19 +0200 Subject: [PATCH 16/19] fix tests --- src/Expectation.php | 6 +++--- tests/Features/Expect/toBeIn.php | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Expectation.php b/src/Expectation.php index e32a8683..e76a30bd 100644 --- a/src/Expectation.php +++ b/src/Expectation.php @@ -374,11 +374,11 @@ final class Expectation /** * Asserts that the value is one of the given values. * - * @param array $possibleValues + * @param iterable $values */ - public function toBeIn(array $possibleValues): Expectation + public function toBeIn(iterable $values): Expectation { - Assert::assertContains($this->value, $possibleValues); + Assert::assertContains($this->value, $values); return $this; } diff --git a/tests/Features/Expect/toBeIn.php b/tests/Features/Expect/toBeIn.php index 3d34f46a..6636a51b 100644 --- a/tests/Features/Expect/toBeIn.php +++ b/tests/Features/Expect/toBeIn.php @@ -4,8 +4,13 @@ use PHPUnit\Framework\ExpectationFailedException; test('passes', function () { expect('a')->toBeIn(['a', 'b', 'c']); + expect('d')->not->toBeIn(['a', 'b', 'c']); }); test('failures', function () { expect('d')->toBeIn(['a', 'b', 'c']); })->throws(ExpectationFailedException::class); + +test('not failures', function () { + expect('a')->not->toBeIn(['a', 'b', 'c']); +})->throws(ExpectationFailedException::class); From 22b822ce87a3d19d84960fa5c93eb286820b525d Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Wed, 28 Jul 2021 01:57:13 +0100 Subject: [PATCH 17/19] fix: skip with a false condition being ignored --- src/PendingObjects/TestCall.php | 2 ++ tests/.snapshots/success.txt | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/PendingObjects/TestCall.php b/src/PendingObjects/TestCall.php index 81bf9243..de74cf99 100644 --- a/src/PendingObjects/TestCall.php +++ b/src/PendingObjects/TestCall.php @@ -148,6 +148,8 @@ final class TestCall ? $conditionOrMessage : $message; + $condition = $condition->bindTo(null); + $this->testCaseFactory ->chains ->addWhen($condition, Backtrace::file(), Backtrace::line(), 'markTestSkipped', [$message]); diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index d943da92..74ededc0 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -101,6 +101,7 @@ ✓ 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 @@ -112,11 +113,14 @@ ✓ 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 @@ -128,6 +132,7 @@ ✓ 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 @@ -216,6 +221,11 @@ PASS Tests\Features\Expect\toBeGreatherThanOrEqual ✓ passes ✓ failures + ✓ not failures + + PASS Tests\Features\Expect\toBeIn + ✓ passes + ✓ failures ✓ not failures PASS Tests\Features\Expect\toBeInfinite @@ -411,7 +421,12 @@ ✓ 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 @@ -444,6 +459,8 @@ ✓ 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 @@ -457,12 +474,14 @@ 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 @@ -581,5 +600,5 @@ ✓ it is a test ✓ it uses correct parent class - Tests: 4 incompleted, 7 skipped, 365 passed + Tests: 4 incompleted, 9 skipped, 380 passed \ No newline at end of file From 2b5355419a64ed031b5f07003b48d0c77dd68cf8 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Wed, 28 Jul 2021 01:59:47 +0100 Subject: [PATCH 18/19] chore: fixes types --- src/PendingObjects/TestCall.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PendingObjects/TestCall.php b/src/PendingObjects/TestCall.php index de74cf99..be839bff 100644 --- a/src/PendingObjects/TestCall.php +++ b/src/PendingObjects/TestCall.php @@ -148,6 +148,7 @@ final class TestCall ? $conditionOrMessage : $message; + /** @var callable(): bool $condition */ $condition = $condition->bindTo(null); $this->testCaseFactory From cd9d4acbc2b5e1db65f428037737aad1d2980063 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Wed, 28 Jul 2021 02:03:24 +0100 Subject: [PATCH 19/19] release: v1.13.0 --- CHANGELOG.md | 7 +++++++ src/Pest.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c59eb65..0b05a97d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [v1.13.0 (2021-07-28)](https://github.com/pestphp/pest/compare/v1.12.0...v1.13.0) +### Added +- `toBeIn` expectation ([#363](https://github.com/pestphp/pest/pull/363)) + +### Fixed +- `skip` with false condition marking test as skipped ([22b822c](https://github.com/pestphp/pest/commit/22b822ce87a3d19d84960fa5c93eb286820b525d)) + ## [v1.12.0 (2021-07-26)](https://github.com/pestphp/pest/compare/v1.11.0...v1.12.0) ### Added - `--force` option to override tests in `pest:test` artisan command ([#353](https://github.com/pestphp/pest/pull/353)) diff --git a/src/Pest.php b/src/Pest.php index 38526338..d9efe05f 100644 --- a/src/Pest.php +++ b/src/Pest.php @@ -6,7 +6,7 @@ namespace Pest; function version(): string { - return '1.12.0'; + return '1.13.0'; } function testDirectory(string $file = ''): string