mirror of
https://github.com/pestphp/pest.git
synced 2026-03-07 00:07:22 +01:00
Adds expect extend
This commit is contained in:
@ -2,6 +2,12 @@
|
||||
PASS Tests\CustomTestCase\ExecutedTest
|
||||
✓ that gets executed
|
||||
|
||||
PASS Tests\Expect\extend
|
||||
✓ it macros true is true
|
||||
✓ it macros false is not true
|
||||
✓ it macros true is true with argument
|
||||
✓ it macros false is not true with argument
|
||||
|
||||
PASS Tests\Expect\not
|
||||
✓ not property calls
|
||||
|
||||
@ -404,5 +410,5 @@
|
||||
✓ depends run test only once
|
||||
✓ depends works with the correct test name
|
||||
|
||||
Tests: 7 skipped, 238 passed
|
||||
Tests: 7 skipped, 242 passed
|
||||
|
||||
29
tests/Expect/extend.php
Normal file
29
tests/Expect/extend.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
expect()->extend('toBeAMacroExpectation', function () {
|
||||
$this->toBeTrue();
|
||||
|
||||
return $this;
|
||||
});
|
||||
|
||||
expect()->extend('toBeAMacroExpectationWithArguments', function (bool $value) {
|
||||
$this->toBe($value);
|
||||
|
||||
return $this;
|
||||
});
|
||||
|
||||
it('macros true is true', function () {
|
||||
expect(true)->toBeAMacroExpectation();
|
||||
});
|
||||
|
||||
it('macros false is not true', function () {
|
||||
expect(false)->not->toBeAMacroExpectation();
|
||||
});
|
||||
|
||||
it('macros true is true with argument', function () {
|
||||
expect(true)->toBeAMacroExpectationWithArguments(true);
|
||||
});
|
||||
|
||||
it('macros false is not true with argument', function () {
|
||||
expect(false)->not->toBeAMacroExpectationWithArguments(true);
|
||||
});
|
||||
Reference in New Issue
Block a user