mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 07:47:22 +01:00
feat(expect): makes expect work with pending higher order tests
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
✓ that gets executed
|
||||
|
||||
PASS Tests\Expect\toBe
|
||||
✓ expect true → toBeTrue → and false → toBeFalse
|
||||
✓ strict comparisons
|
||||
✓ failures
|
||||
✓ not failures
|
||||
@ -211,9 +212,9 @@
|
||||
PASS Tests\Features\HigherOrderTests
|
||||
✓ it proxies calls to object
|
||||
|
||||
WARN Tests\Features\It
|
||||
PASS Tests\Features\It
|
||||
✓ it is a test
|
||||
! it is a higher order message test → This test did not perform any assertions /Users/nunomaduro/pestphp/pest/src/Factories/TestCaseFactory.php(204) : eval()'d code:4
|
||||
✓ it is a higher order message test
|
||||
|
||||
PASS Tests\Features\Macro
|
||||
✓ it can call chained macro method
|
||||
@ -223,8 +224,8 @@
|
||||
✓ it has bar
|
||||
|
||||
PASS Tests\Features\PendingHigherOrderTests
|
||||
✓ get 'foo' → get 'bar'
|
||||
✓ get 'foo'
|
||||
✓ get 'foo' → get 'bar' → expect true → toBeTrue
|
||||
✓ get 'foo' → expect true → toBeTrue
|
||||
|
||||
WARN Tests\Features\Skip
|
||||
✓ it do not skips
|
||||
@ -235,9 +236,9 @@
|
||||
✓ it do not skips with falsy closure condition
|
||||
- it skips with condition and message → skipped because foo
|
||||
|
||||
WARN Tests\Features\Test
|
||||
PASS Tests\Features\Test
|
||||
✓ a test
|
||||
! higher order message test → This test did not perform any assertions /Users/nunomaduro/pestphp/pest/src/Factories/TestCaseFactory.php(204) : eval()'d code:4
|
||||
✓ higher order message test
|
||||
|
||||
PASS Tests\Fixtures\DirectoryWithTests\ExampleTest
|
||||
✓ it example 1
|
||||
@ -307,5 +308,5 @@
|
||||
WARN Tests\Visual\Success
|
||||
- visual snapshot of test suite on success
|
||||
|
||||
Tests: 2 risked, 6 skipped, 178 passed
|
||||
Tests: 6 skipped, 181 passed
|
||||
Time: 5.70s
|
||||
|
||||
@ -2,12 +2,13 @@
|
||||
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
|
||||
expect(true)->toBeTrue()->and(false)->toBeFalse();
|
||||
|
||||
test('strict comparisons', function () {
|
||||
$nuno = new stdClass();
|
||||
$dries = new stdClass();
|
||||
|
||||
expect($nuno)->toBe($nuno);
|
||||
expect($nuno)->not->toBe($dries);
|
||||
expect($nuno)->toBe($nuno)->not->toBe($dries);
|
||||
});
|
||||
|
||||
test('failures', function () {
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use function PHPUnit\Framework\assertFalse;
|
||||
|
||||
$foo = new stdClass();
|
||||
$foo->beforeAll = false;
|
||||
$foo->beforeEach = false;
|
||||
@ -20,8 +22,8 @@ afterAll(function () {
|
||||
});
|
||||
|
||||
register_shutdown_function(function () use ($foo) {
|
||||
expect($foo->beforeAll)->toBeFalse();
|
||||
expect($foo->beforeEach)->toBeFalse();
|
||||
expect($foo->afterEach)->toBeFalse();
|
||||
expect($foo->afterAll)->toBeFalse();
|
||||
assertFalse($foo->beforeAll);
|
||||
assertFalse($foo->beforeEach);
|
||||
assertFalse($foo->afterEach);
|
||||
assertFalse($foo->afterAll);
|
||||
});
|
||||
|
||||
@ -22,6 +22,7 @@ test('visual snapshot of test suite on success', function () {
|
||||
$output = explode("\n", $output());
|
||||
array_pop($output);
|
||||
array_pop($output);
|
||||
|
||||
expect(file_get_contents($snapshot))->toContain(implode("\n", $output));
|
||||
}
|
||||
})->skip(!getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE'))
|
||||
|
||||
Reference in New Issue
Block a user