pratiksh404 /
nepalidate
| 1 | <?php |
||
| 2 | |||
| 3 | use Pratiksh\Nepalidate\Tests\TestCase; |
||
| 4 | |||
| 5 | /* |
||
| 6 | |-------------------------------------------------------------------------- |
||
| 7 | | Test Case |
||
| 8 | |-------------------------------------------------------------------------- |
||
| 9 | | |
||
| 10 | | The closure you provide to your test functions is always bound to a specific PHPUnit test |
||
| 11 | | case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may |
||
| 12 | | need to change it using the "uses()" function to bind a different classes or traits. |
||
| 13 | | |
||
| 14 | */ |
||
| 15 | |||
| 16 | uses(TestCase::class)->in('Feature', 'Unit'); |
||
| 17 | |||
| 18 | /* |
||
| 19 | |-------------------------------------------------------------------------- |
||
| 20 | | Expectations |
||
| 21 | |-------------------------------------------------------------------------- |
||
| 22 | | |
||
| 23 | | When you're writing tests, you often need to check that values meet certain conditions. The |
||
| 24 | | "expect()" function gives you access to a set of "expectations" methods that you can use |
||
| 25 | | to assert different things. Of course, you may extend the Expectation API at any time. |
||
| 26 | | |
||
| 27 | */ |
||
| 28 | |||
| 29 | expect()->extend('toBeOne', function () { |
||
| 30 | return $this->toBe(1); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 31 | }); |
||
| 32 | |||
| 33 | /* |
||
| 34 | |-------------------------------------------------------------------------- |
||
| 35 | | Functions |
||
| 36 | |-------------------------------------------------------------------------- |
||
| 37 | | |
||
| 38 | | While Pest is very powerful out-of-the-box, you may have some testing code specific to your |
||
| 39 | | project that you don't want to repeat in every file. Here you can also expose helpers as |
||
| 40 | | global functions to help you to reduce the number of lines of code in your test files. |
||
| 41 | | |
||
| 42 | */ |
||
| 43 | |||
| 44 | function something() |
||
| 45 | { |
||
| 46 | // .. |
||
| 47 | } |
||
| 48 |