@@ -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 | } |