Pest.php 1.5 KB

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