Merge pull request #413 from def-studio/fix_skipping_tests_with_exception_asserting

Fix skipping tests with exception asserting
This commit is contained in:
Nuno Maduro
2021-10-02 12:01:04 +01:00
committed by GitHub
2 changed files with 7 additions and 1 deletions

View File

@ -144,8 +144,8 @@ final class TestCaseFactory
* @return mixed
*/
$test = function () use ($chains, $proxies, $factoryTest) {
$proxies->proxy($this);
$chains->chain($this);
$proxies->proxy($this);
/* @phpstan-ignore-next-line */
return call_user_func(Closure::bind($factoryTest, $this, get_class($this)), ...func_get_args());

View File

@ -1,5 +1,7 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
it('gives access the the underlying expectException', function () {
$this->expectException(InvalidArgumentException::class);
@ -37,3 +39,7 @@ it('can just define the message if given condition is true', function () {
it('can just define the message if given condition is 1', function () {
throw new Exception('Something bad happened');
})->throwsIf(1, 'Something bad happened');
it('can handle a skipped test if it is trying to catch an exception', function () {
expect(1)->toBe(2);
})->throws(ExpectationFailedException::class)->skip('this test should be skipped')->only();