Skip to content

Commit

Permalink
Merge branch 'master' of github.com:spatie/laravel-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Oct 25, 2016
2 parents cfd8823 + 8e14914 commit 0fd27ae
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

All Notable changes to `laravel-menu` will be documented in this file

## 2.0.1 - 2016-10-25

- Fix `Link`'s action helper so it can take the same type of parameters as the Laravel's `action` helper

## 2.0.0

- Upgraded `spatie/menu` to 2.0.
Expand Down
4 changes: 2 additions & 2 deletions src/Link.php
Expand Up @@ -25,12 +25,12 @@ public static function toUrl(string $path, string $text, array $parameters = [],
/**
* @param string $action
* @param string $text
* @param array $parameters
* @param mixed $parameters
* @param bool $absolute
*
* @return static
*/
public static function toAction(string $action, string $text, array $parameters = [], bool $absolute = true)
public static function toAction(string $action, string $text, $parameters = [], bool $absolute = true)
{
return static::to(action($action, $parameters, $absolute), $text);
}
Expand Down
11 changes: 10 additions & 1 deletion tests/LinkTest.php
Expand Up @@ -52,7 +52,16 @@ public function it_can_be_created_for_an_action()
}

/** @test */
public function it_can_be_created_for_an_action_with_parameters()
public function it_can_be_created_for_an_action_with_a_parameter()
{
$this->assertRenders(
'<a href="http://localhost/post/1">Post #1</a>',
Link::toAction(DummyController::class.'@post', 'Post #1', 1)
);
}

/** @test */
public function it_can_be_created_for_an_action_with_an_array_of_parameters()
{
$this->assertRenders(
'<a href="http://localhost/post/1">Post #1</a>',
Expand Down

0 comments on commit 0fd27ae

Please sign in to comment.