Skip to content

Commit

Permalink
rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed May 15, 2017
1 parent 5c07516 commit 26681eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/Illuminate/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,14 @@ public function is()
}

/**
* Check if route name matches string.
* Check if the route name matches the given string.
*
* @param string $name
*
* @return bool
*/
public function isRouteName($name)
public function routeIs($name)
{
return $this->route()->getName() === $name;
return $this->route() && $this->route()->getName() === $name;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Http/HttpRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ public function testIsRouteNameMethod()
return $route;
});

$this->assertTrue($request->isRouteName('foo.bar'));
$this->assertFalse($request->isRouteName('foo.foo'));
$this->assertTrue($request->routeIs('foo.bar'));
$this->assertFalse($request->routeIs('foo.foo'));
}

public function testAjaxMethod()
Expand Down

0 comments on commit 26681eb

Please sign in to comment.