fix: skip with a false condition being ignored

This commit is contained in:
Nuno Maduro
2021-07-28 01:57:13 +01:00
parent b2c298b926
commit 22b822ce87
2 changed files with 22 additions and 1 deletions

View File

@ -148,6 +148,8 @@ final class TestCall
? $conditionOrMessage ? $conditionOrMessage
: $message; : $message;
$condition = $condition->bindTo(null);
$this->testCaseFactory $this->testCaseFactory
->chains ->chains
->addWhen($condition, Backtrace::file(), Backtrace::line(), 'markTestSkipped', [$message]); ->addWhen($condition, Backtrace::file(), Backtrace::line(), 'markTestSkipped', [$message]);

View File

@ -101,6 +101,7 @@
✓ it gives access the the underlying expectException ✓ it gives access the the underlying expectException
✓ it catch exceptions ✓ it catch exceptions
✓ it catch exceptions and messages ✓ it catch exceptions and messages
✓ it can just define the message
PASS Tests\Features\Expect\HigherOrder\methods PASS Tests\Features\Expect\HigherOrder\methods
✓ it can access methods ✓ it can access methods
@ -112,11 +113,14 @@
✓ it works with sequence ✓ it works with sequence
✓ it can compose complex expectations ✓ it can compose complex expectations
✓ it can handle nested method calls ✓ it can handle nested method calls
✓ it works with higher order tests
PASS Tests\Features\Expect\HigherOrder\methodsAndProperties PASS Tests\Features\Expect\HigherOrder\methodsAndProperties
✓ it can access methods and properties ✓ it can access methods and properties
✓ it can handle nested 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
✓ it can start a new higher order expectation using the and syntax in higher order tests
PASS Tests\Features\Expect\HigherOrder\properties PASS Tests\Features\Expect\HigherOrder\properties
✓ it allows properties to be accessed from the value ✓ it allows properties to be accessed from the value
@ -128,6 +132,7 @@
✓ it can compose complex expectations ✓ it can compose complex expectations
✓ it works with objects ✓ it works with objects
✓ it works with nested properties ✓ it works with nested properties
✓ it works with higher order tests
PASS Tests\Features\Expect\each PASS Tests\Features\Expect\each
✓ an exception is thrown if the the type is not iterable ✓ an exception is thrown if the the type is not iterable
@ -216,6 +221,11 @@
PASS Tests\Features\Expect\toBeGreatherThanOrEqual PASS Tests\Features\Expect\toBeGreatherThanOrEqual
✓ passes ✓ passes
✓ failures ✓ failures
✓ not failures
PASS Tests\Features\Expect\toBeIn
✓ passes
✓ failures
✓ not failures ✓ not failures
PASS Tests\Features\Expect\toBeInfinite PASS Tests\Features\Expect\toBeInfinite
@ -411,7 +421,12 @@
✓ it proxies calls to object ✓ it proxies calls to object
✓ it is capable doing multiple assertions ✓ it is capable doing multiple assertions
✓ it resolves expect callables correctly ✓ it resolves expect callables correctly
✓ does not treat method names as callables
✓ it can tap into the test ✓ 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 WARN Tests\Features\Incompleted
… incompleted … incompleted
@ -444,6 +459,8 @@
✓ it do not skips with falsy closure condition ✓ it do not skips with falsy closure condition
- it skips with condition and message → skipped because foo - it skips with condition and message → skipped because foo
- it skips when skip after assertion - 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 PASS Tests\Features\Test
✓ a test ✓ a test
@ -457,12 +474,14 @@
PASS Tests\Hooks\AfterAllTest PASS Tests\Hooks\AfterAllTest
✓ global afterAll execution order ✓ global afterAll execution order
✓ it only gets called once per file
PASS Tests\Hooks\AfterEachTest PASS Tests\Hooks\AfterEachTest
✓ global afterEach execution order ✓ global afterEach execution order
PASS Tests\Hooks\BeforeAllTest PASS Tests\Hooks\BeforeAllTest
✓ global beforeAll execution order ✓ global beforeAll execution order
✓ it only gets called once per file
PASS Tests\Hooks\BeforeEachTest PASS Tests\Hooks\BeforeEachTest
✓ global beforeEach execution order ✓ global beforeEach execution order
@ -581,5 +600,5 @@
✓ it is a test ✓ it is a test
✓ it uses correct parent class ✓ it uses correct parent class
Tests: 4 incompleted, 7 skipped, 365 passed Tests: 4 incompleted, 9 skipped, 380 passed