From e9181eeba6eba13e4a7e1be8e0e7518ce4b6891c Mon Sep 17 00:00:00 2001 From: Andrew Dabich Date: Tue, 26 Feb 2019 22:34:12 +0200 Subject: [PATCH 1/5] Add Laravel 5.8 support --- .travis.yml | 1 + README.md | 7 ++++++- composer.json | 8 ++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index cd5d8bd..99eea74 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ php: env: matrix: + - Laravel=5.8 - Laravel=5.7 - Laravel=5.6 diff --git a/README.md b/README.md index f5fefb0..1881996 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ A simple [Laravel](https://laravel.com/)-style way to create breadcrumbs. | Laravel Breadcrumbs | Laravel | PHP | |------------------------------------------------------------------------|-----------|------| -| **5.1.1+** | 5.6 – 5.7 | 7.1+ | +| **5.1.1+** | 5.6 – 5.8 | 7.1+ | | 5.0.0 – 5.1.0 | 5.6 | 7.1+ | | [4.x](https://github.com/davejamesmiller/laravel-breadcrumbs/tree/4.x) | 5.5 | 7.0+ | | [3.x](https://github.com/davejamesmiller/laravel-breadcrumbs/tree/3.x) | 5.0 – 5.4 | 5.4+ | @@ -1171,6 +1171,11 @@ So if you get stuck, *please* don't expect me to help! Here are some alternate s *Laravel Breadcrumbs uses [Semantic Versioning](http://semver.org/).* +### [v5.2.1](https://github.com/davejamesmiller/laravel-breadcrumbs/tree/5.2.1) (Tue 26 Feb 2019) + +- Add Laravel 5.8 support + + ### [v5.2.0](https://github.com/davejamesmiller/laravel-breadcrumbs/tree/5.2.0) (Tue 30 Oct 2018) - Add [UIkit](https://getuikit.com/docs/breadcrumb) template (`breadcrumbs::uikit`) diff --git a/composer.json b/composer.json index c8d1afe..8b6daf5 100644 --- a/composer.json +++ b/composer.json @@ -14,12 +14,12 @@ "license": "MIT", "require": { "php": ">=7.1.3", - "illuminate/support": "5.6.*|5.7.*", - "illuminate/view": "5.6.*|5.7.*" + "illuminate/support": "5.6.*|5.7.*|5.8.*", + "illuminate/view": "5.6.*|5.7.*|5.8.*" }, "require-dev": { - "laravel/framework": "5.6.*|5.7.*", - "orchestra/testbench": "3.6.*|3.7.*", + "laravel/framework": "5.6.*|5.7.*|5.8.*", + "orchestra/testbench": "3.6.*|3.7.*|3.8.*", "phpunit/phpunit": "7.*", "php-coveralls/php-coveralls": "^1.0" }, From 1b709577d159c11a6a46489b49e88b7eb6b94c61 Mon Sep 17 00:00:00 2001 From: Andrew Dabich Date: Wed, 27 Feb 2019 09:09:18 +0200 Subject: [PATCH 2/5] Fixed unit tests and changed array_first to Arr::first --- README.md | 3 ++- src/BreadcrumbsManager.php | 3 ++- tests/BasicFunctionalityTest.php | 2 +- tests/OutputTest.php | 2 +- tests/RecursionTest.php | 2 +- tests/RegisterFunctionTest.php | 2 +- tests/TemplatesTest.php | 2 +- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1881996..75e532e 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,8 @@ A simple [Laravel](https://laravel.com/)-style way to create breadcrumbs. | Laravel Breadcrumbs | Laravel | PHP | |------------------------------------------------------------------------|-----------|------| -| **5.1.1+** | 5.6 – 5.8 | 7.1+ | +| **5.2.1+** | 5.6 - 5.8 | 7.1+ | +| **5.1.1+** | 5.6 – 5.7 | 7.1+ | | 5.0.0 – 5.1.0 | 5.6 | 7.1+ | | [4.x](https://github.com/davejamesmiller/laravel-breadcrumbs/tree/4.x) | 5.5 | 7.0+ | | [3.x](https://github.com/davejamesmiller/laravel-breadcrumbs/tree/3.x) | 5.0 – 5.4 | 5.4+ | diff --git a/src/BreadcrumbsManager.php b/src/BreadcrumbsManager.php index cb37e7d..0f69608 100644 --- a/src/BreadcrumbsManager.php +++ b/src/BreadcrumbsManager.php @@ -8,6 +8,7 @@ use DaveJamesMiller\Breadcrumbs\Exceptions\ViewNotSetException; use Illuminate\Contracts\View\Factory as ViewFactory; use Illuminate\Routing\Router; +use Illuminate\Support\Arr; use Illuminate\Support\Collection; use Illuminate\Support\HtmlString; use Illuminate\Support\Traits\Macroable; @@ -279,7 +280,7 @@ protected function getCurrentRoute() $name = $route->getName(); if ($name === null) { - $uri = array_first($route->methods()) . ' /' . ltrim($route->uri(), '/'); + $uri = Arr::first($route->methods()) . ' /' . ltrim($route->uri(), '/'); throw new UnnamedRouteException("The current route ($uri) is not named"); } diff --git a/tests/BasicFunctionalityTest.php b/tests/BasicFunctionalityTest.php index 12188e5..5a56f9f 100644 --- a/tests/BasicFunctionalityTest.php +++ b/tests/BasicFunctionalityTest.php @@ -9,7 +9,7 @@ class BasicFunctionalityTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/OutputTest.php b/tests/OutputTest.php index bcf1f45..a530572 100644 --- a/tests/OutputTest.php +++ b/tests/OutputTest.php @@ -6,7 +6,7 @@ class OutputTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/RecursionTest.php b/tests/RecursionTest.php index f0d1a20..0be4c9d 100644 --- a/tests/RecursionTest.php +++ b/tests/RecursionTest.php @@ -6,7 +6,7 @@ class RecursionTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/RegisterFunctionTest.php b/tests/RegisterFunctionTest.php index 6b7241a..e74274c 100644 --- a/tests/RegisterFunctionTest.php +++ b/tests/RegisterFunctionTest.php @@ -11,7 +11,7 @@ // It's not officially deprecated, but may be in the future. class RegisterFunctionTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/TemplatesTest.php b/tests/TemplatesTest.php index f5e1be0..bc0f0f6 100644 --- a/tests/TemplatesTest.php +++ b/tests/TemplatesTest.php @@ -6,7 +6,7 @@ class TemplatesTest extends TestCase { - protected function setUp() + protected function setUp(): void { parent::setUp(); From b398895d9957b887c726b5289dbe28bb783051c0 Mon Sep 17 00:00:00 2001 From: Andrew Dabich Date: Wed, 27 Feb 2019 09:53:47 +0200 Subject: [PATCH 3/5] Migrate to phpunit 8.0 --- composer.json | 2 +- tests/AdvancedUsageTest.php | 5 ++--- tests/ExceptionsTest.php | 21 +++++++++------------ tests/RouteBoundTest.php | 21 +++++++++------------ 4 files changed, 21 insertions(+), 28 deletions(-) diff --git a/composer.json b/composer.json index 8b6daf5..494ca2b 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "require-dev": { "laravel/framework": "5.6.*|5.7.*|5.8.*", "orchestra/testbench": "3.6.*|3.7.*|3.8.*", - "phpunit/phpunit": "7.*", + "phpunit/phpunit": "8.*", "php-coveralls/php-coveralls": "^1.0" }, "minimum-stability": "dev", diff --git a/tests/AdvancedUsageTest.php b/tests/AdvancedUsageTest.php index b651142..20e76a2 100644 --- a/tests/AdvancedUsageTest.php +++ b/tests/AdvancedUsageTest.php @@ -258,11 +258,10 @@ public function testSetCurrentRouteWithParams() ', $html); } - /** - * @expectedException \DaveJamesMiller\Breadcrumbs\Exceptions\InvalidBreadcrumbException - */ public function testClearCurrentRoute() { + $this->expectException(\DaveJamesMiller\Breadcrumbs\Exceptions\InvalidBreadcrumbException::class); + Breadcrumbs::for('sample', function ($trail, $a, $b) { $trail->push("Sample $a, $b"); }); diff --git a/tests/ExceptionsTest.php b/tests/ExceptionsTest.php index 388e525..de046c5 100644 --- a/tests/ExceptionsTest.php +++ b/tests/ExceptionsTest.php @@ -11,22 +11,20 @@ class ExceptionsTest extends TestCase { // Also see RouteBoundTest which tests the route binding-related exceptions - /** - * @expectedException \DaveJamesMiller\Breadcrumbs\Exceptions\DuplicateBreadcrumbException - * @expectedExceptionMessage Breadcrumb name "duplicate" has already been registered - */ public function testDuplicateBreadcrumbException() { + $this->expectException(\DaveJamesMiller\Breadcrumbs\Exceptions\DuplicateBreadcrumbException::class); + $this->expectExceptionMessage('Breadcrumb name "duplicate" has already been registered'); + Breadcrumbs::for('duplicate', function () { }); Breadcrumbs::for('duplicate', function () { }); } - /** - * @expectedException \DaveJamesMiller\Breadcrumbs\Exceptions\InvalidBreadcrumbException - * @expectedExceptionMessage Breadcrumb not found with name "invalid" - */ public function testInvalidBreadcrumbException() { + $this->expectException(\DaveJamesMiller\Breadcrumbs\Exceptions\InvalidBreadcrumbException::class); + $this->expectExceptionMessage('Breadcrumb not found with name "invalid"'); + Breadcrumbs::render('invalid'); } @@ -41,12 +39,11 @@ public function testInvalidBreadcrumbExceptionDisabled() ', $html); } - /** - * @expectedException \DaveJamesMiller\Breadcrumbs\Exceptions\ViewNotSetException - * @expectedExceptionMessage Breadcrumbs view not specified (check config/breadcrumbs.php) - */ public function testViewNotSetException() { + $this->expectException(\DaveJamesMiller\Breadcrumbs\Exceptions\ViewNotSetException::class); + $this->expectExceptionMessage('Breadcrumbs view not specified (check config/breadcrumbs.php)'); + Config::set('breadcrumbs.view', ''); Breadcrumbs::for('home', function ($trail) { diff --git a/tests/RouteBoundTest.php b/tests/RouteBoundTest.php index 66358de..c2497f2 100644 --- a/tests/RouteBoundTest.php +++ b/tests/RouteBoundTest.php @@ -156,12 +156,11 @@ public function testError404() ', $html); } - /** - * @expectedException \DaveJamesMiller\Breadcrumbs\Exceptions\InvalidBreadcrumbException - * @expectedExceptionMessage Breadcrumb not found with name "home" - */ public function testMissingBreadcrumbException() { + $this->expectException(\DaveJamesMiller\Breadcrumbs\Exceptions\InvalidBreadcrumbException::class); + $this->expectExceptionMessage('Breadcrumb not found with name "home"'); + Route::name('home')->get('/', function () { return Breadcrumbs::render(); }); @@ -184,12 +183,11 @@ public function testMissingBreadcrumbExceptionDisabled() ', $html); } - /** - * @expectedException \DaveJamesMiller\Breadcrumbs\Exceptions\UnnamedRouteException - * @expectedExceptionMessage The current route (GET /blog) is not named - */ public function testUnnamedRouteException() { + $this->expectException(\DaveJamesMiller\Breadcrumbs\Exceptions\UnnamedRouteException::class); + $this->expectExceptionMessage('The current route (GET /blog) is not named'); + Route::get('/blog', function () { return Breadcrumbs::render(); }); @@ -197,12 +195,11 @@ public function testUnnamedRouteException() throw $this->get('/blog')->exception; } - /** - * @expectedException \DaveJamesMiller\Breadcrumbs\Exceptions\UnnamedRouteException - * @expectedExceptionMessage The current route (GET /) is not named - */ public function testUnnamedHomeRouteException() { + $this->expectException(\DaveJamesMiller\Breadcrumbs\Exceptions\UnnamedRouteException::class); + $this->expectExceptionMessage('The current route (GET /) is not named'); + // Make sure the message is "GET /" not "GET //" Route::get('/', function () { return Breadcrumbs::render(); From e773cc1b219766626a53cc1e2ac104614f8f7290 Mon Sep 17 00:00:00 2001 From: Andrew Dabich Date: Wed, 27 Feb 2019 10:00:11 +0200 Subject: [PATCH 4/5] Rollback version phpunit to 7 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 494ca2b..8b6daf5 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "require-dev": { "laravel/framework": "5.6.*|5.7.*|5.8.*", "orchestra/testbench": "3.6.*|3.7.*|3.8.*", - "phpunit/phpunit": "8.*", + "phpunit/phpunit": "7.*", "php-coveralls/php-coveralls": "^1.0" }, "minimum-stability": "dev", From 720b4cc6904c9c3238eb52499b0fb96d1790e0bd Mon Sep 17 00:00:00 2001 From: Andrew Dabich Date: Wed, 27 Feb 2019 11:04:29 +0200 Subject: [PATCH 5/5] Use local phpunit --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 99eea74..3294c12 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ install: - travis_retry composer require --dev "laravel/framework:${Laravel}.*" --no-interaction script: - - phpunit --coverage-clover build/logs/clover.xml + - vendor/bin/phpunit --coverage-clover build/logs/clover.xml after_success: - travis_retry php vendor/bin/coveralls -v