@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public function setUp() |
| 17 | 17 | { |
| 18 | - if( !class_exists( '\Slim\Router', false ) ) { |
|
| 19 | - $this->markTestSkipped( '\Slim\Router is not available' ); |
|
| 18 | + if (!class_exists('\Slim\Router', false)) { |
|
| 19 | + $this->markTestSkipped('\Slim\Router is not available'); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | $this->router = new \Aimeos\Slim\Router; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $methods = ['GET']; |
| 30 | 30 | $pattern = '/hello/{first:\w+}/{last}'; |
| 31 | - $callable = function ($request, $response, $args) { |
|
| 31 | + $callable = function($request, $response, $args) { |
|
| 32 | 32 | echo sprintf('Hello %s %s', $args['first'], $args['last']); |
| 33 | 33 | }; |
| 34 | 34 | $route = $this->router->map($methods, $pattern, $callable); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | $methods = ['GET']; |
| 48 | 48 | $pattern = '/hello/{first:\w+}/{last}'; |
| 49 | - $callable = function ($request, $response, $args) { |
|
| 49 | + $callable = function($request, $response, $args) { |
|
| 50 | 50 | echo sprintf('Hello %s %s', $args['first'], $args['last']); |
| 51 | 51 | }; |
| 52 | 52 | $route = $this->router->map($methods, $pattern, $callable); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $methods = ['GET']; |
| 64 | 64 | $pattern = '/hello/{first:\w+}/{last}'; |
| 65 | - $callable = function ($request, $response, $args) { |
|
| 65 | + $callable = function($request, $response, $args) { |
|
| 66 | 66 | echo sprintf('Hello %s %s', $args['first'], $args['last']); |
| 67 | 67 | }; |
| 68 | 68 | $this->router->setBasePath('/base/path'); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | $methods = ['GET']; |
| 81 | 81 | $pattern = '/archive/{year}[/{month:[\d:{2}]}[/d/{day}]]'; |
| 82 | - $callable = function ($request, $response, $args) { |
|
| 82 | + $callable = function($request, $response, $args) { |
|
| 83 | 83 | return $response; |
| 84 | 84 | }; |
| 85 | 85 | $route = $this->router->map($methods, $pattern, $callable); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | $methods = ['GET']; |
| 105 | 105 | $pattern = '/hello/{name}'; |
| 106 | - $callable = function ($request, $response, $args) { |
|
| 106 | + $callable = function($request, $response, $args) { |
|
| 107 | 107 | echo sprintf('Hello %s', $args['name']); |
| 108 | 108 | }; |
| 109 | 109 | $route = $this->router->map($methods, $pattern, $callable); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | { |
| 123 | 123 | $methods = ['GET']; |
| 124 | 124 | $pattern = '/hello/{first}/{last}'; |
| 125 | - $callable = function ($request, $response, $args) { |
|
| 125 | + $callable = function($request, $response, $args) { |
|
| 126 | 126 | echo sprintf('Hello %s %s', $args['first'], $args['last']); |
| 127 | 127 | }; |
| 128 | 128 | $route = $this->router->map($methods, $pattern, $callable); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | $methods = ['GET']; |
| 140 | 140 | $pattern = '/hello/{first}/{last}'; |
| 141 | - $callable = function ($request, $response, $args) { |
|
| 141 | + $callable = function($request, $response, $args) { |
|
| 142 | 142 | echo sprintf('Hello %s %s', $args['first'], $args['last']); |
| 143 | 143 | }; |
| 144 | 144 | $route = $this->router->map($methods, $pattern, $callable); |
@@ -17,40 +17,40 @@ |
||
| 17 | 17 | |
| 18 | 18 | protected function setUp() |
| 19 | 19 | { |
| 20 | - if( !class_exists( 'Slim\Router', false ) ) { |
|
| 21 | - $this->markTestSkipped( '\Slim\Router is not available' ); |
|
| 20 | + if (!class_exists('Slim\Router', false)) { |
|
| 21 | + $this->markTestSkipped('\Slim\Router is not available'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | $view = new \Aimeos\MW\View\Standard(); |
| 25 | 25 | $this->router = new \Aimeos\Slim\Router(); |
| 26 | - $this->object = new \Aimeos\MW\View\Helper\Url\Slim( $view, $this->router, array( 'site' => 'default' ) ); |
|
| 26 | + $this->object = new \Aimeos\MW\View\Helper\Url\Slim($view, $this->router, array('site' => 'default')); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | protected function tearDown() |
| 31 | 31 | { |
| 32 | - unset( $this->object, $this->router ); |
|
| 32 | + unset($this->object, $this->router); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | public function testTransform() |
| 37 | 37 | { |
| 38 | - $this->router->map( array( 'GET' ), 'shop/{site}', null )->setName( 'route' ); |
|
| 39 | - $result = $this->object->transform( 'route', 'catalog', 'lists', array( 'key' => 'value' ) ); |
|
| 38 | + $this->router->map(array('GET'), 'shop/{site}', null)->setName('route'); |
|
| 39 | + $result = $this->object->transform('route', 'catalog', 'lists', array('key' => 'value')); |
|
| 40 | 40 | |
| 41 | - $this->assertEquals( 'shop/default?key=value', $result ); |
|
| 41 | + $this->assertEquals('shop/default?key=value', $result); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | public function testTransformAbsolute() |
| 46 | 46 | { |
| 47 | - $config = array( 'absoluteUri' => true ); |
|
| 47 | + $config = array('absoluteUri' => true); |
|
| 48 | 48 | |
| 49 | - $this->router->setBasePath( 'https://localhost/' ); |
|
| 50 | - $this->router->map( array( 'GET' ), 'shop/{site}', null )->setName( 'route' ); |
|
| 49 | + $this->router->setBasePath('https://localhost/'); |
|
| 50 | + $this->router->map(array('GET'), 'shop/{site}', null)->setName('route'); |
|
| 51 | 51 | |
| 52 | - $result = $this->object->transform( 'route', 'catalog', 'lists', array( 'key' => 'value' ), array(), $config ); |
|
| 52 | + $result = $this->object->transform('route', 'catalog', 'lists', array('key' => 'value'), array(), $config); |
|
| 53 | 53 | |
| 54 | - $this->assertEquals( 'https://localhost/shop/default?key=value', $result ); |
|
| 54 | + $this->assertEquals('https://localhost/shop/default?key=value', $result); |
|
| 55 | 55 | } |
| 56 | 56 | } |