Skip to content

Commit

Permalink
Merge pull request #16 from ARCANEDEV/update-1
Browse files Browse the repository at this point in the history
Update the package
  • Loading branch information
arcanedev-maroc authored Mar 4, 2019
2 parents 22acdc0 + f078e31 commit 2d084d7
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ checks:
tools:
external_code_coverage:
timeout: 600
runs: 3
runs: 4
php_code_sniffer:
enabled: true
config:
Expand Down
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
language: php

sudo: false

php:
- 7.1.3
- 7.1
- 7.2
- 7.3
- nightly

matrix:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2015-2018 | ARCANEDEV(c) - Breadcrumbs
Copyright (c) 2015-2019 | ARCANEDEV(c) - Breadcrumbs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/Breadcrumbs/r
2. [Configuration](_docs/2-Configuration.md)
3. [Usage](_docs/3-Usage.md)

## TODOS

- [ ] Complete documentation.

## Contribution

Any ideas are welcome. Feel free to submit any issues or pull requests, please check the [contribution guidelines](CONTRIBUTING.md).
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
},
"require-dev": {
"orchestra/testbench": "~3.7.0",
"phpunit/phpunit": "~7.0",
"phpunit/phpcov": "~5.0"
"phpunit/phpcov": "~5.0",
"phpunit/phpunit": "~7.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/Breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Breadcrumbs implements BreadcrumbsContract
public function __construct(array $supported, $template = null)
{
$this->setSupported($supported);
$this->setTemplate(is_null($template) ? self::DEFAULT_TEMPLATE : $template);
$this->setTemplate($template ?: self::DEFAULT_TEMPLATE);
}

/* -----------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/Traits/BreadcrumbsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected function registerBreadcrumbs($container, array $item = [])
$item = $this->getBreadcrumbsHomeItem();
}

$bc->push($item['title'], $item['url'], isset($item['array']) ? $item['array'] : []);
$bc->push($item['title'], $item['url'], $item['data'] ?? []);
});
}

Expand All @@ -96,7 +96,7 @@ protected function loadBreadcrumbs()

if ( ! empty($this->breadcrumbsItems)) {
foreach ($this->breadcrumbsItems as $crumb) {
$bc->push($crumb['title'], $crumb['url'], isset($crumb['array']) ? $crumb['array'] : []);
$bc->push($crumb['title'], $crumb['url'], $crumb['data'] ?? []);
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion tests/BreadcrumbsServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function it_can_be_instantiated()
\Illuminate\Support\ServiceProvider::class,
\Arcanedev\Support\ServiceProvider::class,
\Arcanedev\Support\PackageServiceProvider::class,
\Arcanedev\Breadcrumbs\BreadcrumbsServiceProvider::class,
BreadcrumbsServiceProvider::class,
];

foreach ($expectations as $expected) {
Expand Down
30 changes: 12 additions & 18 deletions tests/BreadcrumbsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,36 +111,30 @@ public function it_can_generate_items()
static::assertTrue($item['last']);
}

/**
* @test
*
* @expectedException \Arcanedev\Breadcrumbs\Exceptions\InvalidTypeException
* @expectedExceptionMessage The default template name must be a string, NULL given.
*/
/** @test */
public function it_must_throw_invalid_type_exception_on_template()
{
$this->expectException(\Arcanedev\Breadcrumbs\Exceptions\InvalidTypeException::class);
$this->expectExceptionMessage('The default template name must be a string, NULL given.');

breadcrumbs()->setTemplate(null);
}

/**
* @test
*
* @expectedException \Arcanedev\Breadcrumbs\Exceptions\InvalidTemplateException
* @expectedExceptionMessage The template [material-design] is not supported.
*/
/** @test */
public function it_must_throw_invalid_template_exception_on_not_found_template()
{
$this->expectException(\Arcanedev\Breadcrumbs\Exceptions\InvalidTemplateException::class);
$this->expectExceptionMessage('The template [material-design] is not supported.');

breadcrumbs()->setTemplate('material-design');
}

/**
* @test
*
* @expectedException \Arcanedev\Breadcrumbs\Exceptions\InvalidTypeException
* @expectedExceptionMessage The callback name value must be a string, NULL given.
*/
/** @test */
public function it_must_throw_invalid_type_exception_on_register()
{
$this->expectException(\Arcanedev\Breadcrumbs\Exceptions\InvalidTypeException::class);
$this->expectExceptionMessage('The callback name value must be a string, NULL given.');

breadcrumbs()->register(null, function () {
return 'hello';
});
Expand Down
20 changes: 8 additions & 12 deletions tests/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,21 @@ public function it_can_be_called()
static::assertCount(2, $this->builder->get());
}

/**
* @test
*
* @expectedException \Arcanedev\Breadcrumbs\Exceptions\InvalidTypeException
* @expectedExceptionMessage The name value must be a string, boolean given
*/
/** @test */
public function it_must_throw_invalid_type_exception()
{
$this->expectException(\Arcanedev\Breadcrumbs\Exceptions\InvalidTypeException::class);
$this->expectExceptionMessage('The name value must be a string, boolean given');

$this->builder->call(true);
}

/**
* @test
*
* @expectedException \Arcanedev\Breadcrumbs\Exceptions\InvalidCallbackNameException
* @expectedExceptionMessage The callback name not found [random]
*/
/** @test */
public function it_must_throw_invalid_callback_name_exception()
{
$this->expectException(\Arcanedev\Breadcrumbs\Exceptions\InvalidCallbackNameException::class);
$this->expectExceptionMessage('The callback name not found [random]');

$this->builder->call('random', []);
}
}
10 changes: 0 additions & 10 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,4 @@ protected function getPackageAliases($app)
'Breadcrumbs' => \Arcanedev\Breadcrumbs\Facades\Breadcrumbs::class
];
}

/**
* Define environment setup.
*
* @param \Illuminate\Foundation\Application $app
*/
protected function getEnvironmentSetUp($app)
{
//
}
}
5 changes: 5 additions & 0 deletions tests/Traits/BreadcrumbsTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public function it_can_render_about_us_page_breadcrumbs()
);
}

/* -----------------------------------------------------------------
| Other Methods
| -----------------------------------------------------------------
*/

private function registerRoutes()
{
/** @var \Illuminate\Routing\Router $router */
Expand Down

0 comments on commit 2d084d7

Please sign in to comment.