Skip to content

Commit

Permalink
Install and set up Pest
Browse files Browse the repository at this point in the history
  • Loading branch information
bakerkretzmar committed May 16, 2024
1 parent 638178b commit 3d3929d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"require-dev": {
"laravel/folio": "^1.1",
"orchestra/testbench": "^7.0 || ^8.0 || ^9.0",
"phpunit/phpunit": "^9.5 || ^10.3"
"pestphp/pest": "^2.26"
},
"autoload": {
"psr-4": {
Expand All @@ -54,7 +54,8 @@
"optimize-autoloader": true,
"sort-packages": true,
"allow-plugins": {
"kylekatarnls/update-helper": true
"kylekatarnls/update-helper": true,
"pestphp/pest-plugin": true
}
},
"minimum-stability": "dev",
Expand Down
45 changes: 45 additions & 0 deletions tests/Pest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/*
|--------------------------------------------------------------------------
| Test Case
|--------------------------------------------------------------------------
|
| The closure you provide to your test functions is always bound to a specific PHPUnit test
| case class. By default, that class is "PHPUnit\Framework\TestCase". Of course, you may
| need to change it using the "uses()" function to bind a different classes or traits.
|
*/

uses(Tests\TestCase::class)->in('Unit');

/*
|--------------------------------------------------------------------------
| Expectations
|--------------------------------------------------------------------------
|
| When you're writing tests, you often need to check that values meet certain conditions. The
| "expect()" function gives you access to a set of "expectations" methods that you can use
| to assert different things. Of course, you may extend the Expectation API at any time.
|
*/

expect()->extend('toBeOne', function () {
return $this->toBe(1);
});

/*
|--------------------------------------------------------------------------
| Functions
|--------------------------------------------------------------------------
|
| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
| project that you don't want to repeat in every file. Here you can also expose helpers as
| global functions to help you to reduce the number of lines of code in your test files.
|
*/

function something()
{
// ..
}
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Tighten\Ziggy\Ziggy;
use Tighten\Ziggy\ZiggyServiceProvider;

class TestCase extends OrchestraTestCase
abstract class TestCase extends OrchestraTestCase
{
protected function tearDown(): void
{
Expand Down

0 comments on commit 3d3929d

Please sign in to comment.