diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 94c43db..d1516ac 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -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 diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index b84c223..57db375 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -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 diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 18dd534..8ed9c46 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4c33c57..eb75edf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 @@ -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 diff --git a/.gitignore b/.gitignore index 15b97d6..685f9b3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ composer.lock .phpunit.cache .phpunit.result.cache cghooks.lock +coverage.xml diff --git a/composer.json b/composer.json index 5087e90..5c0914a 100644 --- a/composer.json +++ b/composer.json @@ -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": [ @@ -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": { @@ -63,5 +63,10 @@ "MarcReichel\\IGDBLaravel\\IGDBLaravelServiceProvider" ] } + }, + "config": { + "allow-plugins": { + "pestphp/pest-plugin": true + } } } diff --git a/tests/Pest.php b/tests/Pest.php new file mode 100644 index 0000000..b23fb52 --- /dev/null +++ b/tests/Pest.php @@ -0,0 +1,47 @@ +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() +{ + // .. +} */