@@ -14,41 +14,41 @@ |
||
| 14 | 14 | |
| 15 | 15 | protected function setUp() |
| 16 | 16 | { |
| 17 | - if( !class_exists( '\TYPO3\Flow\Http\Request' ) ) { |
|
| 18 | - $this->markTestSkipped( '\TYPO3\Flow\Http\Request is not available' ); |
|
| 17 | + if (!class_exists('\TYPO3\Flow\Http\Request')) { |
|
| 18 | + $this->markTestSkipped('\TYPO3\Flow\Http\Request is not available'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - if( !class_exists( '\Zend\Diactoros\ServerRequestFactory' ) ) { |
|
| 22 | - $this->markTestSkipped( '\Zend\Diactoros\ServerRequestFactory is not available' ); |
|
| 21 | + if (!class_exists('\Zend\Diactoros\ServerRequestFactory')) { |
|
| 22 | + $this->markTestSkipped('\Zend\Diactoros\ServerRequestFactory is not available'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $view = new \Aimeos\MW\View\Standard(); |
| 26 | - $server = array( 'REMOTE_ADDR' => '127.0.0.1' ); |
|
| 27 | - $request = new \TYPO3\Flow\Http\Request( array(), array(), array(), $server ); |
|
| 28 | - $this->object = new \Aimeos\MW\View\Helper\Request\Flow( $view, $request, array(), array(), array(), array(), $server ); |
|
| 26 | + $server = array('REMOTE_ADDR' => '127.0.0.1'); |
|
| 27 | + $request = new \TYPO3\Flow\Http\Request(array(), array(), array(), $server); |
|
| 28 | + $this->object = new \Aimeos\MW\View\Helper\Request\Flow($view, $request, array(), array(), array(), array(), $server); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | protected function tearDown() |
| 33 | 33 | { |
| 34 | - unset( $this->object, $this->mock ); |
|
| 34 | + unset($this->object, $this->mock); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | public function testTransform() |
| 39 | 39 | { |
| 40 | - $this->assertInstanceOf( '\Aimeos\MW\View\Helper\Request\Flow', $this->object->transform() ); |
|
| 40 | + $this->assertInstanceOf('\Aimeos\MW\View\Helper\Request\Flow', $this->object->transform()); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | public function testGetClientAddress() |
| 45 | 45 | { |
| 46 | - $this->assertEquals( '127.0.0.1', $this->object->getClientAddress() ); |
|
| 46 | + $this->assertEquals('127.0.0.1', $this->object->getClientAddress()); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | public function testGetTarget() |
| 51 | 51 | { |
| 52 | - $this->assertEquals( null, $this->object->getTarget() ); |
|
| 52 | + $this->assertEquals(null, $this->object->getTarget()); |
|
| 53 | 53 | } |
| 54 | 54 | } |
@@ -16,23 +16,23 @@ |
||
| 16 | 16 | |
| 17 | 17 | protected function setUp() |
| 18 | 18 | { |
| 19 | - if( !class_exists( '\Zend\Diactoros\Response' ) ) { |
|
| 20 | - $this->markTestSkipped( '\Zend\Diactoros\Response is not available' ); |
|
| 19 | + if (!class_exists('\Zend\Diactoros\Response')) { |
|
| 20 | + $this->markTestSkipped('\Zend\Diactoros\Response is not available'); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | $view = new \Aimeos\MW\View\Standard(); |
| 24 | - $this->object = new \Aimeos\MW\View\Helper\Response\Flow( $view ); |
|
| 24 | + $this->object = new \Aimeos\MW\View\Helper\Response\Flow($view); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | protected function tearDown() |
| 29 | 29 | { |
| 30 | - unset( $this->object ); |
|
| 30 | + unset($this->object); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | public function testTransform() |
| 35 | 35 | { |
| 36 | - $this->assertInstanceOf( '\Aimeos\MW\View\Helper\Response\Flow', $this->object->transform() ); |
|
| 36 | + $this->assertInstanceOf('\Aimeos\MW\View\Helper\Response\Flow', $this->object->transform()); |
|
| 37 | 37 | } |
| 38 | 38 | } |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | * @param array $cookies List of uploaded files like in $_COOKIES |
| 40 | 40 | * @param array $server List of uploaded files like in $_SERVER |
| 41 | 41 | */ |
| 42 | - public function __construct( \Aimeos\MW\View\Iface $view, \TYPO3\Flow\Http\Request $request, array $files = array(), |
|
| 43 | - array $query = array(), array $post = array(), array $cookies = array(), array $server = array() ) |
|
| 42 | + public function __construct(\Aimeos\MW\View\Iface $view, \TYPO3\Flow\Http\Request $request, array $files = array(), |
|
| 43 | + array $query = array(), array $post = array(), array $cookies = array(), array $server = array()) |
|
| 44 | 44 | { |
| 45 | 45 | $this->request = $request; |
| 46 | - $psr7request = $this->createRequest( $request, $files, $query, $post, $cookies, $server ); |
|
| 46 | + $psr7request = $this->createRequest($request, $files, $query, $post, $cookies, $server); |
|
| 47 | 47 | |
| 48 | - parent::__construct( $view, $psr7request ); |
|
| 48 | + parent::__construct($view, $psr7request); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
@@ -82,18 +82,18 @@ discard block |
||
| 82 | 82 | * @param array $server List of uploaded files like in $_SERVER |
| 83 | 83 | * @return \Psr\Http\Message\ServerRequestInterface PSR-7 request object |
| 84 | 84 | */ |
| 85 | - protected function createRequest( \TYPO3\Flow\Http\Request $nativeRequest, array $files, |
|
| 86 | - array $query, array $post, array $cookies, array $server ) |
|
| 85 | + protected function createRequest(\TYPO3\Flow\Http\Request $nativeRequest, array $files, |
|
| 86 | + array $query, array $post, array $cookies, array $server) |
|
| 87 | 87 | { |
| 88 | - $server = ServerRequestFactory::normalizeServer( $server ); |
|
| 89 | - $files = ServerRequestFactory::normalizeFiles( $files ); |
|
| 88 | + $server = ServerRequestFactory::normalizeServer($server); |
|
| 89 | + $files = ServerRequestFactory::normalizeFiles($files); |
|
| 90 | 90 | $headers = $nativeRequest->getHeaders()->getAll(); |
| 91 | 91 | $uri = (string) $nativeRequest->getUri(); |
| 92 | 92 | $method = $nativeRequest->getMethod(); |
| 93 | 93 | |
| 94 | 94 | $body = new Stream('php://temp', 'wb+'); |
| 95 | - $body->write( $nativeRequest->getContent() ); |
|
| 95 | + $body->write($nativeRequest->getContent()); |
|
| 96 | 96 | |
| 97 | - return new ServerRequest( $server, $files, $uri, $method, $body, $headers, $cookies, $query, $post ); |
|
| 97 | + return new ServerRequest($server, $files, $uri, $method, $body, $headers, $cookies, $query, $post); |
|
| 98 | 98 | } |
| 99 | 99 | } |
@@ -26,8 +26,8 @@ |
||
| 26 | 26 | * |
| 27 | 27 | * @param \Aimeos\MW\View\Iface $view View instance with registered view helpers |
| 28 | 28 | */ |
| 29 | - public function __construct( \Aimeos\MW\View\Iface $view ) |
|
| 29 | + public function __construct(\Aimeos\MW\View\Iface $view) |
|
| 30 | 30 | { |
| 31 | - parent::__construct( $view, new \Zend\Diactoros\Response() ); |
|
| 31 | + parent::__construct($view, new \Zend\Diactoros\Response()); |
|
| 32 | 32 | } |
| 33 | 33 | } |
@@ -26,43 +26,43 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | protected function setUp() |
| 28 | 28 | { |
| 29 | - if( !class_exists( '\\TYPO3\\Flow\\Mvc\\Routing\\UriBuilder' ) ) { |
|
| 30 | - $this->markTestSkipped( '\\TYPO3\\Flow\\Mvc\\Routing\\UriBuilder is not available' ); |
|
| 29 | + if (!class_exists('\\TYPO3\\Flow\\Mvc\\Routing\\UriBuilder')) { |
|
| 30 | + $this->markTestSkipped('\\TYPO3\\Flow\\Mvc\\Routing\\UriBuilder is not available'); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $view = new \Aimeos\MW\View\Standard(); |
| 34 | 34 | |
| 35 | - $mockHttpRequest = $this->getMockBuilder( 'TYPO3\Flow\Http\Request' ) |
|
| 35 | + $mockHttpRequest = $this->getMockBuilder('TYPO3\Flow\Http\Request') |
|
| 36 | 36 | ->disableOriginalConstructor() |
| 37 | - ->setMethods( array( 'getBaseUri' ) ) |
|
| 37 | + ->setMethods(array('getBaseUri')) |
|
| 38 | 38 | ->getMock(); |
| 39 | - $mockHttpRequest->expects( $this->any() ) |
|
| 40 | - ->method( 'getBaseUri' ) |
|
| 41 | - ->will( $this->returnValue( 'http://localhost/' ) ); |
|
| 39 | + $mockHttpRequest->expects($this->any()) |
|
| 40 | + ->method('getBaseUri') |
|
| 41 | + ->will($this->returnValue('http://localhost/')); |
|
| 42 | 42 | |
| 43 | - $mockMainRequest = $this->getMock( 'TYPO3\Flow\Mvc\ActionRequest', |
|
| 44 | - array( 'getControllerObjectName', 'getArgumentNamespace' ), array( $mockHttpRequest ) ); |
|
| 45 | - $mockMainRequest->expects( $this->any() ) |
|
| 46 | - ->method( 'getArgumentNamespace' ) |
|
| 47 | - ->will( $this->returnValue( 'ai' ) ); |
|
| 43 | + $mockMainRequest = $this->getMock('TYPO3\Flow\Mvc\ActionRequest', |
|
| 44 | + array('getControllerObjectName', 'getArgumentNamespace'), array($mockHttpRequest)); |
|
| 45 | + $mockMainRequest->expects($this->any()) |
|
| 46 | + ->method('getArgumentNamespace') |
|
| 47 | + ->will($this->returnValue('ai')); |
|
| 48 | 48 | |
| 49 | - $this->mockRouter = $this->getMock( 'TYPO3\Flow\Mvc\Routing\Router' ); |
|
| 50 | - $mockEnv = $this->getMock( 'TYPO3\Flow\Utility\Environment', array( 'isRewriteEnabled' ), array(), '', false ); |
|
| 49 | + $this->mockRouter = $this->getMock('TYPO3\Flow\Mvc\Routing\Router'); |
|
| 50 | + $mockEnv = $this->getMock('TYPO3\Flow\Utility\Environment', array('isRewriteEnabled'), array(), '', false); |
|
| 51 | 51 | |
| 52 | 52 | $builder = new \TYPO3\Flow\Mvc\Routing\UriBuilder(); |
| 53 | - $builder->setRequest( $mockMainRequest ); |
|
| 53 | + $builder->setRequest($mockMainRequest); |
|
| 54 | 54 | |
| 55 | - $objectReflection = new \ReflectionObject( $builder ); |
|
| 55 | + $objectReflection = new \ReflectionObject($builder); |
|
| 56 | 56 | |
| 57 | - $property = $objectReflection->getProperty( 'router' ); |
|
| 58 | - $property->setAccessible( true ); |
|
| 59 | - $property->setValue( $builder, $this->mockRouter ); |
|
| 57 | + $property = $objectReflection->getProperty('router'); |
|
| 58 | + $property->setAccessible(true); |
|
| 59 | + $property->setValue($builder, $this->mockRouter); |
|
| 60 | 60 | |
| 61 | - $property = $objectReflection->getProperty( 'environment' ); |
|
| 62 | - $property->setAccessible( true ); |
|
| 63 | - $property->setValue( $builder, $mockEnv ); |
|
| 61 | + $property = $objectReflection->getProperty('environment'); |
|
| 62 | + $property->setAccessible(true); |
|
| 63 | + $property->setValue($builder, $mockEnv); |
|
| 64 | 64 | |
| 65 | - $this->object = new \Aimeos\MW\View\Helper\Url\Flow( $view, $builder, array( 'site' => 'unittest' ) ); |
|
| 65 | + $this->object = new \Aimeos\MW\View\Helper\Url\Flow($view, $builder, array('site' => 'unittest')); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | |
@@ -80,60 +80,60 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | public function testTransform() |
| 82 | 82 | { |
| 83 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 84 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 83 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 84 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 85 | 85 | |
| 86 | - $this->assertEquals( '/index.php/shop/catalog/lists', $this->object->transform( 'shop', 'catalog', 'lists' ) ); |
|
| 86 | + $this->assertEquals('/index.php/shop/catalog/lists', $this->object->transform('shop', 'catalog', 'lists')); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | |
| 90 | 90 | public function testTransformSlashes() |
| 91 | 91 | { |
| 92 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 93 | - ->will( $this->returnValue( 'shop/catalog/lists?test=a%2Fb') ); |
|
| 92 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 93 | + ->will($this->returnValue('shop/catalog/lists?test=a%2Fb')); |
|
| 94 | 94 | |
| 95 | - $this->assertEquals( '/index.php/shop/catalog/lists?test=a%2Fb', $this->object->transform( 'shop', 'catalog', 'lists', array( 'test' => 'a/b' ) ) ); |
|
| 95 | + $this->assertEquals('/index.php/shop/catalog/lists?test=a%2Fb', $this->object->transform('shop', 'catalog', 'lists', array('test' => 'a/b'))); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
| 99 | 99 | public function testTransformArrays() |
| 100 | 100 | { |
| 101 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 102 | - ->will( $this->returnValue( 'shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b') ); |
|
| 101 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 102 | + ->will($this->returnValue('shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b')); |
|
| 103 | 103 | |
| 104 | - $this->assertEquals( '/index.php/shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b', $this->object->transform( 'shop', 'catalog', 'lists', array( 'test' => array( 'a', 'b' ) ) ) ); |
|
| 104 | + $this->assertEquals('/index.php/shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b', $this->object->transform('shop', 'catalog', 'lists', array('test' => array('a', 'b')))); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
| 108 | 108 | public function testTransformTrailing() |
| 109 | 109 | { |
| 110 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 111 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 110 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 111 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 112 | 112 | |
| 113 | - $this->assertEquals( '/index.php/shop/catalog/lists#a/b', $this->object->transform( 'shop', 'catalog', 'lists', array(), array( 'a', 'b' ) ) ); |
|
| 113 | + $this->assertEquals('/index.php/shop/catalog/lists#a/b', $this->object->transform('shop', 'catalog', 'lists', array(), array('a', 'b'))); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | public function testTransformAbsolute() |
| 118 | 118 | { |
| 119 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 120 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 119 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 120 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 121 | 121 | |
| 122 | - $options = array( 'absoluteUri' => true ); |
|
| 123 | - $result = $this->object->transform( 'shop', 'catalog', 'lists', array(), array(), $options ); |
|
| 122 | + $options = array('absoluteUri' => true); |
|
| 123 | + $result = $this->object->transform('shop', 'catalog', 'lists', array(), array(), $options); |
|
| 124 | 124 | |
| 125 | - $this->assertEquals( 'http://localhost/index.php/shop/catalog/lists', $result ); |
|
| 125 | + $this->assertEquals('http://localhost/index.php/shop/catalog/lists', $result); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
| 129 | 129 | public function testTransformConfig() |
| 130 | 130 | { |
| 131 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
| 132 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
| 131 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
| 132 | + ->will($this->returnValue('shop/catalog/lists')); |
|
| 133 | 133 | |
| 134 | - $options = array( 'package' => 'test', 'subpackage' => 'subtest', 'format' => 'fmt' ); |
|
| 135 | - $result = $this->object->transform( 'shop', 'catalog', 'lists', array(), array(), $options ); |
|
| 134 | + $options = array('package' => 'test', 'subpackage' => 'subtest', 'format' => 'fmt'); |
|
| 135 | + $result = $this->object->transform('shop', 'catalog', 'lists', array(), array(), $options); |
|
| 136 | 136 | |
| 137 | - $this->assertEquals( '/index.php/shop/catalog/lists', $result ); |
|
| 137 | + $this->assertEquals('/index.php/shop/catalog/lists', $result); |
|
| 138 | 138 | } |
| 139 | 139 | } |