Pest.php 1.6 KB

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