Skip to content

Commit 1bfe5e2

Browse files
u01jmg3shengslogar
andauthored
Support Laravel 12 (#85)
* Support Laravel 12 * Laravel 8.x and 9.x should support PHP 8.3 based on tagged constraints * Update `orchestra/testbench` constraint * Naively bump `phpunit` version * Add new `<source>` tag for PHPUnit 11 * Attempt to remove `<coverage>` altogether * Migrate primary configuration to PHPUnit 11 * Remove redundant defaults and unwanted config generated by `--generate-configuration` * Use new coverage tag for PHPUnit 11 * Covering a specific method is deprecated; PHPUnit is (now?) smart enough to pick up on this without an annotation * Drop PHPUnit `^9.5` to see what fails * Deprecate Laravel 8 and 9 * Use `DataProvider` attribute * Address deprecations and other modernizations * Remove unused parameter * Fix GH workflow * Whoops * Update upgrade guide * Remove new line --------- Co-authored-by: Sheng-Liang Slogar <[email protected]>
1 parent f2821b5 commit 1bfe5e2

19 files changed

+69
-87
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,17 @@ jobs:
1313
phpunit:
1414
strategy:
1515
matrix:
16-
php: [ 8.2, 8.1, 8.0, 7.4, 7.3 ]
17-
laravel: [ 11.*, 10.*, 9.*, 8.* ]
16+
php: [ 8.3, 8.2, 8.1 ]
17+
laravel: [ 12.*, 11.*, 10.* ]
1818
os: [ ubuntu-latest, windows-latest ]
1919

2020
# Unsupported combinations
2121
exclude:
22-
- laravel: 11.*
22+
- laravel: 12.*
2323
php: 8.1
24+
2425
- laravel: 11.*
25-
php: 8.0
26-
- laravel: 11.*
27-
php: 7.4
28-
- laravel: 11.*
29-
php: 7.3
30-
31-
- laravel: 10.*
32-
php: 8.0
33-
- laravel: 10.*
34-
php: 7.4
35-
- laravel: 10.*
36-
php: 7.3
37-
38-
- laravel: 9.*
39-
php: 7.4
40-
- laravel: 9.*
41-
php: 7.3
26+
php: 8.1
4227

4328
# Continue running through matrix even if one combination fails
4429
fail-fast: false

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ Compatibility Chart
3939

4040
| Laravel | Laravel Breadcrumbs |
4141
|---------|---------------------|
42-
| 11.x | 9.x |
43-
| 10.x | 9.x |
42+
| 12.x | 10.x |
43+
| 11.x | 10.x |
44+
| 10.x | 10.x |
4445
| 9.x | 9.x |
4546
| 8.x | 9.x |
4647
| 7.x | 8.x |

UPGRADE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Upgrade Guide
22

3+
## Upgrading to 10.x from 9.x
4+
5+
`10.x` drops support for Laravel v8 and v9 to support PHPUnit v11. If you're on Laravel v10+,
6+
re-run `composer require diglactic/laravel-breadcrumbs`.
7+
38
## Upgrading to 9.x from 8.x
49

510
`9.x` drops support for Laravel v6 and v7 to support PHPUnit v10. There are no other breaking changes. If you're on

composer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@
1919
],
2020
"license": "MIT",
2121
"require": {
22-
"php": "^7.3 || ^8.0",
22+
"php": "^8.1",
2323
"facade/ignition-contracts": "^1.0",
24-
"laravel/framework": "^8.0 || ^9.0 || ^10.0 || ^11.0"
24+
"laravel/framework": "^10.0 || ^11.0 || ^12.0"
2525
},
2626
"require-dev": {
27-
"orchestra/testbench": "^6.0 || ^7.0 || ^8.0 || ^9.0",
28-
"phpunit/phpunit": "^9.5 || ^10.5",
29-
"php-coveralls/php-coveralls": "^2.7",
30-
"spatie/phpunit-snapshot-assertions": "^4.2 || ^5.1"
27+
"orchestra/testbench": "^8.0 || ^9.0 || ^10.0",
28+
"phpunit/phpunit": "^10.5 || ^11.5",
29+
"spatie/phpunit-snapshot-assertions": "^5.1"
3130
},
3231
"minimum-stability": "dev",
3332
"prefer-stable": true,

