Skip to content
This repository has been archived by the owner on Oct 18, 2020. It is now read-only.

Add Laravel 5.8 support #203

Merged
merged 5 commits into from
Feb 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ php:

env:
matrix:
- Laravel=5.8
- Laravel=5.7
- Laravel=5.6

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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ A simple [Laravel](https://laravel.com/)-style way to create breadcrumbs.

| Laravel Breadcrumbs | Laravel | PHP |
|------------------------------------------------------------------------|-----------|------|
| **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+ |
Expand Down Expand Up @@ -1171,6 +1172,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`)
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
3 changes: 2 additions & 1 deletion src/BreadcrumbsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
}
Expand Down
5 changes: 2 additions & 3 deletions tests/AdvancedUsageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
Expand Down
2 changes: 1 addition & 1 deletion tests/BasicFunctionalityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class BasicFunctionalityTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
21 changes: 9 additions & 12 deletions tests/ExceptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion tests/OutputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class OutputTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/RecursionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class RecursionTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/RegisterFunctionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
21 changes: 9 additions & 12 deletions tests/RouteBoundTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand All @@ -184,25 +183,23 @@ 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();
});

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();
Expand Down
2 changes: 1 addition & 1 deletion tests/TemplatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class TemplatesTest extends TestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down