@@ -17,51 +17,51 @@ |
||
| 17 | 17 | |
| 18 | 18 | protected function setUp() |
| 19 | 19 | { |
| 20 | - if( !interface_exists( '\Psr\Http\Message\ServerRequestInterface' ) ) { |
|
| 21 | - $this->markTestSkipped( '\Psr\Http\Message\ServerRequestInterface is not available' ); |
|
| 20 | + if (!interface_exists('\Psr\Http\Message\ServerRequestInterface')) { |
|
| 21 | + $this->markTestSkipped('\Psr\Http\Message\ServerRequestInterface is not available'); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - if( !class_exists( '\Slim\Route' ) ) { |
|
| 25 | - $this->markTestSkipped( '\Slim\Route is not available' ); |
|
| 24 | + if (!class_exists('\Slim\Route')) { |
|
| 25 | + $this->markTestSkipped('\Slim\Route is not available'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $view = new \Aimeos\MW\View\Standard(); |
| 29 | - $route = new \Slim\Route( array( 'GET' ), '/shop', null ); |
|
| 30 | - $route->setName( 'route' ); |
|
| 29 | + $route = new \Slim\Route(array('GET'), '/shop', null); |
|
| 30 | + $route->setName('route'); |
|
| 31 | 31 | |
| 32 | - $this->mock = $this->getMockBuilder( \Psr\Http\Message\ServerRequestInterface::class )->getMock(); |
|
| 32 | + $this->mock = $this->getMockBuilder(\Psr\Http\Message\ServerRequestInterface::class)->getMock(); |
|
| 33 | 33 | |
| 34 | - $this->mock->expects( $this->once() )->method( 'getAttribute' ) |
|
| 35 | - ->will( $this->returnValue( $route ) ); |
|
| 34 | + $this->mock->expects($this->once())->method('getAttribute') |
|
| 35 | + ->will($this->returnValue($route)); |
|
| 36 | 36 | |
| 37 | - $this->mock->expects( $this->once() )->method( 'getServerParams' ) |
|
| 38 | - ->will( $this->returnValue( array( 'REMOTE_ADDR' => '127.0.0.1' ) ) ); |
|
| 37 | + $this->mock->expects($this->once())->method('getServerParams') |
|
| 38 | + ->will($this->returnValue(array('REMOTE_ADDR' => '127.0.0.1'))); |
|
| 39 | 39 | |
| 40 | - $this->object = new \Aimeos\MW\View\Helper\Request\Slim( $view, $this->mock ); |
|
| 40 | + $this->object = new \Aimeos\MW\View\Helper\Request\Slim($view, $this->mock); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | protected function tearDown() |
| 45 | 45 | { |
| 46 | - unset( $this->object, $this->mock ); |
|
| 46 | + unset($this->object, $this->mock); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | public function testTransform() |
| 51 | 51 | { |
| 52 | - $this->assertInstanceOf( \Aimeos\MW\View\Helper\Request\Slim::class, $this->object->transform() ); |
|
| 53 | - $this->assertInstanceOf( \Psr\Http\Message\ServerRequestInterface::class, $this->object->transform() ); |
|
| 52 | + $this->assertInstanceOf(\Aimeos\MW\View\Helper\Request\Slim::class, $this->object->transform()); |
|
| 53 | + $this->assertInstanceOf(\Psr\Http\Message\ServerRequestInterface::class, $this->object->transform()); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | public function testGetClientAddress() |
| 58 | 58 | { |
| 59 | - $this->assertEquals( '127.0.0.1', $this->object->getClientAddress() ); |
|
| 59 | + $this->assertEquals('127.0.0.1', $this->object->getClientAddress()); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | public function testGetTarget() |
| 64 | 64 | { |
| 65 | - $this->assertEquals( 'route', $this->object->getTarget() ); |
|
| 65 | + $this->assertEquals('route', $this->object->getTarget()); |
|
| 66 | 66 | } |
| 67 | 67 | } |
@@ -16,48 +16,48 @@ |
||
| 16 | 16 | |
| 17 | 17 | protected function setUp() |
| 18 | 18 | { |
| 19 | - if( !class_exists( '\Slim\Http\Stream' ) ) { |
|
| 20 | - $this->markTestSkipped( '\Slim\Http\Stream is not available' ); |
|
| 19 | + if (!class_exists('\Slim\Http\Stream')) { |
|
| 20 | + $this->markTestSkipped('\Slim\Http\Stream is not available'); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - $response = $this->getMockBuilder( \Psr\Http\Message\ResponseInterface::class )->getMock(); |
|
| 23 | + $response = $this->getMockBuilder(\Psr\Http\Message\ResponseInterface::class)->getMock(); |
|
| 24 | 24 | |
| 25 | 25 | $view = new \Aimeos\MW\View\Standard(); |
| 26 | - $this->object = new \Aimeos\MW\View\Helper\Response\Slim( $view, $response ); |
|
| 26 | + $this->object = new \Aimeos\MW\View\Helper\Response\Slim($view, $response); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | protected function tearDown() |
| 31 | 31 | { |
| 32 | - unset( $this->object ); |
|
| 32 | + unset($this->object); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | public function testTransform() |
| 37 | 37 | { |
| 38 | - $this->assertInstanceOf( \Aimeos\MW\View\Helper\Response\Slim::class, $this->object->transform() ); |
|
| 39 | - $this->assertInstanceOf( \Psr\Http\Message\ResponseInterface::class, $this->object->transform() ); |
|
| 38 | + $this->assertInstanceOf(\Aimeos\MW\View\Helper\Response\Slim::class, $this->object->transform()); |
|
| 39 | + $this->assertInstanceOf(\Psr\Http\Message\ResponseInterface::class, $this->object->transform()); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
| 43 | 43 | public function testCreateStream() |
| 44 | 44 | { |
| 45 | - $stream = $this->object->createStream( fopen( __FILE__, 'r' ) ); |
|
| 45 | + $stream = $this->object->createStream(fopen(__FILE__, 'r')); |
|
| 46 | 46 | |
| 47 | - $this->assertInstanceOf( \Slim\Http\Stream::class, $stream ); |
|
| 48 | - $this->assertInstanceOf( \Psr\Http\Message\StreamInterface::class, $stream ); |
|
| 47 | + $this->assertInstanceOf(\Slim\Http\Stream::class, $stream); |
|
| 48 | + $this->assertInstanceOf(\Psr\Http\Message\StreamInterface::class, $stream); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | public function testCreateStreamFilename() |
| 53 | 53 | { |
| 54 | - $this->assertInstanceOf( \Psr\Http\Message\StreamInterface::class, $this->object->createStream( __FILE__ ) ); |
|
| 54 | + $this->assertInstanceOf(\Psr\Http\Message\StreamInterface::class, $this->object->createStream(__FILE__)); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | public function testCreateStreamInvalid() |
| 59 | 59 | { |
| 60 | - $this->setExpectedException( \Exception::class ); |
|
| 60 | + $this->setExpectedException(\Exception::class); |
|
| 61 | 61 | $this->object->createStream( -1 ); |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public function setUp() |
| 17 | 17 | { |
| 18 | - if( !class_exists( \Slim\Router::class, false ) ) { |
|
| 19 | - $this->markTestSkipped( '\Slim\Router is not available' ); |
|
| 18 | + if (!class_exists(\Slim\Router::class, 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); |