mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 17:27:22 +01:00
feat(expect): makes expect work with pending higher order tests
This commit is contained in:
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Pest\Concerns;
|
||||
|
||||
use Closure;
|
||||
use Pest\Expectation;
|
||||
use Pest\Support\ExceptionTrace;
|
||||
use Pest\TestSuite;
|
||||
use PHPUnit\Util\Test;
|
||||
@ -87,6 +88,16 @@ trait TestCase
|
||||
parent::tearDownAfterClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new expectation.
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function expect($value): Expectation
|
||||
{
|
||||
return new Expectation($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets executed before the test.
|
||||
*/
|
||||
|
||||
@ -30,6 +30,16 @@ final class Expectation
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new expectation.
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function and($value): Expectation
|
||||
{
|
||||
return new self($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the opposite expectation for the value.
|
||||
*/
|
||||
|
||||
@ -5,7 +5,6 @@ declare(strict_types=1);
|
||||
namespace Pest\PendingObjects;
|
||||
|
||||
use Closure;
|
||||
use Pest\Expectation;
|
||||
use Pest\Factories\TestCaseFactory;
|
||||
use Pest\Support\Backtrace;
|
||||
use Pest\Support\NullClosure;
|
||||
@ -13,6 +12,8 @@ use Pest\TestSuite;
|
||||
use SebastianBergmann\Exporter\Exporter;
|
||||
|
||||
/**
|
||||
* @method \Pest\Expectation expect(mixed $value)
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
final class TestCall
|
||||
@ -85,16 +86,6 @@ final class TestCall
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new expectation.
|
||||
*
|
||||
* @param mixed $value the Value
|
||||
*/
|
||||
public function expect($value): Expectation
|
||||
{
|
||||
return expect($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the test depends.
|
||||
*/
|
||||
|
||||
@ -110,8 +110,10 @@ function afterAll(Closure $closure = null): void
|
||||
* Creates a new expectation.
|
||||
*
|
||||
* @param mixed $value the Value
|
||||
*
|
||||
* @return Expectation
|
||||
*/
|
||||
function expect($value): Expectation
|
||||
function expect($value)
|
||||
{
|
||||
return new Expectation($value);
|
||||
return test()->expect($value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user