Skip to content

Commit

Permalink
feat: Laravel 11.x Compatibility (#27)
Browse files Browse the repository at this point in the history
* Bump dependencies for Laravel 11

* Update GitHub Actions for Laravel 11

* WIP

---------

Co-authored-by: Ralph J. Smit <[email protected]>
  • Loading branch information
laravel-shift and ralphjsmit authored Mar 14, 2024
1 parent 6b4847e commit 589815c
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 86 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,35 @@ name: run-tests

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

jobs:
test:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
php: [ 8.1, 8.2 ]
laravel: [ 8.*, 9.*, 10.* ]
stability: [ prefer-lowest, prefer-stable ]
os: [ubuntu-latest]
php: [8.1, 8.2]
laravel: ['8.*', '9.*', '10.*', '11.*']
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 8.*
testbench: ^6.23
- laravel: 9.*
testbench: ^7.0
- laravel: 10.*
testbench: ^8.0
- laravel: 11.*
testbench: ^9.0
exclude:
- laravel: 11.*
php: 8.1

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

Expand All @@ -48,4 +56,4 @@ jobs:
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/pest
run: vendor/bin/pest
1 change: 1 addition & 0 deletions .phpunit.cache/test-results
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"pest_2.34.2","defects":[],"times":{"P\\Tests\\Feature\\UrlTest::__pest_evaluable_it_can_store_the_user_url_in_the_session_on_a_visit_on_a_mix_of_named_and_unnamed_routes":0.016,"P\\Tests\\Feature\\UrlTest::__pest_evaluable_it_can_store_the_user_url_in_the_session_on_a_visit_on_a_route_without_a_route_name":0.001,"P\\Tests\\Feature\\UrlTest::__pest_evaluable_it_can_store_the_user_url_in_the_session_on_a_visit":0.025,"P\\Tests\\Feature\\UrlTest::__pest_evaluable_it_can_use_the_fallbacks":0,"P\\Tests\\Feature\\UrlTest::__pest_evaluable_it_will_exclude_all_request_types_apart_from_GET":0.002}}
88 changes: 44 additions & 44 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
{
"name" : "ralphjsmit/livewire-urls",
"description" : "Get the previous and current url in Livewire.",
"keywords" : [
"name": "ralphjsmit/livewire-urls",
"description": "Get the previous and current url in Livewire.",
"keywords": [
"ralphjsmit",
"laravel",
"livewire-urls"
],
"homepage" : "https://github.com/ralphjsmit/livewire-urls",
"license" : "MIT",
"authors" : [
"homepage": "https://github.com/ralphjsmit/livewire-urls",
"license": "MIT",
"authors": [
{
"name" : "Ralph J. Smit",
"email" : "[email protected]",
"role" : "Developer"
"name": "Ralph J. Smit",
"email": "[email protected]",
"role": "Developer"
}
],
"require" : {
"php" : "^8.0",
"illuminate/contracts" : "^8.83|^9.0|^10.0",
"livewire/livewire" : "^2.10|^3.0",
"spatie/laravel-package-tools" : "^1.9.2"
"require": {
"php": "^8.0",
"illuminate/contracts": "^8.83|^9.0|^10.0|^11.0",
"livewire/livewire": "^2.10|^3.0",
"spatie/laravel-package-tools": "^1.9.2"
},
"require-dev" : {
"friendsofphp/php-cs-fixer" : "^3.8",
"nunomaduro/collision" : "^5.0|^6.0|^7.0",
"orchestra/testbench" : "^6.0|^7.0|^8.0",
"pestphp/pest" : "^1.21",
"pestphp/pest-plugin-laravel" : "^1.1",
"phpunit/phpunit" : "^9.5|^10.0",
"spatie/laravel-ray" : "^1.26",
"nesbot/carbon" : "^2.66"
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.8",
"nunomaduro/collision": "^5.0|^6.0|^7.0|^8.0",
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0",
"pestphp/pest": "^1.21|^2.34",
"pestphp/pest-plugin-laravel": "^1.1|^2.3",
"phpunit/phpunit": "^9.5|^10.0",
"spatie/laravel-ray": "^1.26",
"nesbot/carbon": "^2.66|^3.0"
},
"autoload" : {
"psr-4" : {
"RalphJSmit\\Livewire\\Urls\\" : "src"
"autoload": {
"psr-4": {
"RalphJSmit\\Livewire\\Urls\\": "src"
}
},
"autoload-dev" : {
"psr-4" : {
"RalphJSmit\\Livewire\\Urls\\Tests\\" : "tests"
"autoload-dev": {
"psr-4": {
"RalphJSmit\\Livewire\\Urls\\Tests\\": "tests"
}
},
"scripts" : {
"test" : "vendor/bin/pest",
"test-coverage" : "vendor/bin/pest --coverage",
"format" : "vendor/bin/php-cs-fixer fix --allow-risky=yes"
"scripts": {
"test": "vendor/bin/pest",
"test-coverage": "vendor/bin/pest --coverage",
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes"
},
"config" : {
"sort-packages" : true,
"allow-plugins" : {
"pestphp/pest-plugin" : true
"config": {
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"extra" : {
"laravel" : {
"providers" : [
"extra": {
"laravel": {
"providers": [
"RalphJSmit\\Livewire\\Urls\\LivewireUrlsServiceProvider"
],
"aliases" : {
"LivewireUrls" : "RalphJSmit\\Livewire\\Urls\\Facades\\Url"
"aliases": {
"LivewireUrls": "RalphJSmit\\Livewire\\Urls\\Facades\\Url"
}
}
},
"minimum-stability" : "dev",
"prefer-stable" : true
"minimum-stability": "dev",
"prefer-stable": true
}
50 changes: 16 additions & 34 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<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"
>
<testsuites>
<testsuite name="RalphJSmit Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<php>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/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">
<testsuites>
<testsuite name="RalphJSmit Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
</php>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
7 changes: 6 additions & 1 deletion tests/Feature/UrlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
expect(Url::lastRecorded())->toBe(route('route.test'));
expect(Url::lastRecordedRoute())->toBe('route.test');

post(route('livewire.message', ['name' => TestComponent::class]));
$route = match(true) {
Route::has('livewire.update') => 'livewire.update',
Route::has('livewire.message') => 'livewire.message',
};

post(route($route, ['name' => TestComponent::class]));

expect(Url::previous())->toBe(route('route.test'));
expect(Url::previousRoute())->toBe('route.test');
Expand Down

0 comments on commit 589815c

Please sign in to comment.