Skip to content

Commit

Permalink
Merge pull request #756 from tighten/pest
Browse files Browse the repository at this point in the history
Pest
  • Loading branch information
bakerkretzmar authored May 17, 2024
2 parents c0ee79a + 0143786 commit 80774e7
Show file tree
Hide file tree
Showing 15 changed files with 1,180 additions and 1,795 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ jobs:
test:
name: ${{ matrix.os[0] }}, PHP ${{ matrix.php }}, Laravel ${{ matrix.laravel }}
runs-on: ${{ matrix.os[1] }}
continue-on-error: ${{ matrix.php == 8.3 }}
continue-on-error: ${{ matrix.php == 8.4 }}
strategy:
matrix:
os: [[Ubuntu, ubuntu-latest], [Windows, windows-latest]]
php: [8.1, 8.2, 8.3]
php: [8.1, 8.2, 8.3, 8.4]
laravel: [9, 10, 11]
exclude:
- php: 8.1
laravel: 11
include:
- php: 8.3
- php: 8.4
composer: --ignore-platform-req=php+
steps:
- uses: actions/checkout@v4
Expand All @@ -34,12 +34,14 @@ jobs:
with:
node-version: 20
cache: 'npm'
- run: composer remove laravel/folio --dev --no-update --no-interaction
if: matrix.laravel == 9
- if: matrix.laravel == 9
run: |
composer remove laravel/folio --dev --no-update --no-interaction
composer require pestphp/pest:"1.*" pestphp/pest-plugin-laravel:"1.*" phpunit/phpunit:"9.*" --dev --no-update --no-interaction
- run: composer require laravel/framework:"${{ matrix.laravel }}.*" --no-update --no-interaction
- uses: ramsey/composer-install@v2
- uses: ramsey/composer-install@v3
with:
composer-options: ${{ matrix.composer }}
- run: vendor/bin/phpunit --testdox --colors=always
- run: vendor/bin/pest
- run: npm ci && npm run build
- run: npm run test
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"require-dev": {
"laravel/folio": "^1.1",
"orchestra/testbench": "^7.0 || ^8.0 || ^9.0",
"phpunit/phpunit": "^9.5 || ^10.3"
"pestphp/pest": "^2.26",
"pestphp/pest-plugin-laravel": "^2.4"
},
"autoload": {
"psr-4": {
Expand All @@ -54,7 +55,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
1 change: 0 additions & 1 deletion src/CommandRouteGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Str;
use Tighten\Ziggy\Output\File;
use Tighten\Ziggy\Output\Types;
use Tighten\Ziggy\Ziggy;
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()
{
// ..
}
10 changes: 1 addition & 9 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

namespace Tests;

use Closure;
use Orchestra\Testbench\TestCase as OrchestraTestCase;
use Tighten\Ziggy\Ziggy;
use Tighten\Ziggy\ZiggyServiceProvider;

class TestCase extends OrchestraTestCase
abstract class TestCase extends OrchestraTestCase
{
protected function tearDown(): void
{
Expand All @@ -20,11 +19,4 @@ protected function getPackageProviders($app)
{
return [ZiggyServiceProvider::class];
}

protected function noop(): Closure
{
return function () {
return '';
};
}
}
Loading

0 comments on commit 80774e7

Please sign in to comment.