mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 17:27:22 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 97dc32f9d2 | |||
| a3ab065343 | |||
| c390721ac3 | |||
| f83d758d4b | |||
| e00aba539a |
@ -23,10 +23,10 @@
|
|||||||
"nunomaduro/termwind": "^1.15.1|^2.0.0",
|
"nunomaduro/termwind": "^1.15.1|^2.0.0",
|
||||||
"pestphp/pest-plugin": "^2.1.1",
|
"pestphp/pest-plugin": "^2.1.1",
|
||||||
"pestphp/pest-plugin-arch": "^2.5.0",
|
"pestphp/pest-plugin-arch": "^2.5.0",
|
||||||
"phpunit/phpunit": "^10.5.3"
|
"phpunit/phpunit": "^10.5.5"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"phpunit/phpunit": ">10.5.3",
|
"phpunit/phpunit": ">10.5.5",
|
||||||
"sebastian/exporter": "<5.1.0",
|
"sebastian/exporter": "<5.1.0",
|
||||||
"webmozart/assert": "<1.11.0"
|
"webmozart/assert": "<1.11.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -18,6 +18,7 @@ use Pest\Support\HigherOrderCallables;
|
|||||||
use Pest\Support\NullClosure;
|
use Pest\Support\NullClosure;
|
||||||
use Pest\Support\Str;
|
use Pest\Support\Str;
|
||||||
use Pest\TestSuite;
|
use Pest\TestSuite;
|
||||||
|
use PHPUnit\Framework\AssertionFailedError;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,6 +58,14 @@ final class TestCall
|
|||||||
$this->testSuite->beforeEach->get($this->filename)[0]($this);
|
$this->testSuite->beforeEach->get($this->filename)[0]($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asserts that the test fails with the given message.
|
||||||
|
*/
|
||||||
|
public function fails(?string $message = null): self
|
||||||
|
{
|
||||||
|
return $this->throws(AssertionFailedError::class, $message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asserts that the test throws the given `$exceptionClass` when called.
|
* Asserts that the test throws the given `$exceptionClass` when called.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -6,7 +6,7 @@ namespace Pest;
|
|||||||
|
|
||||||
function version(): string
|
function version(): string
|
||||||
{
|
{
|
||||||
return '2.29.0';
|
return '2.30.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDirectory(string $file = ''): string
|
function testDirectory(string $file = ''): string
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Pest Testing Framework 2.29.0.
|
Pest Testing Framework 2.30.0.
|
||||||
|
|
||||||
USAGE: pest <file> [options]
|
USAGE: pest <file> [options]
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
|
|
||||||
Pest Testing Framework 2.29.0.
|
Pest Testing Framework 2.30.0.
|
||||||
|
|
||||||
|
|||||||
@ -898,6 +898,14 @@
|
|||||||
✓ it skips with falsy closure condition
|
✓ it skips with falsy closure condition
|
||||||
✓ it can be used in higher order tests
|
✓ it can be used in higher order tests
|
||||||
|
|
||||||
|
PASS Tests\Features\Fail
|
||||||
|
✓ it may fail
|
||||||
|
✓ it may fail with the given message
|
||||||
|
|
||||||
|
PASS Tests\Features\Fails
|
||||||
|
✓ it may fail
|
||||||
|
✓ it may fail with the given message
|
||||||
|
|
||||||
WARN Tests\Features\Helpers
|
WARN Tests\Features\Helpers
|
||||||
✓ it can set/get properties on $this
|
✓ it can set/get properties on $this
|
||||||
! it gets null if property do not exist → Undefined property Tests\Features\Helpers::$wqdwqdqw
|
! it gets null if property do not exist → Undefined property Tests\Features\Helpers::$wqdwqdqw
|
||||||
@ -1356,4 +1364,4 @@
|
|||||||
WARN Tests\Visual\Version
|
WARN Tests\Visual\Version
|
||||||
- visual snapshot of help command output
|
- visual snapshot of help command output
|
||||||
|
|
||||||
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 966 passed (2286 assertions)
|
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 970 passed (2296 assertions)
|
||||||
11
tests/Features/Fail.php
Normal file
11
tests/Features/Fail.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use PHPUnit\Framework\AssertionFailedError;
|
||||||
|
|
||||||
|
it('may fail', function () {
|
||||||
|
$this->fail();
|
||||||
|
})->throws(AssertionFailedError::class);
|
||||||
|
|
||||||
|
it('may fail with the given message', function () {
|
||||||
|
$this->fail('this is a failure');
|
||||||
|
})->throws(AssertionFailedError::class, 'this is a failure');
|
||||||
9
tests/Features/Fails.php
Normal file
9
tests/Features/Fails.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
it('may fail', function () {
|
||||||
|
$this->fail();
|
||||||
|
})->fails();
|
||||||
|
|
||||||
|
it('may fail with the given message', function () {
|
||||||
|
$this->fail('this is a failure');
|
||||||
|
})->fails('this is a failure');
|
||||||
@ -16,7 +16,7 @@ $run = function () {
|
|||||||
|
|
||||||
test('parallel', function () use ($run) {
|
test('parallel', function () use ($run) {
|
||||||
expect($run('--exclude-group=integration'))
|
expect($run('--exclude-group=integration'))
|
||||||
->toContain('Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 15 skipped, 953 passed (2267 assertions)')
|
->toContain('Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 15 skipped, 957 passed (2277 assertions)')
|
||||||
->toContain('Parallel: 3 processes');
|
->toContain('Parallel: 3 processes');
|
||||||
})->skipOnWindows();
|
})->skipOnWindows();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user