feat: add Pest helper functions for testing
This commit introduces helper functions for running tests in Pest, including `afterEach`, `beforeEach`, `test`, and `it`.
This commit is contained in:
parent
d1a4f83feb
commit
ec6c1cf9f0
1 changed files with 55 additions and 0 deletions
55
.intellipest/_pest-helper.php
Normal file
55
.intellipest/_pest-helper.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace {
|
||||
|
||||
/**
|
||||
* Runs the given closure after each test in the current file.
|
||||
*
|
||||
* @param-closure-this \Tests\TestCase $closure
|
||||
*/
|
||||
function afterEach(?Closure $closure = null): \Pest\PendingCalls\AfterEachCall {}
|
||||
|
||||
/**
|
||||
* Runs the given closure before each test in the current file.
|
||||
*
|
||||
* @param-closure-this \Tests\TestCase $closure
|
||||
*/
|
||||
function beforeEach(?Closure $closure = null): \Pest\PendingCalls\BeforeEachCall {}
|
||||
|
||||
/**
|
||||
* Adds the given closure as a test. The first argument
|
||||
* is the test description; the second argument is
|
||||
* a closure that contains the test expectations.
|
||||
*
|
||||
* @param-closure-this \Tests\TestCase $closure
|
||||
*
|
||||
* @return ($description is string ? TestCall : HigherOrderTapProxy|TestCall)
|
||||
*/
|
||||
function test(?string $description = null, ?Closure $closure = null): \Pest\Support\HigherOrderTapProxy|\Pest\PendingCalls\TestCall {}
|
||||
|
||||
/**
|
||||
* Adds the given closure as a test. The first argument
|
||||
* is the test description; the second argument is
|
||||
* a closure that contains the test expectations.
|
||||
*
|
||||
* @param-closure-this \Tests\TestCase $closure
|
||||
*/
|
||||
function it(string $description, ?Closure $closure = null): \Pest\PendingCalls\TestCall {}
|
||||
|
||||
}
|
||||
|
||||
namespace Pest {
|
||||
|
||||
class Expectation {
|
||||
public function toBeOne(): self {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace Pest\Expectations {
|
||||
|
||||
class OppositeExpectation {
|
||||
public function toBeOne(): self {}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue