Skip to content

Commit

Permalink
Laravel 11 (#5)
Browse files Browse the repository at this point in the history
* Wip

* Remove: Old workflow job

* Bump minimal PHPUnit version to 10.1

* Wip

* Update Readme
  • Loading branch information
antoninmasek authored Apr 1, 2024
1 parent d0cdf64 commit 28d2735
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 231 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/phpstan.yml

This file was deleted.

72 changes: 17 additions & 55 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
name: run-tests

on:
push:
branches: [main]
pull_request:
branches: [main]
on: [push, pull_request]

jobs:
test-laravel-9:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1, 8.2]
laravel: ['9.*']
phpunit: ['9.5.8']
testbench: ['7.22.0']
collision: ['6.4']
stability: [prefer-lowest,prefer-stable]
os: [ ubuntu-latest ]
php: [ 8.3, 8.2, 8.1 ]
laravel: [ 11.*, 10.* ]
stability: [ prefer-lowest, prefer-stable ]
include:
- laravel: 11.*
testbench: 9.*
- laravel: 10.*
testbench: 8.*
exclude:
- laravel: 11.*
php: 8.1

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
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: none

- name: Setup problem matchers
Expand All @@ -40,47 +41,8 @@ jobs:
- name: Install dependencies
run: |
composer require "nunomaduro/collision:~${{ matrix.collision }}" "orchestra/testbench:~${{ matrix.testbench }}" "phpunit/phpunit:~${{ matrix.phpunit }}" --dev --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
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 --no-coverage

test-laravel-10:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1,8.2]
laravel: ['10.*']
phpunit: ['10.0']
testbench: ['8.0']
collision: ['7.0.2']
stability: [prefer-lowest,prefer-stable]

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

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer require "nunomaduro/collision:~${{ matrix.collision }}" "orchestra/testbench:~${{ matrix.testbench }}" "phpunit/phpunit:~${{ matrix.phpunit }}" --dev --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit --no-coverage
28 changes: 0 additions & 28 deletions .github/workflows/update-changelog.yml

This file was deleted.

59 changes: 0 additions & 59 deletions CHANGELOG.md

This file was deleted.

9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Easily use Hashids with Laravel models.

[![Latest Version on Packagist](https://img.shields.io/packagist/v/antoninmasek/laravel-model-hashids.svg?style=flat-square)](https://packagist.org/packages/antoninmasek/laravel-model-hashids)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/antoninmasek/laravel-model-hashids/run-tests?label=tests)](https://github.com/antoninmasek/laravel-model-hashids/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/antoninmasek/laravel-model-hashids/Check%20&%20fix%20styling?label=code%20style)](https://github.com/antoninmasek/laravel-model-hashids/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/antoninmasek/laravel-model-hashids.svg?style=flat-square)](https://packagist.org/packages/antoninmasek/laravel-model-hashids)
![Packagist Version](https://img.shields.io/packagist/v/antoninmasek/laravel-model-hashids?style=flat-square&link=https%3A%2F%2Fpackagist.org%2Fpackages%2Fantoninmasek%2Flaravel-model-hashids)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/antoninmasek/laravel-model-hashids/run-tests.yml?branch=main&style=flat-square&label=tests)
![Packagist Downloads](https://img.shields.io/packagist/dt/antoninmasek/laravel-model-hashids?style=flat-square&link=https%3A%2F%2Fpackagist.org%2Fpackages%2Fantoninmasek%2Flaravel-model-hashids)

In some cases I really like to use [Hashids](https://hashids.org/php/) instead of uuids as my model keys. For me Hashids
are less awkward to read and the resulting URL looks
Expand Down Expand Up @@ -175,7 +174,7 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re

## Credits

- [Antonín Mašek](https://github.com/antoninmasek)
[Antonín Mašek](https://github.com/antoninmasek)

## License

Expand Down
21 changes: 5 additions & 16 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,15 @@
],
"homepage": "https://github.com/antoninmasek/laravel-model-hashids",
"require": {
"php": "^8.1 || ^8.2",
"antoninmasek/laravel-hashids": "^0.2.0",
"illuminate/contracts": "^9.0 || ^10.0",
"php": "^8.1",
"antoninmasek/laravel-hashids": "^1.0.0",
"illuminate/contracts": "^10.0 || ^11.0",
"spatie/laravel-package-tools": "^1.14.1"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.29",
"laravel/pint": "^1.5",
"nunomaduro/collision": "^6.0 || ^7.0.2",
"nunomaduro/larastan": "^2.4.0",
"orchestra/testbench": "^7.0 || ^8.0",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan-deprecation-rules": "^1.1.1",
"phpstan/phpstan-phpunit": "^1.3.4",
"phpunit/phpunit": "^9.5 || ^10.0",
"orchestra/testbench": "^8.0 || ^9.0",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ray": "^1.32.2"
},
"minimum-stability": "stable",
Expand All @@ -46,10 +40,6 @@
}
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true,
"ergebnis/composer-normalize": true
},
"sort-packages": true
},
"extra": {
Expand All @@ -63,7 +53,6 @@
}
},
"scripts": {
"analyse": "vendor/bin/phpstan analyse",
"test": "vendor/bin/phpunit --no-coverage",
"test-coverage": "vendor/bin/phpunit --coverage"
}
Expand Down
Empty file removed phpstan-baseline.neon
Empty file.
13 changes: 0 additions & 13 deletions phpstan.neon.dist

This file was deleted.

33 changes: 5 additions & 28 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,40 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
backupGlobals="false"
bootstrap="vendor/autoload.php"
colors="true"
processIsolation="false"
stopOnFailure="false"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<testsuites>
<testsuite name="AntoninMasek Test Suite">
<directory suffix="Test.php">./tests</directory>
<testsuite name="Test Suite">
<directory suffix="Test.php">tests/</directory>
</testsuite>
</testsuites>
<php>
<server name="DB_CONNECTION" value="sqlite"/>
<server name="DB_DATABASE" value=":memory:"/>
</php>
<coverage>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="build/coverage"/>
<text outputFile="build/coverage.txt"/>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/report.junit.xml"/>
</logging>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion tests/GeneratesHashIdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace AntoninMasek\Hashids\Tests;

use _PHPStan_9a6ded56a\Nette\Neon\Exception;
use AntoninMasek\Hashids\Facades\Hashids;
use AntoninMasek\Hashids\ModelHashids;
use AntoninMasek\Hashids\Tests\Fixtures\BindingTestModel;
Expand All @@ -12,6 +11,7 @@
use AntoninMasek\Hashids\Tests\Fixtures\TestModelWithDifferentKeyForGenerationGenerator;
use AntoninMasek\Hashids\Tests\Fixtures\TestModelWithMinLengthGenerator;
use AntoninMasek\Hashids\Tests\Fixtures\TestModelWithSaltGenerator;
use Exception;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Support\Facades\Event;
Expand Down

0 comments on commit 28d2735

Please sign in to comment.