@@ -26,42 +26,42 @@ 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', array( 'getControllerObjectName' ), array( $mockHttpRequest ) ); |
|
44 | - $mockMainRequest->expects( $this->any() ) |
|
45 | - ->method( 'getArgumentNamespace' ) |
|
46 | - ->will( $this->returnValue( 'ai' ) ); |
|
43 | + $mockMainRequest = $this->getMock('TYPO3\Flow\Mvc\ActionRequest', array('getControllerObjectName'), array($mockHttpRequest)); |
|
44 | + $mockMainRequest->expects($this->any()) |
|
45 | + ->method('getArgumentNamespace') |
|
46 | + ->will($this->returnValue('ai')); |
|
47 | 47 | |
48 | - $this->mockRouter = $this->getMock( 'TYPO3\Flow\Mvc\Routing\Router' ); |
|
49 | - $mockEnv = $this->getMock( 'TYPO3\Flow\Utility\Environment', array( 'isRewriteEnabled' ), array(), '', false ); |
|
48 | + $this->mockRouter = $this->getMock('TYPO3\Flow\Mvc\Routing\Router'); |
|
49 | + $mockEnv = $this->getMock('TYPO3\Flow\Utility\Environment', array('isRewriteEnabled'), array(), '', false); |
|
50 | 50 | |
51 | 51 | $builder = new \TYPO3\Flow\Mvc\Routing\UriBuilder(); |
52 | - $builder->setRequest( $mockMainRequest ); |
|
52 | + $builder->setRequest($mockMainRequest); |
|
53 | 53 | |
54 | - $objectReflection = new \ReflectionObject( $builder ); |
|
54 | + $objectReflection = new \ReflectionObject($builder); |
|
55 | 55 | |
56 | - $property = $objectReflection->getProperty( 'router' ); |
|
57 | - $property->setAccessible( true ); |
|
58 | - $property->setValue( $builder, $this->mockRouter ); |
|
56 | + $property = $objectReflection->getProperty('router'); |
|
57 | + $property->setAccessible(true); |
|
58 | + $property->setValue($builder, $this->mockRouter); |
|
59 | 59 | |
60 | - $property = $objectReflection->getProperty( 'environment' ); |
|
61 | - $property->setAccessible( true ); |
|
62 | - $property->setValue( $builder, $mockEnv ); |
|
60 | + $property = $objectReflection->getProperty('environment'); |
|
61 | + $property->setAccessible(true); |
|
62 | + $property->setValue($builder, $mockEnv); |
|
63 | 63 | |
64 | - $this->object = new \Aimeos\MW\View\Helper\Url\Flow( $view, $builder, array( 'site' => 'unittest' ) ); |
|
64 | + $this->object = new \Aimeos\MW\View\Helper\Url\Flow($view, $builder, array('site' => 'unittest')); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -79,60 +79,60 @@ discard block |
||
79 | 79 | |
80 | 80 | public function testTransform() |
81 | 81 | { |
82 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
83 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
82 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
83 | + ->will($this->returnValue('shop/catalog/lists')); |
|
84 | 84 | |
85 | - $this->assertEquals( '/index.php/shop/catalog/lists', $this->object->transform( 'shop', 'catalog', 'lists' ) ); |
|
85 | + $this->assertEquals('/index.php/shop/catalog/lists', $this->object->transform('shop', 'catalog', 'lists')); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
89 | 89 | public function testTransformSlashes() |
90 | 90 | { |
91 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
92 | - ->will( $this->returnValue( 'shop/catalog/lists?test=a%2Fb') ); |
|
91 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
92 | + ->will($this->returnValue('shop/catalog/lists?test=a%2Fb')); |
|
93 | 93 | |
94 | - $this->assertEquals( '/index.php/shop/catalog/lists?test=a%2Fb', $this->object->transform( 'shop', 'catalog', 'lists', array( 'test' => 'a/b' ) ) ); |
|
94 | + $this->assertEquals('/index.php/shop/catalog/lists?test=a%2Fb', $this->object->transform('shop', 'catalog', 'lists', array('test' => 'a/b'))); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
98 | 98 | public function testTransformArrays() |
99 | 99 | { |
100 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
101 | - ->will( $this->returnValue( 'shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b') ); |
|
100 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
101 | + ->will($this->returnValue('shop/catalog/list?test%5B0%5D=a&test%5B1%5D=b')); |
|
102 | 102 | |
103 | - $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' ) ) ) ); |
|
103 | + $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 | 104 | } |
105 | 105 | |
106 | 106 | |
107 | 107 | public function testTransformTrailing() |
108 | 108 | { |
109 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
110 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
109 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
110 | + ->will($this->returnValue('shop/catalog/lists')); |
|
111 | 111 | |
112 | - $this->assertEquals( '/index.php/shop/catalog/lists#a/b', $this->object->transform( 'shop', 'catalog', 'lists', array(), array( 'a', 'b' ) ) ); |
|
112 | + $this->assertEquals('/index.php/shop/catalog/lists#a/b', $this->object->transform('shop', 'catalog', 'lists', array(), array('a', 'b'))); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
116 | 116 | public function testTransformAbsolute() |
117 | 117 | { |
118 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
119 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
118 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
119 | + ->will($this->returnValue('shop/catalog/lists')); |
|
120 | 120 | |
121 | - $options = array( 'absoluteUri' => true ); |
|
122 | - $result = $this->object->transform( 'shop', 'catalog', 'lists', array(), array(), $options ); |
|
121 | + $options = array('absoluteUri' => true); |
|
122 | + $result = $this->object->transform('shop', 'catalog', 'lists', array(), array(), $options); |
|
123 | 123 | |
124 | - $this->assertEquals( 'http://localhost/index.php/shop/catalog/lists', $result ); |
|
124 | + $this->assertEquals('http://localhost/index.php/shop/catalog/lists', $result); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | 128 | public function testTransformConfig() |
129 | 129 | { |
130 | - $this->mockRouter->expects( $this->once() )->method( 'resolve' ) |
|
131 | - ->will( $this->returnValue( 'shop/catalog/lists') ); |
|
130 | + $this->mockRouter->expects($this->once())->method('resolve') |
|
131 | + ->will($this->returnValue('shop/catalog/lists')); |
|
132 | 132 | |
133 | - $options = array( 'package' => 'test', 'subpackage' => 'subtest', 'format' => 'fmt' ); |
|
134 | - $result = $this->object->transform( 'shop', 'catalog', 'lists', array(), array(), $options ); |
|
133 | + $options = array('package' => 'test', 'subpackage' => 'subtest', 'format' => 'fmt'); |
|
134 | + $result = $this->object->transform('shop', 'catalog', 'lists', array(), array(), $options); |
|
135 | 135 | |
136 | - $this->assertEquals( '/index.php/shop/catalog/lists', $result ); |
|
136 | + $this->assertEquals('/index.php/shop/catalog/lists', $result); |
|
137 | 137 | } |
138 | 138 | } |
@@ -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 | } |