Skip to content

Commit

Permalink
fix: skip with a false condition being ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Jul 28, 2021
1 parent b2c298b commit 22b822c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/PendingObjects/TestCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ public function skip($conditionOrMessage = true, string $message = ''): TestCall
? $conditionOrMessage
: $message;

$condition = $condition->bindTo(null);

$this->testCaseFactory
->chains
->addWhen($condition, Backtrace::file(), Backtrace::line(), 'markTestSkipped', [$message]);
Expand Down
21 changes: 20 additions & 1 deletion tests/.snapshots/success.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 22b822c

Please sign in to comment.