phpunit.xml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,28 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
5-
backupGlobals="false"
6-
backupStaticAttributes="false"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
75
beStrictAboutChangesToGlobalState="true"
6+
beStrictAboutCoverageMetadata="true"
87
beStrictAboutOutputDuringTests="true"
9-
beStrictAboutTestsThatDoNotTestAnything="true"
108
bootstrap="vendor/autoload.php"
11-
cacheResult="true"
129
colors="true"
13-
convertErrorsToExceptions="true"
14-
convertNoticesToExceptions="true"
15-
convertWarningsToExceptions="true"
16-
processIsolation="false"
17-
stopOnFailure="false"
18-
verbose="true"
10+
displayDetailsOnPhpunitDeprecations="true"
11+
failOnNotice="true"
12+
failOnRisky="true"
13+
failOnWarning="true"
1914
>
2015
<!-- List of files with tests inside -->
2116
<testsuites>
2217
<testsuite name="Package Test Suite">
23-
<directory suffix="Test.php">tests/</directory>
18+
<directory>tests</directory>
2419
</testsuite>
2520
</testsuites>
26-
21+
2722
<!-- List of source files for code coverage checker -->
28-
<coverage processUncoveredFiles="true">
23+
<source>
2924
<include>
30-
<directory suffix=".php">src/</directory>
25+
<directory>src</directory>
3126
</include>
32-
</coverage>
27+
</source>
3328
</phpunit>

tests/BasicFunctionalityTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
class BasicFunctionalityTest extends TestCase
1111
{
12-
/** @var object */
13-
private $post;
12+
private object $post;
1413

1514
protected function setUp(): void
1615
{

tests/CustomGeneratorTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@
44

55
use Diglactic\Breadcrumbs\Breadcrumbs;
66
use Diglactic\Breadcrumbs\Generator;
7+
use Illuminate\Config\Repository;
78
use Illuminate\Support\Collection;
89

910
class CustomGeneratorTest extends TestCase
1011
{
11-
protected function resolveApplicationConfiguration($app): void
12+
protected function defineEnvironment($app): void
1213
{
13-
parent::resolveApplicationConfiguration($app);
14+
parent::defineEnvironment($app);
1415

1516
// Need to inject this early, before the package is loaded, to simulate it being set in the config file
16-
$app['config']['breadcrumbs.generator-class'] = CustomGenerator::class;
17+
tap($app['config'], function (Repository $config) {
18+
$config->set('breadcrumbs.generator-class', CustomGenerator::class);
19+
});
1720
}
1821

1922
public function testCustomGenerator()

tests/DeferredLoadingTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44

55
use Diglactic\Breadcrumbs\Breadcrumbs;
66
use Illuminate\Contracts\Console\Kernel;
7-
use LogicException;
87

98
class DeferredLoadingTest extends TestCase
109
{
1110
protected function getEnvironmentSetUp($app): void
1211
{
13-
parent::getEnvironmentSetUp($app);
12+
parent::defineEnvironment($app);
1413

1514
// If the service provider is loaded before the test starts, this file
1615
// will throw an exception.
@@ -26,7 +25,7 @@ protected function resolveApplicationConsoleKernel($app): void
2625

2726
public function testDeferredLoading()
2827
{
29-
$this->expectException(LogicException::class);
28+
$this->expectException(\LogicException::class);
3029

3130
// This triggers the service provider boot, which loads the breadcrumbs,
3231
// which throws an exception, which is caught by PHPUnit.

tests/FacadePhpDocTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public static function tags(): Generator
3030

3131
preg_match_all($pattern, $code, $matches, PREG_SET_ORDER);
3232

33-
$tags = [];
3433
foreach ($matches as $match) {
3534
foreach (explode('|', $match[1]) as $class) {
3635
// Return the whole line too so it can be seen in the error message

tests/Http/Controllers/PostController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
use Diglactic\Breadcrumbs\Breadcrumbs;
66
use Diglactic\Breadcrumbs\Tests\Models\Post;
7+
use Illuminate\View\View;
78

89
class PostController
910
{
10-
public function edit(Post $post)
11+
public function edit(Post $post): View
1112
{
1213
return Breadcrumbs::render();
1314
}

0 commit comments

Comments
 (0)