Skip to content

Commit

Permalink
Merge pull request #27 from worksome/feature/laravel-11
Browse files Browse the repository at this point in the history
feat: add support for Laravel 11 and Pest 2.x
  • Loading branch information
owenvoke authored Apr 1, 2024
2 parents c444488 + d0c2c89 commit 9c7b301
Show file tree
Hide file tree
Showing 17 changed files with 55 additions and 129 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Dependabot
name: Dependabot Auto-Merge
on: pull_request_target

permissions:
Expand All @@ -7,27 +7,26 @@ permissions:

jobs:
dependabot:
name: Auto Merge
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:

- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.3.5
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Auto-merge Dependabot PRs for semver-minor updates
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-minor' }}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Auto-merge Dependabot PRs for semver-patch updates
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' }}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
name: PHPStan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.2]
laravel: [10.*]
php: [8.2, 8.3]
laravel: [10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*

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

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -38,6 +43,7 @@ jobs:
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update --ansi
composer update --${{ matrix.stability }} --prefer-dist --no-interaction --ansi
- name: Execute tests
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.idea
.php_cs
.php_cs.cache
.phpunit.result.cache
.phpunit.cache
build
composer.lock
coverage
Expand Down
65 changes: 0 additions & 65 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ vendor/bin/pest -d --update-snapshots

## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
Please see [GitHub Releases](https://github.com/worksome/number/releases) for more information on what has changed recently.

## Credits

Expand Down
14 changes: 6 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@
"require": {
"php": "^8.2",
"brick/math": "^0.9.3 || ^0.10 || ^0.11",
"nuwave/lighthouse": "^6.0",
"nuwave/lighthouse": "^6.36",
"webonyx/graphql-php": "^15.2.1"
},
"require-dev": {
"nunomaduro/collision": "^6.0",
"nunomaduro/larastan": "^2.5.1",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^1.22.4",
"pestphp/pest-plugin-parallel": "^1.0",
"spatie/pest-plugin-snapshots": "^1.1",
"worksome/coding-style": "^2.5"
"nunomaduro/collision": "^7.0 || ^8.1",
"larastan/larastan": "^2.6",
"orchestra/testbench": "^8.0 || ^9.0",
"pestphp/pest": "^2.34",
"worksome/coding-style": "^2.10"
},
"autoload": {
"psr-4": {
Expand Down
14 changes: 1 addition & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,9 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
cacheDirectory=".phpunit.cache"
>
<testsuites>
<testsuite name="Worksome Test Suite">
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
WorksomeRectorConfig::setup($rectorConfig);

$rectorConfig->paths([
__DIR__ . '/app',
__DIR__ . '/src',
__DIR__ . '/tests',
]);
};
2 changes: 1 addition & 1 deletion src/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function div(string|int|float|BigNumber|Number $value, int $decimalPlaces
return static::of($this->value->dividedBy($value->value, $decimalPlaces, $this->getRoundingMode()));
}

public function percentage(int|Number $value): Number
public function percentage(string|int|float|BigNumber|Number $value): Number
{
if (! $value instanceof Number) {
$value = Number::of($value);
Expand Down
4 changes: 1 addition & 3 deletions tests/Unit/GraphQL/Types/PercentageTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
use GraphQL\Utils\SchemaPrinter;
use Worksome\Number\GraphQL\Scalars\PercentageType as Percentage;

use function Spatie\Snapshots\assertMatchesTextSnapshot;

it('can serialize', function ($value, $expected) {
$serialized = (new Percentage())->serialize($value);

Expand All @@ -20,5 +18,5 @@
it('can generate schema for GraphQL Percentage scalar', function () {
$type = new Percentage();

assertMatchesTextSnapshot(SchemaPrinter::printType($type));
expect(SchemaPrinter::printType($type))->toMatchSnapshot();
});
4 changes: 1 addition & 3 deletions tests/Unit/GraphQL/Types/StrictPercentageTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
use GraphQL\Utils\SchemaPrinter;
use Worksome\Number\GraphQL\Scalars\StrictPercentageType as StrictPercentage;

use function Spatie\Snapshots\assertMatchesTextSnapshot;

it('can serialize', function ($value, $expected) {
$serialized = (new StrictPercentage())->serialize($value);

Expand All @@ -29,5 +27,5 @@
it('can generate schema for GraphQL StrictPercentage scalar', function () {
$type = new StrictPercentage();

assertMatchesTextSnapshot(SchemaPrinter::printType($type));
expect(SchemaPrinter::printType($type))->toMatchSnapshot();
});
Loading

0 comments on commit 9c7b301

Please sign in to comment.