Skip to content

Commit

Permalink
PEST
Browse files Browse the repository at this point in the history
  • Loading branch information
marcreichel authored Mar 10, 2024
1 parent 9e2056e commit c412f58
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 21 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ jobs:
- uses: actions/checkout@v2
- name: Install dependencies
run: composer install --prefer-dist --no-progress --dev
- name: Run analysis
run: composer stan
- run: composer stan -- --error-format=github
3 changes: 1 addition & 2 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ jobs:
- uses: actions/checkout@v2
- name: Install dependencies
run: composer install --prefer-dist --no-progress --dev
- name: Run pint
run: composer pint
- run: composer pint
5 changes: 2 additions & 3 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ jobs:
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Run tests
run: vendor/bin/phpunit --coverage-clover coverage.xml
- run: composer test:coverage

- name: Upload
uses: codecov/codecov-action@v1
with:
files: ./coverage.xml
files: ./build/clover.xml
12 changes: 4 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,24 @@ on:

jobs:
run-tests:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.3, 8.2, 8.1]
laravel: ['9.*', '10.*', '11.*']
laravel: ['10.*', '11.*']
stability: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*
- laravel: 11.*
testbench: 9.*
exclude:
- laravel: 11.*
php: 8.1

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.stability }}

steps:
- name: Checkout code
Expand All @@ -50,5 +47,4 @@ jobs:
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit
- run: composer test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ composer.lock
.phpunit.cache
.phpunit.result.cache
cghooks.lock
coverage.xml

17 changes: 11 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"nunomaduro/collision": "^5.3|^6.1|^7.0|^8.0",
"roave/security-advisories": "dev-latest",
"larastan/larastan": "^2.9.2",
"laravel/pint": "^1.13"
"laravel/pint": "^1.13",
"pestphp/pest": "^2"
},
"license": "MIT",
"authors": [
Expand All @@ -35,16 +36,15 @@
],
"scripts": {
"pint": "./vendor/bin/pint --test -v",
"test": "./vendor/bin/testbench package:test",
"stan": "./vendor/bin/phpstan analyse -c phpstan.neon",
"stan-2g": "./vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=2G",
"test": "./vendor/bin/pest --parallel -v",
"stan": "./vendor/bin/phpstan --memory-limit=2G",
"test:coverage": [
"@putenv XDEBUG_MODE=coverage",
"./vendor/bin/phpunit --coverage-clover=\"build/clover.xml\""
"@test --coverage-clover build/clover.xml"
],
"test:coverage-html": [
"@putenv XDEBUG_MODE=coverage",
"./vendor/bin/phpunit --color=always --coverage-html=\"report\""
"@test --coverage-html build/coverage"
]
},
"autoload": {
Expand All @@ -63,5 +63,10 @@
"MarcReichel\\IGDBLaravel\\IGDBLaravelServiceProvider"
]
}
},
"config": {
"allow-plugins": {
"pestphp/pest-plugin": true
}
}
}
47 changes: 47 additions & 0 deletions tests/Pest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

declare(strict_types=1);

/*
|--------------------------------------------------------------------------
| 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('Feature');

/*
|--------------------------------------------------------------------------
| 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()
{
// ..
} */

0 comments on commit c412f58

Please sign in to comment.