forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoutingFilterParserTest.php
More file actions
executable file
·43 lines (29 loc) · 1.08 KB
/
RoutingFilterParserTest.php
File metadata and controls
executable file
·43 lines (29 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
use Mockery as m;
use Symfony\Component\HttpFoundation\Request;
class RoutingFilterParserTest extends PHPUnit_Framework_TestCase {
public function tearDown()
{
m::close();
}
public function testFiltersAreParsedCorrectlyByClass()
{
$reader = $this->getParser();
$controller = new FilerParserTestControllerStub;
$controller->beforeFilter('code-before');
$controller->beforeFilter('code-before-2', array('only' => 'fooAction'));
$controller->beforeFilter('code-before-3', array('except' => 'fooAction'));
$controller->beforeFilter('code-before-4', array('on' => 'post'));
$controller->afterFilter('code-after');
$request = Request::create('/', 'GET');
$filters = $reader->parse($controller, $request, 'fooAction', 'Illuminate\Routing\Controllers\Before');
$this->assertEquals(2, count($filters));
$this->assertEquals(array('code-before', 'code-before-2'), $filters);
}
protected function getParser()
{
return new Illuminate\Routing\Controllers\FilterParser;
}
}
class FilerParserTestControllerStub extends Illuminate\Routing\Controllers\Controller {
}