Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Jan 5, 2016
1 parent 6578b19 commit 372af63
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ use Spatie\RobotsMiddleware\RobotsMiddleware;

class MyRobotsMiddleware extends RobotsMiddleware
{
protected function shouldIndex(Request $request) : bool
/**
* @return string|bool
*/
protected function shouldIndex(Request $request)
{
return $request->segment(1) !== 'admin';
}
Expand Down
5 changes: 4 additions & 1 deletion src/RobotsMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ protected function responseWithRobots(string $contents)
return $this->response;
}

protected function shouldIndex(Request $request) : bool
/**
* @return string|bool
*/
protected function shouldIndex(Request $request)
{
return true;
}
Expand Down
3 changes: 0 additions & 3 deletions tests/RobotsMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
namespace Spatie\RobotsMiddleware\Test;

use Spatie\RobotsMiddleware\InvalidIndexRule;
use Spatie\RobotsMiddleware\Test\TestMiddlewares\CustomTestMiddleware;
use Spatie\RobotsMiddleware\Test\TestMiddlewares\InvalidTestMiddleware;
use Spatie\RobotsMiddleware\Test\TestMiddlewares\SimpleTestMiddleware;

class RobotsMiddlewareTest extends TestCase
{
Expand Down
5 changes: 4 additions & 1 deletion tests/TestMiddlewares/CustomTestMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

class CustomTestMiddleware extends RobotsMiddleware
{
protected function shouldIndex(Request $request) : string
/**
* @return string|bool
*/
protected function shouldIndex(Request $request)
{
if ($request->segment(1) === 'custom-tag') {
return 'nofollow';
Expand Down
3 changes: 3 additions & 0 deletions tests/TestMiddlewares/InvalidTestMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

class InvalidTestMiddleware extends RobotsMiddleware
{
/**
* @return string|bool
*/
protected function shouldIndex(Request $request) : array
{
return [];
Expand Down
5 changes: 4 additions & 1 deletion tests/TestMiddlewares/SimpleTestMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

class SimpleTestMiddleware extends RobotsMiddleware
{
protected function shouldIndex(Request $request) : bool
/**
* @return string|bool
*/
protected function shouldIndex(Request $request)
{
return $request->segment(1) !== 'go-away';
}
Expand Down

0 comments on commit 372af63

Please sign in to comment.