Completed
Push — master ( fa87fb...106664 )
by Aimeos
05:31
created
admin/jsonadm/src/Admin/JsonAdm/Locale/Site/Standard.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,6 @@
 block discarded – undo
106 106
 	/**
107 107
 	 * Returns the requested resource or the resource list
108 108
 	 *
109
-	 * @param string $body Request body
110 109
 	 * @param \Psr\Http\Message\ServerRequestInterface $request Request object
111 110
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
112 111
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
112 112
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
113 113
 	 */
114
-	public function get( ServerRequestInterface $request, ResponseInterface $response )
114
+	public function get(ServerRequestInterface $request, ResponseInterface $response)
115 115
 	{
116 116
 		/** admin/jsonadm/partials/locale/site/template-data
117 117
 		 * Relative path to the data partial template file for the locale site  client
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 		 * @since 2016.07
129 129
 		 * @category Developer
130 130
 		 */
131
-		$this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/locale/site/template-data' ) );
131
+		$this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/locale/site/template-data'));
132 132
 
133
-		return parent::get( $request, $response );
133
+		return parent::get($request, $response);
134 134
 	}
135 135
 
136 136
 
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
 	 * @param array $include List of resource types that should be fetched
142 142
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
143 143
 	 */
144
-	protected function getChildItems( array $items, array $include )
144
+	protected function getChildItems(array $items, array $include)
145 145
 	{
146 146
 		$list = array();
147 147
 
148
-		if( in_array( 'locale/site', $include ) )
148
+		if (in_array('locale/site', $include))
149 149
 		{
150
-			foreach( $items as $item ) {
151
-				$list = array_merge( $list, $item->getChildren() );
150
+			foreach ($items as $item) {
151
+				$list = array_merge($list, $item->getChildren());
152 152
 			}
153 153
 		}
154 154
 
@@ -164,30 +164,30 @@  discard block
 block discarded – undo
164 164
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
165 165
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
166 166
 	 */
167
-	protected function getItems( \Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response )
167
+	protected function getItems(\Aimeos\MW\View\Iface $view, ServerRequestInterface $request, ResponseInterface $response)
168 168
 	{
169
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale/site' );
169
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale/site');
170 170
 
171
-		if( ( $key = $view->param( 'aggregate' ) ) !== null )
171
+		if (($key = $view->param('aggregate')) !== null)
172 172
 		{
173
-			$search = $this->initCriteria( $manager->createSearch(), $view->param() );
174
-			$view->data = $manager->aggregate( $search, $key );
173
+			$search = $this->initCriteria($manager->createSearch(), $view->param());
174
+			$view->data = $manager->aggregate($search, $key);
175 175
 			return $response;
176 176
 		}
177 177
 
178
-		$include = ( ( $include = $view->param( 'include' ) ) !== null ? explode( ',', $include ) : array() );
179
-		$search = $this->initCriteria( $manager->createSearch(), $view->param() );
178
+		$include = (($include = $view->param('include')) !== null ? explode(',', $include) : array());
179
+		$search = $this->initCriteria($manager->createSearch(), $view->param());
180 180
 		$total = 1;
181 181
 
182
-		if( ( $id = $view->param( 'id' ) ) == null )
182
+		if (($id = $view->param('id')) == null)
183 183
 		{
184
-			$view->data = $manager->searchItems( $search, array(), $total );
185
-			$view->childItems = $this->getChildItems( $view->data, $include );
184
+			$view->data = $manager->searchItems($search, array(), $total);
185
+			$view->childItems = $this->getChildItems($view->data, $include);
186 186
 		}
187 187
 		else
188 188
 		{
189
-			$view->data = $manager->getTree( $id, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search );
190
-			$view->childItems = $this->getChildItems( array( $view->data ), $include );
189
+			$view->data = $manager->getTree($id, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST, $search);
190
+			$view->childItems = $this->getChildItems(array($view->data), $include);
191 191
 		}
192 192
 
193 193
 		$view->listItems = array();
@@ -205,32 +205,32 @@  discard block
 block discarded – undo
205 205
 	 * @param \stdClass $entry Object including "id" and "attributes" elements
206 206
 	 * @return \Aimeos\MShop\Common\Item\Iface New or updated item
207 207
 	 */
208
-	protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry )
208
+	protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry)
209 209
 	{
210
-		$targetId = ( isset( $entry->targetid ) ? $entry->targetid : null );
211
-		$refId = ( isset( $entry->refid ) ? $entry->refid : null );
210
+		$targetId = (isset($entry->targetid) ? $entry->targetid : null);
211
+		$refId = (isset($entry->refid) ? $entry->refid : null);
212 212
 
213
-		if( isset( $entry->id ) )
213
+		if (isset($entry->id))
214 214
 		{
215
-			$item = $manager->getItem( $entry->id );
216
-			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
217
-			$manager->saveItem( $item );
215
+			$item = $manager->getItem($entry->id);
216
+			$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
217
+			$manager->saveItem($item);
218 218
 
219
-			if( isset( $entry->parentid ) && $targetId !== null ) {
220
-				$manager->moveItem( $item->getId(), $entry->parentid, $targetId, $refId );
219
+			if (isset($entry->parentid) && $targetId !== null) {
220
+				$manager->moveItem($item->getId(), $entry->parentid, $targetId, $refId);
221 221
 			}
222 222
 		}
223 223
 		else
224 224
 		{
225 225
 			$item = $manager->createItem();
226
-			$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
227
-			$manager->insertItem( $item, $targetId, $refId );
226
+			$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
227
+			$manager->insertItem($item, $targetId, $refId);
228 228
 		}
229 229
 
230
-		if( isset( $entry->relationships ) ) {
231
-			$this->saveRelationships( $manager, $item, $entry->relationships );
230
+		if (isset($entry->relationships)) {
231
+			$this->saveRelationships($manager, $item, $entry->relationships);
232 232
 		}
233 233
 
234
-		return $manager->getItem( $item->getId() );
234
+		return $manager->getItem($item->getId());
235 235
 	}
236 236
 }
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Order/Standard.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,6 @@
 block discarded – undo
106 106
 	/**
107 107
 	 * Returns the requested resource or the resource list
108 108
 	 *
109
-	 * @param string $body Request body
110 109
 	 * @param \Psr\Http\Message\ServerRequestInterface $request Request object
111 110
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
112 111
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
112 112
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
113 113
 	 */
114
-	public function get( ServerRequestInterface $request, ResponseInterface $response )
114
+	public function get(ServerRequestInterface $request, ResponseInterface $response)
115 115
 	{
116 116
 		/** admin/jsonadm/partials/order/template-data
117 117
 		 * Relative path to the data partial template file for the order client
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 		 * @since 2016.01
129 129
 		 * @category Developer
130 130
 		 */
131
-		$this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/order/template-data' ) );
131
+		$this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/order/template-data'));
132 132
 
133
-		return parent::get( $request, $response );
133
+		return parent::get($request, $response);
134 134
 	}
135 135
 
136 136
 
@@ -141,35 +141,35 @@  discard block
 block discarded – undo
141 141
 	 * @param array $include List of resource types that should be fetched
142 142
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
143 143
 	 */
144
-	protected function getChildItems( array $items, array $include )
144
+	protected function getChildItems(array $items, array $include)
145 145
 	{
146 146
 		$list = array();
147 147
 
148
-		if( in_array( 'order/base', $include ) )
148
+		if (in_array('order/base', $include))
149 149
 		{
150 150
 			$ids = array();
151 151
 
152
-			foreach( $items as $item ) {
152
+			foreach ($items as $item) {
153 153
 				$ids[] = $item->getBaseId();
154 154
 			}
155 155
 
156
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base' );
156
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base');
157 157
 
158 158
 			$search = $manager->createSearch();
159
-			$search->setConditions( $search->compare( '==', 'order.base.id', $ids ) );
159
+			$search->setConditions($search->compare('==', 'order.base.id', $ids));
160 160
 
161
-			$list = array_merge( $list, $manager->searchItems( $search ) );
161
+			$list = array_merge($list, $manager->searchItems($search));
162 162
 		}
163 163
 
164
-		if( in_array( 'order/status', $include ) )
164
+		if (in_array('order/status', $include))
165 165
 		{
166
-			$ids = array_keys( $items );
167
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/status' );
166
+			$ids = array_keys($items);
167
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/status');
168 168
 
169 169
 			$search = $manager->createSearch();
170
-			$search->setConditions( $search->compare( '==', 'order.status.parentid', $ids ) );
170
+			$search->setConditions($search->compare('==', 'order.status.parentid', $ids));
171 171
 
172
-			$list = array_merge( $list, $manager->searchItems( $search ) );
172
+			$list = array_merge($list, $manager->searchItems($search));
173 173
 		}
174 174
 
175 175
 		return $list;
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/StandardTest.php 1 patch
Spacing   +372 added lines, -372 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'product' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'product');
26 26
 	}
27 27
 
28 28
 
@@ -34,193 +34,193 @@  discard block
 block discarded – undo
34 34
 
35 35
 	public function testDelete()
36 36
 	{
37
-		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' );
37
+		$this->getProductMock(array('deleteItem'))->expects($this->once())->method('deleteItem');
38 38
 
39
-		$params = array( 'id' => $this->getProductItem()->getId() );
40
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
41
-		$this->view->addHelper( 'param', $helper );
39
+		$params = array('id' => $this->getProductItem()->getId());
40
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
41
+		$this->view->addHelper('param', $helper);
42 42
 
43
-		$response = $this->object->delete( $this->view->request(), $this->view->response() );
44
-		$result = json_decode( (string) $response->getBody(), true );
43
+		$response = $this->object->delete($this->view->request(), $this->view->response());
44
+		$result = json_decode((string) $response->getBody(), true);
45 45
 
46 46
 
47
-		$this->assertEquals( 200, $response->getStatusCode() );
48
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
47
+		$this->assertEquals(200, $response->getStatusCode());
48
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
49 49
 
50
-		$this->assertEquals( 1, $result['meta']['total'] );
50
+		$this->assertEquals(1, $result['meta']['total']);
51 51
 
52
-		$this->assertArrayNotHasKey( 'included', $result );
53
-		$this->assertArrayNotHasKey( 'data', $result );
54
-		$this->assertArrayNotHasKey( 'errors', $result );
52
+		$this->assertArrayNotHasKey('included', $result);
53
+		$this->assertArrayNotHasKey('data', $result);
54
+		$this->assertArrayNotHasKey('errors', $result);
55 55
 	}
56 56
 
57 57
 
58 58
 	public function testDeleteBulk()
59 59
 	{
60
-		$this->getProductMock( array( 'deleteItems' ) )->expects( $this->once() )->method( 'deleteItems' );
60
+		$this->getProductMock(array('deleteItems'))->expects($this->once())->method('deleteItems');
61 61
 
62 62
 		$body = '{"data":[{"type": "product", "id": "-1"},{"type": "product", "id": "-2"}]}';
63
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
63
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
64 64
 
65
-		$response = $this->object->delete( $this->view->request(), $this->view->response() );
66
-		$result = json_decode( (string) $response->getBody(), true );
65
+		$response = $this->object->delete($this->view->request(), $this->view->response());
66
+		$result = json_decode((string) $response->getBody(), true);
67 67
 
68 68
 
69
-		$this->assertEquals( 200, $response->getStatusCode() );
70
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
69
+		$this->assertEquals(200, $response->getStatusCode());
70
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
71 71
 
72
-		$this->assertEquals( 2, $result['meta']['total'] );
73
-		$this->assertArrayNotHasKey( 'included', $result );
74
-		$this->assertArrayNotHasKey( 'data', $result );
75
-		$this->assertArrayNotHasKey( 'errors', $result );
72
+		$this->assertEquals(2, $result['meta']['total']);
73
+		$this->assertArrayNotHasKey('included', $result);
74
+		$this->assertArrayNotHasKey('data', $result);
75
+		$this->assertArrayNotHasKey('errors', $result);
76 76
 	}
77 77
 
78 78
 
79 79
 	public function testDeleteInvalid()
80 80
 	{
81 81
 		$body = '{"data":null}';
82
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
82
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
83 83
 
84
-		$response = $this->object->delete( $this->view->request(), $this->view->response() );
85
-		$result = json_decode( (string) $response->getBody(), true );
84
+		$response = $this->object->delete($this->view->request(), $this->view->response());
85
+		$result = json_decode((string) $response->getBody(), true);
86 86
 
87 87
 
88
-		$this->assertEquals( 400, $response->getStatusCode() );
89
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
88
+		$this->assertEquals(400, $response->getStatusCode());
89
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
90 90
 
91
-		$this->assertEquals( 0, $result['meta']['total'] );
92
-		$this->assertArrayHasKey( 'errors', $result );
93
-		$this->assertArrayNotHasKey( 'included', $result );
94
-		$this->assertArrayNotHasKey( 'data', $result );
91
+		$this->assertEquals(0, $result['meta']['total']);
92
+		$this->assertArrayHasKey('errors', $result);
93
+		$this->assertArrayNotHasKey('included', $result);
94
+		$this->assertArrayNotHasKey('data', $result);
95 95
 	}
96 96
 
97 97
 
98 98
 	public function testDeleteException()
99 99
 	{
100
-		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' )
101
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
100
+		$this->getProductMock(array('deleteItem'))->expects($this->once())->method('deleteItem')
101
+			->will($this->throwException(new \RuntimeException('test exception')));
102 102
 
103
-		$params = array( 'id' => $this->getProductItem()->getId() );
104
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
105
-		$this->view->addHelper( 'param', $helper );
103
+		$params = array('id' => $this->getProductItem()->getId());
104
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
105
+		$this->view->addHelper('param', $helper);
106 106
 
107
-		$response = $this->object->delete( $this->view->request(), $this->view->response() );
108
-		$result = json_decode( (string) $response->getBody(), true );
107
+		$response = $this->object->delete($this->view->request(), $this->view->response());
108
+		$result = json_decode((string) $response->getBody(), true);
109 109
 
110
-		$this->assertEquals( 500, $response->getStatusCode() );
111
-		$this->assertArrayHasKey( 'errors', $result );
110
+		$this->assertEquals(500, $response->getStatusCode());
111
+		$this->assertArrayHasKey('errors', $result);
112 112
 	}
113 113
 
114 114
 
115 115
 	public function testDeleteMShopException()
116 116
 	{
117
-		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' )
118
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
117
+		$this->getProductMock(array('deleteItem'))->expects($this->once())->method('deleteItem')
118
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
119 119
 
120
-		$params = array( 'id' => $this->getProductItem()->getId() );
121
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
122
-		$this->view->addHelper( 'param', $helper );
120
+		$params = array('id' => $this->getProductItem()->getId());
121
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
122
+		$this->view->addHelper('param', $helper);
123 123
 
124
-		$response = $this->object->delete( $this->view->request(), $this->view->response() );
125
-		$result = json_decode( (string) $response->getBody(), true );
124
+		$response = $this->object->delete($this->view->request(), $this->view->response());
125
+		$result = json_decode((string) $response->getBody(), true);
126 126
 
127
-		$this->assertEquals( 404, $response->getStatusCode() );
128
-		$this->assertArrayHasKey( 'errors', $result );
127
+		$this->assertEquals(404, $response->getStatusCode());
128
+		$this->assertArrayHasKey('errors', $result);
129 129
 	}
130 130
 
131 131
 
132 132
 	public function testGet()
133 133
 	{
134
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
135
-		$result = json_decode( (string) $response->getBody(), true );
134
+		$response = $this->object->get($this->view->request(), $this->view->response());
135
+		$result = json_decode((string) $response->getBody(), true);
136 136
 
137 137
 
138
-		$this->assertEquals( 200, $response->getStatusCode() );
139
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
138
+		$this->assertEquals(200, $response->getStatusCode());
139
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
140 140
 
141
-		$this->assertEquals( 28, $result['meta']['total'] );
142
-		$this->assertEquals( 25, count( $result['data'] ) );
143
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
144
-		$this->assertEquals( 0, count( $result['included'] ) );
145
-		$this->assertArrayHasKey( 'next', $result['links'] );
146
-		$this->assertArrayHasKey( 'last', $result['links'] );
147
-		$this->assertArrayHasKey( 'self', $result['links'] );
148
-		$this->assertArrayNotHasKey( 'errors', $result );
141
+		$this->assertEquals(28, $result['meta']['total']);
142
+		$this->assertEquals(25, count($result['data']));
143
+		$this->assertEquals('product', $result['data'][0]['type']);
144
+		$this->assertEquals(0, count($result['included']));
145
+		$this->assertArrayHasKey('next', $result['links']);
146
+		$this->assertArrayHasKey('last', $result['links']);
147
+		$this->assertArrayHasKey('self', $result['links']);
148
+		$this->assertArrayNotHasKey('errors', $result);
149 149
 	}
150 150
 
151 151
 
152 152
 	public function testGetType()
153 153
 	{
154 154
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
155
-		$object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'product/property/type' );
155
+		$object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'product/property/type');
156 156
 
157
-		$response = $object->get( $this->view->request(), $this->view->response() );
158
-		$result = json_decode( (string) $response->getBody(), true );
157
+		$response = $object->get($this->view->request(), $this->view->response());
158
+		$result = json_decode((string) $response->getBody(), true);
159 159
 
160 160
 
161
-		$this->assertEquals( 200, $response->getStatusCode() );
162
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
161
+		$this->assertEquals(200, $response->getStatusCode());
162
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
163 163
 
164
-		$this->assertEquals( 4, $result['meta']['total'] );
165
-		$this->assertEquals( 4, count( $result['data'] ) );
166
-		$this->assertEquals( 'product/property/type', $result['data'][0]['type'] );
167
-		$this->assertEquals( 0, count( $result['included'] ) );
164
+		$this->assertEquals(4, $result['meta']['total']);
165
+		$this->assertEquals(4, count($result['data']));
166
+		$this->assertEquals('product/property/type', $result['data'][0]['type']);
167
+		$this->assertEquals(0, count($result['included']));
168 168
 
169
-		$this->assertArrayNotHasKey( 'errors', $result );
169
+		$this->assertArrayNotHasKey('errors', $result);
170 170
 	}
171 171
 
172 172
 
173 173
 	public function testGetInvalid()
174 174
 	{
175 175
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
176
-		$object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'invalid' );
176
+		$object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'invalid');
177 177
 
178
-		$response = $object->get( $this->view->request(), $this->view->response() );
179
-		$result = json_decode( (string) $response->getBody(), true );
178
+		$response = $object->get($this->view->request(), $this->view->response());
179
+		$result = json_decode((string) $response->getBody(), true);
180 180
 
181 181
 
182
-		$this->assertEquals( 404, $response->getStatusCode() );
183
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
182
+		$this->assertEquals(404, $response->getStatusCode());
183
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
184 184
 
185
-		$this->assertEquals( 1, count( $result['errors'] ) );
186
-		$this->assertArrayHasKey( 'title', $result['errors'][0] );
187
-		$this->assertArrayHasKey( 'detail', $result['errors'][0] );
188
-		$this->assertArrayNotHasKey( 'data', $result );
189
-		$this->assertArrayNotHasKey( 'indluded', $result );
185
+		$this->assertEquals(1, count($result['errors']));
186
+		$this->assertArrayHasKey('title', $result['errors'][0]);
187
+		$this->assertArrayHasKey('detail', $result['errors'][0]);
188
+		$this->assertArrayNotHasKey('data', $result);
189
+		$this->assertArrayNotHasKey('indluded', $result);
190 190
 	}
191 191
 
192 192
 
193 193
 	public function testGetException()
194 194
 	{
195
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
196
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
195
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
196
+			->will($this->throwException(new \RuntimeException('test exception')));
197 197
 
198
-		$params = array( 'id' => -1 );
199
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
200
-		$this->view->addHelper( 'param', $helper );
198
+		$params = array('id' => -1);
199
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
200
+		$this->view->addHelper('param', $helper);
201 201
 
202
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
203
-		$result = json_decode( (string) $response->getBody(), true );
202
+		$response = $this->object->get($this->view->request(), $this->view->response());
203
+		$result = json_decode((string) $response->getBody(), true);
204 204
 
205
-		$this->assertEquals( 500, $response->getStatusCode() );
206
-		$this->assertArrayHasKey( 'errors', $result );
205
+		$this->assertEquals(500, $response->getStatusCode());
206
+		$this->assertArrayHasKey('errors', $result);
207 207
 	}
208 208
 
209 209
 
210 210
 	public function testGetMShopException()
211 211
 	{
212
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
213
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
212
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
213
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
214 214
 
215
-		$params = array( 'id' => -1 );
216
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
217
-		$this->view->addHelper( 'param', $helper );
215
+		$params = array('id' => -1);
216
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
217
+		$this->view->addHelper('param', $helper);
218 218
 
219
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
220
-		$result = json_decode( (string) $response->getBody(), true );
219
+		$response = $this->object->get($this->view->request(), $this->view->response());
220
+		$result = json_decode((string) $response->getBody(), true);
221 221
 
222
-		$this->assertEquals( 404, $response->getStatusCode() );
223
-		$this->assertArrayHasKey( 'errors', $result );
222
+		$this->assertEquals(404, $response->getStatusCode());
223
+		$this->assertArrayHasKey('errors', $result);
224 224
 	}
225 225
 
226 226
 
@@ -228,25 +228,25 @@  discard block
 block discarded – undo
228 228
 	{
229 229
 		$params = array(
230 230
 			'filter' => array(
231
-				'==' => array( 'product.type.code' => 'select' )
231
+				'==' => array('product.type.code' => 'select')
232 232
 			)
233 233
 		);
234
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
235
-		$this->view->addHelper( 'param', $helper );
234
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
235
+		$this->view->addHelper('param', $helper);
236 236
 
237
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
238
-		$result = json_decode( (string) $response->getBody(), true );
237
+		$response = $this->object->get($this->view->request(), $this->view->response());
238
+		$result = json_decode((string) $response->getBody(), true);
239 239
 
240 240
 
241
-		$this->assertEquals( 200, $response->getStatusCode() );
242
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
241
+		$this->assertEquals(200, $response->getStatusCode());
242
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
243 243
 
244
-		$this->assertEquals( 3, $result['meta']['total'] );
245
-		$this->assertEquals( 3, count( $result['data'] ) );
246
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
247
-		$this->assertEquals( 0, count( $result['included'] ) );
244
+		$this->assertEquals(3, $result['meta']['total']);
245
+		$this->assertEquals(3, count($result['data']));
246
+		$this->assertEquals('product', $result['data'][0]['type']);
247
+		$this->assertEquals(0, count($result['included']));
248 248
 
249
-		$this->assertArrayNotHasKey( 'errors', $result );
249
+		$this->assertArrayNotHasKey('errors', $result);
250 250
 	}
251 251
 
252 252
 
@@ -255,27 +255,27 @@  discard block
 block discarded – undo
255 255
 		$params = array(
256 256
 			'filter' => array(
257 257
 				'&&' => array(
258
-					array( '=~' => array( 'product.label' => 'Unittest: Test' ) ),
259
-					array( '==' => array( 'product.type.code' => 'select' ) ),
258
+					array('=~' => array('product.label' => 'Unittest: Test')),
259
+					array('==' => array('product.type.code' => 'select')),
260 260
 				)
261 261
 			)
262 262
 		);
263
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
264
-		$this->view->addHelper( 'param', $helper );
263
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
264
+		$this->view->addHelper('param', $helper);
265 265
 
266
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
267
-		$result = json_decode( (string) $response->getBody(), true );
266
+		$response = $this->object->get($this->view->request(), $this->view->response());
267
+		$result = json_decode((string) $response->getBody(), true);
268 268
 
269 269
 
270
-		$this->assertEquals( 200, $response->getStatusCode() );
271
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
270
+		$this->assertEquals(200, $response->getStatusCode());
271
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
272 272
 
273
-		$this->assertEquals( 2, $result['meta']['total'] );
274
-		$this->assertEquals( 2, count( $result['data'] ) );
275
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
276
-		$this->assertEquals( 0, count( $result['included'] ) );
273
+		$this->assertEquals(2, $result['meta']['total']);
274
+		$this->assertEquals(2, count($result['data']));
275
+		$this->assertEquals('product', $result['data'][0]['type']);
276
+		$this->assertEquals(0, count($result['included']));
277 277
 
278
-		$this->assertArrayNotHasKey( 'errors', $result );
278
+		$this->assertArrayNotHasKey('errors', $result);
279 279
 	}
280 280
 
281 281
 
@@ -287,25 +287,25 @@  discard block
 block discarded – undo
287 287
 				'limit' => 25
288 288
 			)
289 289
 		);
290
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
291
-		$this->view->addHelper( 'param', $helper );
290
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
291
+		$this->view->addHelper('param', $helper);
292 292
 
293
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
294
-		$result = json_decode( (string) $response->getBody(), true );
293
+		$response = $this->object->get($this->view->request(), $this->view->response());
294
+		$result = json_decode((string) $response->getBody(), true);
295 295
 
296 296
 
297
-		$this->assertEquals( 200, $response->getStatusCode() );
298
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
297
+		$this->assertEquals(200, $response->getStatusCode());
298
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
299 299
 
300
-		$this->assertEquals( 28, $result['meta']['total'] );
301
-		$this->assertEquals( 3, count( $result['data'] ) );
302
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
303
-		$this->assertEquals( 0, count( $result['included'] ) );
304
-		$this->assertArrayHasKey( 'first', $result['links'] );
305
-		$this->assertArrayHasKey( 'prev', $result['links'] );
306
-		$this->assertArrayHasKey( 'self', $result['links'] );
300
+		$this->assertEquals(28, $result['meta']['total']);
301
+		$this->assertEquals(3, count($result['data']));
302
+		$this->assertEquals('product', $result['data'][0]['type']);
303
+		$this->assertEquals(0, count($result['included']));
304
+		$this->assertArrayHasKey('first', $result['links']);
305
+		$this->assertArrayHasKey('prev', $result['links']);
306
+		$this->assertArrayHasKey('self', $result['links']);
307 307
 
308
-		$this->assertArrayNotHasKey( 'errors', $result );
308
+		$this->assertArrayNotHasKey('errors', $result);
309 309
 	}
310 310
 
311 311
 
@@ -314,24 +314,24 @@  discard block
 block discarded – undo
314 314
 		$params = array(
315 315
 			'sort' => 'product.label,-product.code'
316 316
 		);
317
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
318
-		$this->view->addHelper( 'param', $helper );
317
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
318
+		$this->view->addHelper('param', $helper);
319 319
 
320
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
321
-		$result = json_decode( (string) $response->getBody(), true );
320
+		$response = $this->object->get($this->view->request(), $this->view->response());
321
+		$result = json_decode((string) $response->getBody(), true);
322 322
 
323 323
 
324
-		$this->assertEquals( 200, $response->getStatusCode() );
325
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
324
+		$this->assertEquals(200, $response->getStatusCode());
325
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
326 326
 
327
-		$this->assertEquals( 28, $result['meta']['total'] );
328
-		$this->assertEquals( 25, count( $result['data'] ) );
329
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
330
-		$this->assertEquals( 'QRST', $result['data'][0]['attributes']['product.code'] );
331
-		$this->assertEquals( '16 discs', $result['data'][0]['attributes']['product.label'] );
332
-		$this->assertEquals( 0, count( $result['included'] ) );
327
+		$this->assertEquals(28, $result['meta']['total']);
328
+		$this->assertEquals(25, count($result['data']));
329
+		$this->assertEquals('product', $result['data'][0]['type']);
330
+		$this->assertEquals('QRST', $result['data'][0]['attributes']['product.code']);
331
+		$this->assertEquals('16 discs', $result['data'][0]['attributes']['product.label']);
332
+		$this->assertEquals(0, count($result['included']));
333 333
 
334
-		$this->assertArrayNotHasKey( 'errors', $result );
334
+		$this->assertArrayNotHasKey('errors', $result);
335 335
 	}
336 336
 
337 337
 
@@ -344,258 +344,258 @@  discard block
 block discarded – undo
344 344
 			'sort' => 'product.id',
345 345
 			'include' => 'product'
346 346
 		);
347
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
348
-		$this->view->addHelper( 'param', $helper );
347
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
348
+		$this->view->addHelper('param', $helper);
349 349
 
350
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
351
-		$result = json_decode( (string) $response->getBody(), true );
350
+		$response = $this->object->get($this->view->request(), $this->view->response());
351
+		$result = json_decode((string) $response->getBody(), true);
352 352
 
353 353
 
354
-		$this->assertEquals( 200, $response->getStatusCode() );
355
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
354
+		$this->assertEquals(200, $response->getStatusCode());
355
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
356 356
 
357
-		$this->assertEquals( 28, $result['meta']['total'] );
358
-		$this->assertEquals( 25, count( $result['data'] ) );
359
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
360
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
357
+		$this->assertEquals(28, $result['meta']['total']);
358
+		$this->assertEquals(25, count($result['data']));
359
+		$this->assertEquals('product', $result['data'][0]['type']);
360
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
361 361
 
362
-		$this->assertArrayNotHasKey( 'errors', $result );
362
+		$this->assertArrayNotHasKey('errors', $result);
363 363
 	}
364 364
 
365 365
 
366 366
 	public function testPatch()
367 367
 	{
368
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
368
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
369 369
 
370 370
 		$item = $productManagerStub->createItem();
371
-		$item->setLabel( 'test' );
372
-		$item->setId( '-1' );
371
+		$item->setLabel('test');
372
+		$item->setId('-1');
373 373
 
374
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' );
375
-		$productManagerStub->expects( $this->atLeastOnce() )->method( 'getItem' )
376
-			->will( $this->returnValue( $item ) );
374
+		$productManagerStub->expects($this->once())->method('saveItem');
375
+		$productManagerStub->expects($this->atLeastOnce())->method('getItem')
376
+			->will($this->returnValue($item));
377 377
 
378 378
 
379
-		$params = array( 'id' => '-1' );
380
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
381
-		$this->view->addHelper( 'param', $helper );
379
+		$params = array('id' => '-1');
380
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
381
+		$this->view->addHelper('param', $helper);
382 382
 
383 383
 		$body = '{"data": {"type": "product", "attributes": {"product.label": "test"}}}';
384
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
384
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
385 385
 
386
-		$response = $this->object->patch( $this->view->request(), $this->view->response() );
387
-		$result = json_decode( (string) $response->getBody(), true );
386
+		$response = $this->object->patch($this->view->request(), $this->view->response());
387
+		$result = json_decode((string) $response->getBody(), true);
388 388
 
389 389
 
390
-		$this->assertEquals( 200, $response->getStatusCode() );
391
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
390
+		$this->assertEquals(200, $response->getStatusCode());
391
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
392 392
 
393
-		$this->assertEquals( 1, $result['meta']['total'] );
394
-		$this->assertArrayHasKey( 'data', $result );
395
-		$this->assertEquals( '-1', $result['data']['id'] );
396
-		$this->assertEquals( 'product', $result['data']['type'] );
397
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
393
+		$this->assertEquals(1, $result['meta']['total']);
394
+		$this->assertArrayHasKey('data', $result);
395
+		$this->assertEquals('-1', $result['data']['id']);
396
+		$this->assertEquals('product', $result['data']['type']);
397
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
398 398
 
399
-		$this->assertArrayNotHasKey( 'included', $result );
400
-		$this->assertArrayNotHasKey( 'errors', $result );
399
+		$this->assertArrayNotHasKey('included', $result);
400
+		$this->assertArrayNotHasKey('errors', $result);
401 401
 	}
402 402
 
403 403
 
404 404
 	public function testPatchBulk()
405 405
 	{
406
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
406
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
407 407
 
408 408
 		$item = $productManagerStub->createItem();
409
-		$item->setLabel( 'test' );
410
-		$item->setId( '-1' );
409
+		$item->setLabel('test');
410
+		$item->setId('-1');
411 411
 
412
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' );
413
-		$productManagerStub->expects( $this->atLeastOnce() )->method( 'getItem' )
414
-			->will( $this->returnValue( $item ) );
412
+		$productManagerStub->expects($this->exactly(2))->method('saveItem');
413
+		$productManagerStub->expects($this->atLeastOnce())->method('getItem')
414
+			->will($this->returnValue($item));
415 415
 
416 416
 
417 417
 		$body = '{"data": [{"id": "-1", "type": "product", "attributes": {"product.label": "test"}}, {"id": "-1", "type": "product", "attributes": {"product.label": "test"}}]}';
418
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
418
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
419 419
 
420
-		$response = $this->object->patch( $this->view->request(), $this->view->response() );
421
-		$result = json_decode( (string) $response->getBody(), true );
420
+		$response = $this->object->patch($this->view->request(), $this->view->response());
421
+		$result = json_decode((string) $response->getBody(), true);
422 422
 
423 423
 
424
-		$this->assertEquals( 200, $response->getStatusCode() );
425
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
424
+		$this->assertEquals(200, $response->getStatusCode());
425
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
426 426
 
427
-		$this->assertEquals( 2, $result['meta']['total'] );
428
-		$this->assertArrayHasKey( 'data', $result );
429
-		$this->assertEquals( 2, count( $result['data'] ) );
430
-		$this->assertEquals( '-1', $result['data'][0]['id'] );
431
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
432
-		$this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] );
427
+		$this->assertEquals(2, $result['meta']['total']);
428
+		$this->assertArrayHasKey('data', $result);
429
+		$this->assertEquals(2, count($result['data']));
430
+		$this->assertEquals('-1', $result['data'][0]['id']);
431
+		$this->assertEquals('product', $result['data'][0]['type']);
432
+		$this->assertEquals('test', $result['data'][0]['attributes']['product.label']);
433 433
 
434
-		$this->assertArrayNotHasKey( 'included', $result );
435
-		$this->assertArrayNotHasKey( 'errors', $result );
434
+		$this->assertArrayNotHasKey('included', $result);
435
+		$this->assertArrayNotHasKey('errors', $result);
436 436
 	}
437 437
 
438 438
 
439 439
 	public function testPatchInvalid()
440 440
 	{
441 441
 		$body = '{"data":null}';
442
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
442
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
443 443
 
444
-		$response = $this->object->patch( $this->view->request(), $this->view->response() );
445
-		$result = json_decode( (string) $response->getBody(), true );
444
+		$response = $this->object->patch($this->view->request(), $this->view->response());
445
+		$result = json_decode((string) $response->getBody(), true);
446 446
 
447 447
 
448
-		$this->assertEquals( 400, $response->getStatusCode() );
449
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
448
+		$this->assertEquals(400, $response->getStatusCode());
449
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
450 450
 
451
-		$this->assertEquals( 0, $result['meta']['total'] );
452
-		$this->assertArrayHasKey( 'errors', $result );
453
-		$this->assertArrayNotHasKey( 'included', $result );
454
-		$this->assertArrayNotHasKey( 'data', $result );
451
+		$this->assertEquals(0, $result['meta']['total']);
452
+		$this->assertArrayHasKey('errors', $result);
453
+		$this->assertArrayNotHasKey('included', $result);
454
+		$this->assertArrayNotHasKey('data', $result);
455 455
 	}
456 456
 
457 457
 
458 458
 	public function testPatchInvalidId()
459 459
 	{
460 460
 		$body = '{"data":{"id":-1}}';
461
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
461
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
462 462
 
463
-		$response = $this->object->patch( $this->view->request(), $this->view->response() );
464
-		$result = json_decode( (string) $response->getBody(), true );
463
+		$response = $this->object->patch($this->view->request(), $this->view->response());
464
+		$result = json_decode((string) $response->getBody(), true);
465 465
 
466 466
 
467
-		$this->assertEquals( 400, $response->getStatusCode() );
468
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
467
+		$this->assertEquals(400, $response->getStatusCode());
468
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
469 469
 
470
-		$this->assertEquals( 0, $result['meta']['total'] );
471
-		$this->assertArrayHasKey( 'errors', $result );
470
+		$this->assertEquals(0, $result['meta']['total']);
471
+		$this->assertArrayHasKey('errors', $result);
472 472
 	}
473 473
 
474 474
 
475 475
 	public function testPatchException()
476 476
 	{
477
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
478
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
477
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
478
+			->will($this->throwException(new \RuntimeException('test exception')));
479 479
 
480 480
 		$body = '{"data":[{"id":-1}]}';
481
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
481
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
482 482
 
483
-		$response = $this->object->patch( $this->view->request(), $this->view->response() );
484
-		$result = json_decode( (string) $response->getBody(), true );
483
+		$response = $this->object->patch($this->view->request(), $this->view->response());
484
+		$result = json_decode((string) $response->getBody(), true);
485 485
 
486 486
 
487
-		$this->assertEquals( 500, $response->getStatusCode() );
488
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
489
-		$this->assertArrayHasKey( 'errors', $result );
487
+		$this->assertEquals(500, $response->getStatusCode());
488
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
489
+		$this->assertArrayHasKey('errors', $result);
490 490
 	}
491 491
 
492 492
 
493 493
 	public function testPatchMShopException()
494 494
 	{
495
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
496
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
495
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
496
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
497 497
 
498 498
 		$body = '{"data":[{"id":-1}]}';
499
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
499
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
500 500
 
501
-		$response = $this->object->patch( $this->view->request(), $this->view->response() );
502
-		$result = json_decode( (string) $response->getBody(), true );
501
+		$response = $this->object->patch($this->view->request(), $this->view->response());
502
+		$result = json_decode((string) $response->getBody(), true);
503 503
 
504 504
 
505
-		$this->assertEquals( 404, $response->getStatusCode() );
506
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
507
-		$this->assertArrayHasKey( 'errors', $result );
505
+		$this->assertEquals(404, $response->getStatusCode());
506
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
507
+		$this->assertArrayHasKey('errors', $result);
508 508
 	}
509 509
 
510 510
 
511 511
 	public function testPost()
512 512
 	{
513
-		$productManagerStub = $this->getProductMock( array( 'createItem', 'getItem', 'saveItem' ) );
513
+		$productManagerStub = $this->getProductMock(array('createItem', 'getItem', 'saveItem'));
514 514
 
515 515
 		$item = new \Aimeos\MShop\Product\Item\Standard();
516
-		$item->setId( '-1' );
516
+		$item->setId('-1');
517 517
 
518
-		$productManagerStub->expects( $this->once() )->method( 'createItem' )
519
-			->will( $this->returnValue( $item ) );
520
-		$productManagerStub->expects( $this->any() )->method( 'getItem' )
521
-			->will( $this->returnValue( $item ) );
522
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' );
518
+		$productManagerStub->expects($this->once())->method('createItem')
519
+			->will($this->returnValue($item));
520
+		$productManagerStub->expects($this->any())->method('getItem')
521
+			->will($this->returnValue($item));
522
+		$productManagerStub->expects($this->once())->method('saveItem');
523 523
 
524 524
 
525 525
 		$body = '{"data": {"type": "product", "attributes": {"product.type": "default", "product.label": "test"}}}';
526
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
526
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
527 527
 
528
-		$response = $this->object->post( $this->view->request(), $this->view->response() );
529
-		$result = json_decode( (string) $response->getBody(), true );
528
+		$response = $this->object->post($this->view->request(), $this->view->response());
529
+		$result = json_decode((string) $response->getBody(), true);
530 530
 
531 531
 
532
-		$this->assertEquals( 201, $response->getStatusCode() );
533
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
532
+		$this->assertEquals(201, $response->getStatusCode());
533
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
534 534
 
535
-		$this->assertEquals( 1, $result['meta']['total'] );
536
-		$this->assertArrayHasKey( 'data', $result );
537
-		$this->assertEquals( '-1', $result['data']['id'] );
538
-		$this->assertEquals( 'product', $result['data']['type'] );
539
-		$this->assertGreaterThan( 0, $result['data']['attributes']['product.typeid'] );
540
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
535
+		$this->assertEquals(1, $result['meta']['total']);
536
+		$this->assertArrayHasKey('data', $result);
537
+		$this->assertEquals('-1', $result['data']['id']);
538
+		$this->assertEquals('product', $result['data']['type']);
539
+		$this->assertGreaterThan(0, $result['data']['attributes']['product.typeid']);
540
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
541 541
 
542
-		$this->assertArrayNotHasKey( 'included', $result );
543
-		$this->assertArrayNotHasKey( 'errors', $result );
542
+		$this->assertArrayNotHasKey('included', $result);
543
+		$this->assertArrayNotHasKey('errors', $result);
544 544
 	}
545 545
 
546 546
 
547 547
 	public function testPostBulk()
548 548
 	{
549
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
549
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
550 550
 
551 551
 		$item = $productManagerStub->createItem();
552
-		$item->setLabel( 'test' );
553
-		$item->setId( '-1' );
552
+		$item->setLabel('test');
553
+		$item->setId('-1');
554 554
 
555
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' );
556
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'getItem' )
557
-			->will( $this->returnValue( $item ) );
555
+		$productManagerStub->expects($this->exactly(2))->method('saveItem');
556
+		$productManagerStub->expects($this->exactly(2))->method('getItem')
557
+			->will($this->returnValue($item));
558 558
 
559 559
 
560 560
 		$body = '{"data": [{"type": "product", "attributes": {"product.label": "test"}}, {"type": "product", "attributes": {"product.label": "test"}}]}';
561
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
561
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
562 562
 
563
-		$response = $this->object->post( $this->view->request(), $this->view->response() );
564
-		$result = json_decode( (string) $response->getBody(), true );
563
+		$response = $this->object->post($this->view->request(), $this->view->response());
564
+		$result = json_decode((string) $response->getBody(), true);
565 565
 
566 566
 
567
-		$this->assertEquals( 201, $response->getStatusCode() );
568
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
567
+		$this->assertEquals(201, $response->getStatusCode());
568
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
569 569
 
570
-		$this->assertEquals( 2, $result['meta']['total'] );
571
-		$this->assertArrayHasKey( 'data', $result );
572
-		$this->assertEquals( 2, count( $result['data'] ) );
573
-		$this->assertEquals( '-1', $result['data'][0]['id'] );
574
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
575
-		$this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] );
570
+		$this->assertEquals(2, $result['meta']['total']);
571
+		$this->assertArrayHasKey('data', $result);
572
+		$this->assertEquals(2, count($result['data']));
573
+		$this->assertEquals('-1', $result['data'][0]['id']);
574
+		$this->assertEquals('product', $result['data'][0]['type']);
575
+		$this->assertEquals('test', $result['data'][0]['attributes']['product.label']);
576 576
 
577
-		$this->assertArrayNotHasKey( 'included', $result );
578
-		$this->assertArrayNotHasKey( 'errors', $result );
577
+		$this->assertArrayNotHasKey('included', $result);
578
+		$this->assertArrayNotHasKey('errors', $result);
579 579
 	}
580 580
 
581 581
 
582 582
 	public function testPostRelationships()
583 583
 	{
584
-		$productManagerStub = $this->getProductMock( array( 'getSubManager', 'createItem', 'getItem', 'saveItem' ) );
585
-		$productManagerListsStub = $this->getProductListsMock( array( 'saveItem' ) );
584
+		$productManagerStub = $this->getProductMock(array('getSubManager', 'createItem', 'getItem', 'saveItem'));
585
+		$productManagerListsStub = $this->getProductListsMock(array('saveItem'));
586 586
 
587 587
 		$item = new \Aimeos\MShop\Product\Item\Standard();
588
-		$item->setId( '-1' );
588
+		$item->setId('-1');
589 589
 
590
-		$productManagerStub->expects( $this->once() )->method( 'createItem' )
591
-			->will( $this->returnValue( $item ) );
592
-		$productManagerStub->expects( $this->any() )->method( 'getItem' )
593
-			->will( $this->returnValue( $item ) );
594
-		$productManagerStub->expects( $this->once() )->method( 'getSubManager' )
595
-			->will( $this->returnValue( $productManagerListsStub ) );
596
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' );
590
+		$productManagerStub->expects($this->once())->method('createItem')
591
+			->will($this->returnValue($item));
592
+		$productManagerStub->expects($this->any())->method('getItem')
593
+			->will($this->returnValue($item));
594
+		$productManagerStub->expects($this->once())->method('getSubManager')
595
+			->will($this->returnValue($productManagerListsStub));
596
+		$productManagerStub->expects($this->once())->method('saveItem');
597 597
 
598
-		$productManagerListsStub->expects( $this->once() )->method( 'saveItem' );
598
+		$productManagerListsStub->expects($this->once())->method('saveItem');
599 599
 
600 600
 		$body = '{"data": {"type": "product",
601 601
 			"attributes": {"product.label": "test"},
@@ -603,193 +603,193 @@  discard block
 block discarded – undo
603 603
 				{"type": "text", "id": "-2", "attributes": {"product.lists.type": "default"}}
604 604
 			]}}
605 605
 		}}';
606
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
606
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
607 607
 
608
-		$response = $this->object->post( $this->view->request(), $this->view->response() );
609
-		$result = json_decode( (string) $response->getBody(), true );
608
+		$response = $this->object->post($this->view->request(), $this->view->response());
609
+		$result = json_decode((string) $response->getBody(), true);
610 610
 
611 611
 
612
-		$this->assertEquals( 201, $response->getStatusCode() );
613
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
612
+		$this->assertEquals(201, $response->getStatusCode());
613
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
614 614
 
615
-		$this->assertEquals( 1, $result['meta']['total'] );
616
-		$this->assertArrayHasKey( 'data', $result );
617
-		$this->assertEquals( '-1', $result['data']['id'] );
618
-		$this->assertEquals( 'product', $result['data']['type'] );
619
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
615
+		$this->assertEquals(1, $result['meta']['total']);
616
+		$this->assertArrayHasKey('data', $result);
617
+		$this->assertEquals('-1', $result['data']['id']);
618
+		$this->assertEquals('product', $result['data']['type']);
619
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
620 620
 
621
-		$this->assertArrayNotHasKey( 'included', $result );
622
-		$this->assertArrayNotHasKey( 'errors', $result );
621
+		$this->assertArrayNotHasKey('included', $result);
622
+		$this->assertArrayNotHasKey('errors', $result);
623 623
 	}
624 624
 
625 625
 
626 626
 	public function testPostInvalid()
627 627
 	{
628 628
 		$body = '{"data":null}';
629
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
629
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
630 630
 
631
-		$response = $this->object->post( $this->view->request(), $this->view->response() );
632
-		$result = json_decode( (string) $response->getBody(), true );
631
+		$response = $this->object->post($this->view->request(), $this->view->response());
632
+		$result = json_decode((string) $response->getBody(), true);
633 633
 
634 634
 
635
-		$this->assertEquals( 400, $response->getStatusCode() );
636
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
635
+		$this->assertEquals(400, $response->getStatusCode());
636
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
637 637
 
638
-		$this->assertEquals( 0, $result['meta']['total'] );
639
-		$this->assertArrayHasKey( 'errors', $result );
640
-		$this->assertArrayNotHasKey( 'included', $result );
641
-		$this->assertArrayNotHasKey( 'data', $result );
638
+		$this->assertEquals(0, $result['meta']['total']);
639
+		$this->assertArrayHasKey('errors', $result);
640
+		$this->assertArrayNotHasKey('included', $result);
641
+		$this->assertArrayNotHasKey('data', $result);
642 642
 	}
643 643
 
644 644
 
645 645
 	public function testPostInvalidId()
646 646
 	{
647 647
 		$body = '{"data":{"id":-1}}';
648
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
648
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
649 649
 
650
-		$response = $this->object->post( $this->view->request(), $this->view->response() );
651
-		$result = json_decode( (string) $response->getBody(), true );
650
+		$response = $this->object->post($this->view->request(), $this->view->response());
651
+		$result = json_decode((string) $response->getBody(), true);
652 652
 
653 653
 
654
-		$this->assertEquals( 403, $response->getStatusCode() );
655
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
654
+		$this->assertEquals(403, $response->getStatusCode());
655
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
656 656
 
657
-		$this->assertEquals( 0, $result['meta']['total'] );
658
-		$this->assertArrayHasKey( 'errors', $result );
657
+		$this->assertEquals(0, $result['meta']['total']);
658
+		$this->assertArrayHasKey('errors', $result);
659 659
 	}
660 660
 
661 661
 
662 662
 	public function testPostException()
663 663
 	{
664
-		$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' )
665
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
664
+		$this->getProductMock(array('saveItem'))->expects($this->once())->method('saveItem')
665
+			->will($this->throwException(new \RuntimeException('test exception')));
666 666
 
667 667
 		$body = '{"data":{}}';
668
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
668
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
669 669
 
670
-		$response = $this->object->post( $this->view->request(), $this->view->response() );
671
-		$result = json_decode( (string) $response->getBody(), true );
670
+		$response = $this->object->post($this->view->request(), $this->view->response());
671
+		$result = json_decode((string) $response->getBody(), true);
672 672
 
673 673
 
674
-		$this->assertEquals( 500, $response->getStatusCode() );
675
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
676
-		$this->assertArrayHasKey( 'errors', $result );
674
+		$this->assertEquals(500, $response->getStatusCode());
675
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
676
+		$this->assertArrayHasKey('errors', $result);
677 677
 	}
678 678
 
679 679
 
680 680
 	public function testPostMShopException()
681 681
 	{
682
-		$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' )
683
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
682
+		$this->getProductMock(array('saveItem'))->expects($this->once())->method('saveItem')
683
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
684 684
 
685 685
 		$body = '{"data":{}}';
686
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
686
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
687 687
 
688
-		$response = $this->object->post( $this->view->request(), $this->view->response() );
689
-		$result = json_decode( (string) $response->getBody(), true );
688
+		$response = $this->object->post($this->view->request(), $this->view->response());
689
+		$result = json_decode((string) $response->getBody(), true);
690 690
 
691 691
 
692
-		$this->assertEquals( 404, $response->getStatusCode() );
693
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
694
-		$this->assertArrayHasKey( 'errors', $result );
692
+		$this->assertEquals(404, $response->getStatusCode());
693
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
694
+		$this->assertArrayHasKey('errors', $result);
695 695
 	}
696 696
 
697 697
 
698 698
 	public function testPut()
699 699
 	{
700
-		$response = $this->object->put( $this->view->request(), $this->view->response() );
701
-		$result = json_decode( (string) $response->getBody(), true );
700
+		$response = $this->object->put($this->view->request(), $this->view->response());
701
+		$result = json_decode((string) $response->getBody(), true);
702 702
 
703
-		$this->assertEquals( 501, $response->getStatusCode() );
704
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
705
-		$this->assertArrayHasKey( 'errors', $result );
703
+		$this->assertEquals(501, $response->getStatusCode());
704
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
705
+		$this->assertArrayHasKey('errors', $result);
706 706
 	}
707 707
 
708 708
 
709 709
 	public function testOptions()
710 710
 	{
711
-		$response = $this->object->options( $this->view->request(), $this->view->response() );
712
-		$result = json_decode( (string) $response->getBody(), true );
711
+		$response = $this->object->options($this->view->request(), $this->view->response());
712
+		$result = json_decode((string) $response->getBody(), true);
713 713
 
714 714
 
715
-		$this->assertEquals( 200, $response->getStatusCode() );
716
-		$this->assertEquals( 1, count( $response->getHeader( 'Allow' ) ) );
717
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
715
+		$this->assertEquals(200, $response->getStatusCode());
716
+		$this->assertEquals(1, count($response->getHeader('Allow')));
717
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
718 718
 
719
-		$this->assertEquals( 57, count( $result['meta']['resources'] ) );
720
-		$this->assertGreaterThan( 0, count( $result['meta']['attributes'] ) );
719
+		$this->assertEquals(57, count($result['meta']['resources']));
720
+		$this->assertGreaterThan(0, count($result['meta']['attributes']));
721 721
 
722
-		$this->assertArrayNotHasKey( 'errors', $result );
722
+		$this->assertArrayNotHasKey('errors', $result);
723 723
 	}
724 724
 
725 725
 
726 726
 	public function testOptionsException()
727 727
 	{
728
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
729
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
728
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
729
+			->will($this->throwException(new \RuntimeException('test exception')));
730 730
 
731
-		$response = $this->object->options( $this->view->request(), $this->view->response() );
732
-		$result = json_decode( (string) $response->getBody(), true );
731
+		$response = $this->object->options($this->view->request(), $this->view->response());
732
+		$result = json_decode((string) $response->getBody(), true);
733 733
 
734
-		$this->assertEquals( 500, $response->getStatusCode() );
735
-		$this->assertArrayHasKey( 'errors', $result );
734
+		$this->assertEquals(500, $response->getStatusCode());
735
+		$this->assertArrayHasKey('errors', $result);
736 736
 	}
737 737
 
738 738
 
739 739
 	public function testOptionsMShopException()
740 740
 	{
741
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
742
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
741
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
742
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
743 743
 
744
-		$response = $this->object->options( $this->view->request(), $this->view->response() );
745
-		$result = json_decode( (string) $response->getBody(), true );
744
+		$response = $this->object->options($this->view->request(), $this->view->response());
745
+		$result = json_decode((string) $response->getBody(), true);
746 746
 
747
-		$this->assertEquals( 404, $response->getStatusCode() );
748
-		$this->assertArrayHasKey( 'errors', $result );
747
+		$this->assertEquals(404, $response->getStatusCode());
748
+		$this->assertArrayHasKey('errors', $result);
749 749
 	}
750 750
 
751 751
 
752
-	protected function getProductMock( array $methods )
752
+	protected function getProductMock(array $methods)
753 753
 	{
754 754
 		$name = 'ClientJsonAdmStandard';
755
-		$this->context->getConfig()->set( 'mshop/product/manager/name', $name );
755
+		$this->context->getConfig()->set('mshop/product/manager/name', $name);
756 756
 
757
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' )
758
-			->setConstructorArgs( array( $this->context ) )
759
-			->setMethods( $methods )
757
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')
758
+			->setConstructorArgs(array($this->context))
759
+			->setMethods($methods)
760 760
 			->getMock();
761 761
 
762
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $stub );
762
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $stub);
763 763
 
764 764
 		return $stub;
765 765
 	}
766 766
 
767 767
 
768
-	protected function getProductListsMock( array $methods )
768
+	protected function getProductListsMock(array $methods)
769 769
 	{
770 770
 		$name = 'ClientJsonAdmStandard';
771
-		$this->context->getConfig()->set( 'mshop/product/manager/lists/name', $name );
771
+		$this->context->getConfig()->set('mshop/product/manager/lists/name', $name);
772 772
 
773
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard' )
774
-			->setConstructorArgs( array( $this->context ) )
775
-			->setMethods( $methods )
773
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard')
774
+			->setConstructorArgs(array($this->context))
775
+			->setMethods($methods)
776 776
 			->getMock();
777 777
 
778
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\' . $name, $stub );
778
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\Lists\\' . $name, $stub);
779 779
 
780 780
 		return $stub;
781 781
 	}
782 782
 
783 783
 
784
-	protected function getProductItem( $code = 'CNC' )
784
+	protected function getProductItem($code = 'CNC')
785 785
 	{
786
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
786
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
787 787
 		$search = $manager->createSearch();
788
-		$search->setConditions( $search->compare( '==', 'product.code', $code ) );
789
-		$items = $manager->searchItems( $search );
788
+		$search->setConditions($search->compare('==', 'product.code', $code));
789
+		$items = $manager->searchItems($search);
790 790
 
791
-		if( ( $item = reset( $items ) ) === false ) {
792
-			throw new \RuntimeException( sprintf( 'No product item with code "%1$s" found', $code ) );
791
+		if (($item = reset($items)) === false) {
792
+			throw new \RuntimeException(sprintf('No product item with code "%1$s" found', $code));
793 793
 		}
794 794
 
795 795
 		return $item;
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Catalog/StandardTest.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$this->context = \TestHelperJadm::getContext();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Catalog\Standard( $this->context, $this->view, $templatePaths, 'catalog' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Catalog\Standard($this->context, $this->view, $templatePaths, 'catalog');
26 26
 	}
27 27
 
28 28
 
@@ -30,145 +30,145 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'catalog.code' => 'cafe' )
33
+				'==' => array('catalog.code' => 'cafe')
34 34
 			),
35 35
 			'include' => 'text'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'catalog', $result['data'][0]['type'] );
50
-		$this->assertEquals( 6, count( $result['data'][0]['relationships']['text'] ) );
51
-		$this->assertEquals( 6, count( $result['included'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('catalog', $result['data'][0]['type']);
50
+		$this->assertEquals(6, count($result['data'][0]['relationships']['text']));
51
+		$this->assertEquals(6, count($result['included']));
52 52
 
53
-		$this->assertArrayNotHasKey( 'errors', $result );
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 
56 56
 
57 57
 	public function testGetTree()
58 58
 	{
59 59
 		$params = array(
60
-			'id' => $this->getCatalogItem( 'group' )->getId(),
60
+			'id' => $this->getCatalogItem('group')->getId(),
61 61
 			'filter' => array(
62
-				'==' => array( 'catalog.status' => 1 )
62
+				'==' => array('catalog.status' => 1)
63 63
 			),
64 64
 			'include' => 'catalog,text'
65 65
 		);
66
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
67
-		$this->view->addHelper( 'param', $helper );
66
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
67
+		$this->view->addHelper('param', $helper);
68 68
 
69
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
70
-		$result = json_decode( (string) $response->getBody(), true );
69
+		$response = $this->object->get($this->view->request(), $this->view->response());
70
+		$result = json_decode((string) $response->getBody(), true);
71 71
 
72 72
 
73
-		$this->assertEquals( 200, $response->getStatusCode() );
74
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
73
+		$this->assertEquals(200, $response->getStatusCode());
74
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
75 75
 
76
-		$this->assertEquals( 1, $result['meta']['total'] );
77
-		$this->assertEquals( 'catalog', $result['data']['type'] );
78
-		$this->assertEquals( 2, count( $result['data']['relationships']['catalog'] ) );
79
-		$this->assertEquals( 2, count( $result['included'] ) );
76
+		$this->assertEquals(1, $result['meta']['total']);
77
+		$this->assertEquals('catalog', $result['data']['type']);
78
+		$this->assertEquals(2, count($result['data']['relationships']['catalog']));
79
+		$this->assertEquals(2, count($result['included']));
80 80
 
81
-		$this->assertArrayNotHasKey( 'errors', $result );
81
+		$this->assertArrayNotHasKey('errors', $result);
82 82
 	}
83 83
 
84 84
 
85 85
 	public function testPatch()
86 86
 	{
87
-		$stub = $this->getCatalogMock( array( 'getItem', 'moveItem', 'saveItem' ) );
87
+		$stub = $this->getCatalogMock(array('getItem', 'moveItem', 'saveItem'));
88 88
 
89
-		$stub->expects( $this->once() )->method( 'moveItem' );
90
-		$stub->expects( $this->once() )->method( 'saveItem' );
91
-		$stub->expects( $this->exactly( 2 ) )->method( 'getItem' ) // 2x due to decorator
92
-			->will( $this->returnValue( $stub->createItem() ) );
89
+		$stub->expects($this->once())->method('moveItem');
90
+		$stub->expects($this->once())->method('saveItem');
91
+		$stub->expects($this->exactly(2))->method('getItem') // 2x due to decorator
92
+			->will($this->returnValue($stub->createItem()));
93 93
 
94 94
 
95
-		$params = array( 'id' => '-1' );
96
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
97
-		$this->view->addHelper( 'param', $helper );
95
+		$params = array('id' => '-1');
96
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
97
+		$this->view->addHelper('param', $helper);
98 98
 
99 99
 		$body = '{"data": {"parentid": "1", "targetid": 2, "type": "catalog", "attributes": {"catalog.label": "test"}}}';
100
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
100
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
101 101
 
102
-		$response = $this->object->patch( $request, $this->view->response() );
103
-		$result = json_decode( (string) $response->getBody(), true );
102
+		$response = $this->object->patch($request, $this->view->response());
103
+		$result = json_decode((string) $response->getBody(), true);
104 104
 
105 105
 
106
-		$this->assertEquals( 200, $response->getStatusCode() );
107
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
106
+		$this->assertEquals(200, $response->getStatusCode());
107
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
108 108
 
109
-		$this->assertEquals( 1, $result['meta']['total'] );
110
-		$this->assertArrayHasKey( 'data', $result );
111
-		$this->assertEquals( 'catalog', $result['data']['type'] );
109
+		$this->assertEquals(1, $result['meta']['total']);
110
+		$this->assertArrayHasKey('data', $result);
111
+		$this->assertEquals('catalog', $result['data']['type']);
112 112
 
113
-		$this->assertArrayNotHasKey( 'included', $result );
114
-		$this->assertArrayNotHasKey( 'errors', $result );
113
+		$this->assertArrayNotHasKey('included', $result);
114
+		$this->assertArrayNotHasKey('errors', $result);
115 115
 	}
116 116
 
117 117
 
118 118
 	public function testPost()
119 119
 	{
120
-		$stub = $this->getCatalogMock( array( 'getItem', 'insertItem' ) );
120
+		$stub = $this->getCatalogMock(array('getItem', 'insertItem'));
121 121
 
122
-		$stub->expects( $this->any() )->method( 'getItem' )
123
-			->will( $this->returnValue( $stub->createItem() ) );
124
-		$stub->expects( $this->once() )->method( 'insertItem' );
122
+		$stub->expects($this->any())->method('getItem')
123
+			->will($this->returnValue($stub->createItem()));
124
+		$stub->expects($this->once())->method('insertItem');
125 125
 
126 126
 
127 127
 		$body = '{"data": {"type": "catalog", "attributes": {"catalog.code": "test", "catalog.label": "Test catalog"}}}';
128
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
128
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
129 129
 
130
-		$response = $this->object->post( $request, $this->view->response() );
131
-		$result = json_decode( (string) $response->getBody(), true );
130
+		$response = $this->object->post($request, $this->view->response());
131
+		$result = json_decode((string) $response->getBody(), true);
132 132
 
133 133
 
134
-		$this->assertEquals( 201, $response->getStatusCode() );
135
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
134
+		$this->assertEquals(201, $response->getStatusCode());
135
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
136 136
 
137
-		$this->assertEquals( 1, $result['meta']['total'] );
138
-		$this->assertArrayHasKey( 'data', $result );
139
-		$this->assertEquals( 'catalog', $result['data']['type'] );
137
+		$this->assertEquals(1, $result['meta']['total']);
138
+		$this->assertArrayHasKey('data', $result);
139
+		$this->assertEquals('catalog', $result['data']['type']);
140 140
 
141
-		$this->assertArrayNotHasKey( 'included', $result );
142
-		$this->assertArrayNotHasKey( 'errors', $result );
141
+		$this->assertArrayNotHasKey('included', $result);
142
+		$this->assertArrayNotHasKey('errors', $result);
143 143
 	}
144 144
 
145 145
 
146
-	protected function getCatalogItem( $code )
146
+	protected function getCatalogItem($code)
147 147
 	{
148
-		$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $this->context );
148
+		$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager($this->context);
149 149
 		$search = $manager->createSearch();
150
-		$search->setConditions( $search->compare( '==', 'catalog.code', $code ) );
151
-		$items = $manager->searchItems( $search );
150
+		$search->setConditions($search->compare('==', 'catalog.code', $code));
151
+		$items = $manager->searchItems($search);
152 152
 
153
-		if( ( $item = reset( $items ) ) === false ) {
154
-			throw new \RuntimeException( sprintf( 'No catalog item with code "%1$s" found', $code ) );
153
+		if (($item = reset($items)) === false) {
154
+			throw new \RuntimeException(sprintf('No catalog item with code "%1$s" found', $code));
155 155
 		}
156 156
 
157 157
 		return $item;
158 158
 	}
159 159
 
160 160
 
161
-	protected function getCatalogMock( array $methods )
161
+	protected function getCatalogMock(array $methods)
162 162
 	{
163 163
 		$name = 'ClientJsonAdmStandard';
164
-		$this->context->getConfig()->set( 'mshop/catalog/manager/name', $name );
164
+		$this->context->getConfig()->set('mshop/catalog/manager/name', $name);
165 165
 
166
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Catalog\\Manager\\Standard' )
167
-			->setConstructorArgs( array( $this->context ) )
168
-			->setMethods( $methods )
166
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Catalog\\Manager\\Standard')
167
+			->setConstructorArgs(array($this->context))
168
+			->setMethods($methods)
169 169
 			->getMock();
170 170
 
171
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Catalog\\Manager\\' . $name, $stub );
171
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Catalog\\Manager\\' . $name, $stub);
172 172
 
173 173
 		return $stub;
174 174
 	}
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Supplier/StandardTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Supplier\Standard( $this->context, $this->view, $templatePaths, 'supplier' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Supplier\Standard($this->context, $this->view, $templatePaths, 'supplier');
26 26
 	}
27 27
 
28 28
 
@@ -30,28 +30,28 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'supplier.code' => 'unitCode001' )
33
+				'==' => array('supplier.code' => 'unitCode001')
34 34
 			),
35 35
 			'include' => 'text,supplier/address'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'supplier', $result['data'][0]['type'] );
50
-		$this->assertEquals( 3, count( $result['data'][0]['relationships']['text'] ) );
51
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['supplier/address'] ) );
52
-		$this->assertEquals( 4, count( $result['included'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('supplier', $result['data'][0]['type']);
50
+		$this->assertEquals(3, count($result['data'][0]['relationships']['text']));
51
+		$this->assertEquals(1, count($result['data'][0]['relationships']['supplier/address']));
52
+		$this->assertEquals(4, count($result['included']));
53 53
 
54
-		$this->assertArrayNotHasKey( 'errors', $result );
54
+		$this->assertArrayNotHasKey('errors', $result);
55 55
 	}
56 56
 
57 57
 
@@ -64,23 +64,23 @@  discard block
 block discarded – undo
64 64
 			'sort' => 'supplier.id',
65 65
 			'include' => 'supplier/address'
66 66
 		);
67
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
68
-		$this->view->addHelper( 'param', $helper );
67
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
68
+		$this->view->addHelper('param', $helper);
69 69
 
70
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
71
-		$result = json_decode( (string) $response->getBody(), true );
70
+		$response = $this->object->get($this->view->request(), $this->view->response());
71
+		$result = json_decode((string) $response->getBody(), true);
72 72
 
73 73
 
74
-		$this->assertEquals( 200, $response->getStatusCode() );
75
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
74
+		$this->assertEquals(200, $response->getStatusCode());
75
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
76 76
 
77
-		$this->assertEquals( 3, $result['meta']['total'] );
78
-		$this->assertEquals( 3, count( $result['data'] ) );
79
-		$this->assertEquals( 'supplier', $result['data'][0]['type'] );
80
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
81
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['supplier/address'] ) );
82
-		$this->assertEquals( 3, count( $result['included'] ) );
77
+		$this->assertEquals(3, $result['meta']['total']);
78
+		$this->assertEquals(3, count($result['data']));
79
+		$this->assertEquals('supplier', $result['data'][0]['type']);
80
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
81
+		$this->assertEquals(1, count($result['data'][0]['relationships']['supplier/address']));
82
+		$this->assertEquals(3, count($result['included']));
83 83
 
84
-		$this->assertArrayNotHasKey( 'errors', $result );
84
+		$this->assertArrayNotHasKey('errors', $result);
85 85
 	}
86 86
 }
87 87
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Order/StandardTest.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Order\Standard( $this->context, $this->view, $templatePaths, 'order' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Order\Standard($this->context, $this->view, $templatePaths, 'order');
26 26
 	}
27 27
 
28 28
 
@@ -30,26 +30,26 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'order.editor' => 'core:unittest' )
33
+				'==' => array('order.editor' => 'core:unittest')
34 34
 			),
35 35
 			'aggregate' => 'order.cdate',
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'aggregate', $result['data'][0]['type'] );
50
-		$this->assertGreaterThan( 0, count( $result['data'][0]['attributes'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('aggregate', $result['data'][0]['type']);
50
+		$this->assertGreaterThan(0, count($result['data'][0]['attributes']));
51 51
 
52
-		$this->assertArrayNotHasKey( 'errors', $result );
52
+		$this->assertArrayNotHasKey('errors', $result);
53 53
 	}
54 54
 
55 55
 
@@ -57,28 +57,28 @@  discard block
 block discarded – undo
57 57
 	{
58 58
 		$params = array(
59 59
 			'filter' => array(
60
-				'==' => array( 'order.datepayment' => '2008-02-15 12:34:56' )
60
+				'==' => array('order.datepayment' => '2008-02-15 12:34:56')
61 61
 			),
62 62
 			'include' => 'order/base,order/status'
63 63
 		);
64
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
65
-		$this->view->addHelper( 'param', $helper );
64
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
65
+		$this->view->addHelper('param', $helper);
66 66
 
67
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
68
-		$result = json_decode( (string) $response->getBody(), true );
67
+		$response = $this->object->get($this->view->request(), $this->view->response());
68
+		$result = json_decode((string) $response->getBody(), true);
69 69
 
70 70
 
71
-		$this->assertEquals( 200, $response->getStatusCode() );
72
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
71
+		$this->assertEquals(200, $response->getStatusCode());
72
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
73 73
 
74
-		$this->assertEquals( 1, $result['meta']['total'] );
75
-		$this->assertEquals( 1, count( $result['data'] ) );
76
-		$this->assertEquals( 'order', $result['data'][0]['type'] );
77
-		$this->assertEquals( 3, count( $result['data'][0]['relationships']['order/status'] ) );
78
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['order/base'] ) );
79
-		$this->assertEquals( 4, count( $result['included'] ) );
74
+		$this->assertEquals(1, $result['meta']['total']);
75
+		$this->assertEquals(1, count($result['data']));
76
+		$this->assertEquals('order', $result['data'][0]['type']);
77
+		$this->assertEquals(3, count($result['data'][0]['relationships']['order/status']));
78
+		$this->assertEquals(1, count($result['data'][0]['relationships']['order/base']));
79
+		$this->assertEquals(4, count($result['included']));
80 80
 
81
-		$this->assertArrayNotHasKey( 'errors', $result );
81
+		$this->assertArrayNotHasKey('errors', $result);
82 82
 	}
83 83
 
84 84
 
@@ -91,23 +91,23 @@  discard block
 block discarded – undo
91 91
 			'sort' => 'order.id',
92 92
 			'include' => 'order/status'
93 93
 		);
94
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
95
-		$this->view->addHelper( 'param', $helper );
94
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
95
+		$this->view->addHelper('param', $helper);
96 96
 
97
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
98
-		$result = json_decode( (string) $response->getBody(), true );
97
+		$response = $this->object->get($this->view->request(), $this->view->response());
98
+		$result = json_decode((string) $response->getBody(), true);
99 99
 
100 100
 
101
-		$this->assertEquals( 200, $response->getStatusCode() );
102
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
101
+		$this->assertEquals(200, $response->getStatusCode());
102
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
103 103
 
104
-		$this->assertGreaterThanOrEqual( 4, $result['meta']['total'] );
105
-		$this->assertGreaterThanOrEqual( 4, count( $result['data'] ) );
106
-		$this->assertEquals( 'order', $result['data'][0]['type'] );
107
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
108
-		$this->assertGreaterThanOrEqual( 3, count( $result['data'][0]['relationships']['order/status'] ) );
109
-		$this->assertGreaterThanOrEqual( 11, count( $result['included'] ) );
104
+		$this->assertGreaterThanOrEqual(4, $result['meta']['total']);
105
+		$this->assertGreaterThanOrEqual(4, count($result['data']));
106
+		$this->assertEquals('order', $result['data'][0]['type']);
107
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
108
+		$this->assertGreaterThanOrEqual(3, count($result['data'][0]['relationships']['order/status']));
109
+		$this->assertGreaterThanOrEqual(11, count($result['included']));
110 110
 
111
-		$this->assertArrayNotHasKey( 'errors', $result );
111
+		$this->assertArrayNotHasKey('errors', $result);
112 112
 	}
113 113
 }
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Order/Base/StandardTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Order\Base\Standard( $this->context, $this->view, $templatePaths, 'order/base' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Order\Base\Standard($this->context, $this->view, $templatePaths, 'order/base');
26 26
 	}
27 27
 
28 28
 
@@ -30,28 +30,28 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'order.base.price' => '4800.00' )
33
+				'==' => array('order.base.price' => '4800.00')
34 34
 			),
35 35
 			'include' => 'order/base/address,order/base/product'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'order/base', $result['data'][0]['type'] );
50
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['order/base/address'] ) );
51
-		$this->assertEquals( 6, count( $result['data'][0]['relationships']['order/base/product'] ) );
52
-		$this->assertEquals( 7, count( $result['included'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('order/base', $result['data'][0]['type']);
50
+		$this->assertEquals(1, count($result['data'][0]['relationships']['order/base/address']));
51
+		$this->assertEquals(6, count($result['data'][0]['relationships']['order/base/product']));
52
+		$this->assertEquals(7, count($result['included']));
53 53
 
54
-		$this->assertArrayNotHasKey( 'errors', $result );
54
+		$this->assertArrayNotHasKey('errors', $result);
55 55
 	}
56 56
 
57 57
 
@@ -64,23 +64,23 @@  discard block
 block discarded – undo
64 64
 			'sort' => 'order.base.id',
65 65
 			'include' => 'order/base/product'
66 66
 		);
67
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
68
-		$this->view->addHelper( 'param', $helper );
67
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
68
+		$this->view->addHelper('param', $helper);
69 69
 
70
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
71
-		$result = json_decode( (string) $response->getBody(), true );
70
+		$response = $this->object->get($this->view->request(), $this->view->response());
71
+		$result = json_decode((string) $response->getBody(), true);
72 72
 
73 73
 
74
-		$this->assertEquals( 200, $response->getStatusCode() );
75
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
74
+		$this->assertEquals(200, $response->getStatusCode());
75
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
76 76
 
77
-		$this->assertGreaterThanOrEqual( 4, $result['meta']['total'] );
78
-		$this->assertGreaterThanOrEqual( 4, count( $result['data'] ) );
79
-		$this->assertEquals( 'order/base', $result['data'][0]['type'] );
80
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
81
-		$this->assertGreaterThanOrEqual( 4, count( $result['data'][0]['relationships']['order/base/product'] ) );
82
-		$this->assertGreaterThanOrEqual( 14, count( $result['included'] ) );
77
+		$this->assertGreaterThanOrEqual(4, $result['meta']['total']);
78
+		$this->assertGreaterThanOrEqual(4, count($result['data']));
79
+		$this->assertEquals('order/base', $result['data'][0]['type']);
80
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
81
+		$this->assertGreaterThanOrEqual(4, count($result['data'][0]['relationships']['order/base/product']));
82
+		$this->assertGreaterThanOrEqual(14, count($result['included']));
83 83
 
84
-		$this->assertArrayNotHasKey( 'errors', $result );
84
+		$this->assertArrayNotHasKey('errors', $result);
85 85
 	}
86 86
 }
87 87
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Service/StandardTest.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Service\Standard( $this->context, $this->view, $templatePaths, 'service' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Service\Standard($this->context, $this->view, $templatePaths, 'service');
26 26
 	}
27 27
 
28 28
 
@@ -30,26 +30,26 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'service.code' => 'unitpaymentcode' )
33
+				'==' => array('service.code' => 'unitpaymentcode')
34 34
 			),
35 35
 			'include' => 'text'
36 36
 		);
37
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
38
-		$this->view->addHelper( 'param', $helper );
37
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
38
+		$this->view->addHelper('param', $helper);
39 39
 
40
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
41
-		$result = json_decode( (string) $response->getBody(), true );
40
+		$response = $this->object->get($this->view->request(), $this->view->response());
41
+		$result = json_decode((string) $response->getBody(), true);
42 42
 
43 43
 
44
-		$this->assertEquals( 200, $response->getStatusCode() );
45
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
44
+		$this->assertEquals(200, $response->getStatusCode());
45
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
46 46
 
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'service', $result['data'][0]['type'] );
50
-		$this->assertEquals( 3, count( $result['data'][0]['relationships']['text'] ) );
51
-		$this->assertEquals( 3, count( $result['included'] ) );
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('service', $result['data'][0]['type']);
50
+		$this->assertEquals(3, count($result['data'][0]['relationships']['text']));
51
+		$this->assertEquals(3, count($result['included']));
52 52
 
53
-		$this->assertArrayNotHasKey( 'errors', $result );
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 }
56 56
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Locale/Site/StandardTest.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$this->context = \TestHelperJadm::getContext();
23 23
 		$this->view = $this->context->getView();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JsonAdm\Locale\Site\Standard( $this->context, $this->view, $templatePaths, 'locale/site' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Locale\Site\Standard($this->context, $this->view, $templatePaths, 'locale/site');
26 26
 	}
27 27
 
28 28
 
@@ -30,152 +30,152 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'locale.site.code' => 'unittest' )
33
+				'==' => array('locale.site.code' => 'unittest')
34 34
 			),
35 35
 		);
36
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
37
-		$this->view->addHelper( 'param', $helper );
36
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
37
+		$this->view->addHelper('param', $helper);
38 38
 
39
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
40
-		$result = json_decode( (string) $response->getBody(), true );
39
+		$response = $this->object->get($this->view->request(), $this->view->response());
40
+		$result = json_decode((string) $response->getBody(), true);
41 41
 
42 42
 
43
-		$this->assertEquals( 200, $response->getStatusCode() );
44
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
43
+		$this->assertEquals(200, $response->getStatusCode());
44
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
45 45
 
46
-		$this->assertEquals( 1, $result['meta']['total'] );
47
-		$this->assertEquals( 1, count( $result['data'] ) );
48
-		$this->assertEquals( 'locale/site', $result['data'][0]['type'] );
49
-		$this->assertEquals( 0, count( $result['included'] ) );
46
+		$this->assertEquals(1, $result['meta']['total']);
47
+		$this->assertEquals(1, count($result['data']));
48
+		$this->assertEquals('locale/site', $result['data'][0]['type']);
49
+		$this->assertEquals(0, count($result['included']));
50 50
 
51
-		$this->assertArrayNotHasKey( 'errors', $result );
51
+		$this->assertArrayNotHasKey('errors', $result);
52 52
 	}
53 53
 
54 54
 
55 55
 	public function testGetTree()
56 56
 	{
57 57
 		$params = array(
58
-			'id' => $this->getSiteItem( 'unittest' )->getId(),
58
+			'id' => $this->getSiteItem('unittest')->getId(),
59 59
 			'filter' => array(
60
-				'==' => array( 'locale.status' => 0 )
60
+				'==' => array('locale.status' => 0)
61 61
 			),
62 62
 			'include' => 'locale/site'
63 63
 		);
64
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
65
-		$this->view->addHelper( 'param', $helper );
64
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
65
+		$this->view->addHelper('param', $helper);
66 66
 
67
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
68
-		$result = json_decode( (string) $response->getBody(), true );
67
+		$response = $this->object->get($this->view->request(), $this->view->response());
68
+		$result = json_decode((string) $response->getBody(), true);
69 69
 
70 70
 
71
-		$this->assertEquals( 200, $response->getStatusCode() );
72
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
71
+		$this->assertEquals(200, $response->getStatusCode());
72
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
73 73
 
74
-		$this->assertEquals( 1, $result['meta']['total'] );
75
-		$this->assertEquals( 'locale/site', $result['data']['type'] );
76
-		$this->assertEquals( 0, count( $result['included'] ) );
74
+		$this->assertEquals(1, $result['meta']['total']);
75
+		$this->assertEquals('locale/site', $result['data']['type']);
76
+		$this->assertEquals(0, count($result['included']));
77 77
 
78
-		$this->assertArrayNotHasKey( 'errors', $result );
78
+		$this->assertArrayNotHasKey('errors', $result);
79 79
 	}
80 80
 
81 81
 
82 82
 	public function testPatch()
83 83
 	{
84
-		$stub = $this->getSiteMock( array( 'getItem', 'moveItem', 'saveItem' ) );
84
+		$stub = $this->getSiteMock(array('getItem', 'moveItem', 'saveItem'));
85 85
 		$item = $stub->createItem();
86 86
 
87
-		$stub->expects( $this->once() )->method( 'moveItem' );
88
-		$stub->expects( $this->once() )->method( 'saveItem' );
89
-		$stub->expects( $this->exactly( 2 ) )->method( 'getItem' ) // 2x due to decorator
90
-			->will( $this->returnValue( $item ) );
87
+		$stub->expects($this->once())->method('moveItem');
88
+		$stub->expects($this->once())->method('saveItem');
89
+		$stub->expects($this->exactly(2))->method('getItem') // 2x due to decorator
90
+			->will($this->returnValue($item));
91 91
 
92 92
 
93
-		$params = array( 'id' => '-1' );
94
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
95
-		$this->view->addHelper( 'param', $helper );
93
+		$params = array('id' => '-1');
94
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
95
+		$this->view->addHelper('param', $helper);
96 96
 
97 97
 		$body = '{"data": {"parentid": "1", "targetid": 2, "type": "locale/site", "attributes": {"locale.site.label": "test"}}}';
98
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
98
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
99 99
 
100
-		$response = $this->object->patch( $request, $this->view->response() );
101
-		$result = json_decode( (string) $response->getBody(), true );
100
+		$response = $this->object->patch($request, $this->view->response());
101
+		$result = json_decode((string) $response->getBody(), true);
102 102
 
103 103
 
104
-		$this->assertEquals( 200, $response->getStatusCode() );
105
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
104
+		$this->assertEquals(200, $response->getStatusCode());
105
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
106 106
 
107
-		$this->assertEquals( 1, $result['meta']['total'] );
108
-		$this->assertArrayHasKey( 'data', $result );
109
-		$this->assertEquals( 'locale/site', $result['data']['type'] );
107
+		$this->assertEquals(1, $result['meta']['total']);
108
+		$this->assertArrayHasKey('data', $result);
109
+		$this->assertEquals('locale/site', $result['data']['type']);
110 110
 
111
-		$this->assertArrayNotHasKey( 'included', $result );
112
-		$this->assertArrayNotHasKey( 'errors', $result );
111
+		$this->assertArrayNotHasKey('included', $result);
112
+		$this->assertArrayNotHasKey('errors', $result);
113 113
 	}
114 114
 
115 115
 
116 116
 	public function testPost()
117 117
 	{
118
-		$stub = $this->getSiteMock( array( 'getItem', 'insertItem' ) );
118
+		$stub = $this->getSiteMock(array('getItem', 'insertItem'));
119 119
 		$item = $stub->createItem();
120 120
 
121
-		$stub->expects( $this->any() )->method( 'getItem' )
122
-			->will( $this->returnValue( $item ) );
123
-		$stub->expects( $this->once() )->method( 'insertItem' );
121
+		$stub->expects($this->any())->method('getItem')
122
+			->will($this->returnValue($item));
123
+		$stub->expects($this->once())->method('insertItem');
124 124
 
125 125
 
126 126
 		$body = '{"data": {"type": "locale/site", "attributes": {"locale.site.code": "unittest", "locale.site.label": "Unit test"}}}';
127
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
127
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
128 128
 
129
-		$response = $this->object->post( $request, $this->view->response() );
130
-		$result = json_decode( (string) $response->getBody(), true );
129
+		$response = $this->object->post($request, $this->view->response());
130
+		$result = json_decode((string) $response->getBody(), true);
131 131
 
132 132
 
133
-		$this->assertEquals( 201, $response->getStatusCode() );
134
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
133
+		$this->assertEquals(201, $response->getStatusCode());
134
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
135 135
 
136
-		$this->assertEquals( 1, $result['meta']['total'] );
137
-		$this->assertArrayHasKey( 'data', $result );
138
-		$this->assertEquals( 'locale/site', $result['data']['type'] );
136
+		$this->assertEquals(1, $result['meta']['total']);
137
+		$this->assertArrayHasKey('data', $result);
138
+		$this->assertEquals('locale/site', $result['data']['type']);
139 139
 
140
-		$this->assertArrayNotHasKey( 'included', $result );
141
-		$this->assertArrayNotHasKey( 'errors', $result );
140
+		$this->assertArrayNotHasKey('included', $result);
141
+		$this->assertArrayNotHasKey('errors', $result);
142 142
 	}
143 143
 
144 144
 
145
-	protected function getSiteItem( $code )
145
+	protected function getSiteItem($code)
146 146
 	{
147
-		$manager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $this->context )->getSubManager( 'site' );
147
+		$manager = \Aimeos\MShop\Locale\Manager\Factory::createManager($this->context)->getSubManager('site');
148 148
 		$search = $manager->createSearch();
149
-		$search->setConditions( $search->compare( '==', 'locale.site.code', $code ) );
150
-		$items = $manager->searchItems( $search );
149
+		$search->setConditions($search->compare('==', 'locale.site.code', $code));
150
+		$items = $manager->searchItems($search);
151 151
 
152
-		if( ( $item = reset( $items ) ) === false ) {
153
-			throw new \RuntimeException( sprintf( 'No locale site item with code "%1$s" found', $code ) );
152
+		if (($item = reset($items)) === false) {
153
+			throw new \RuntimeException(sprintf('No locale site item with code "%1$s" found', $code));
154 154
 		}
155 155
 
156 156
 		return $item;
157 157
 	}
158 158
 
159 159
 
160
-	protected function getSiteMock( array $methods )
160
+	protected function getSiteMock(array $methods)
161 161
 	{
162 162
 		$name = 'ClientJsonAdmStandard';
163
-		$this->context->getConfig()->set( 'mshop/locale/manager/name', $name );
163
+		$this->context->getConfig()->set('mshop/locale/manager/name', $name);
164 164
 
165
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Locale\\Manager\\Standard' )
166
-			->setConstructorArgs( array( $this->context ) )
167
-			->setMethods( array( 'getSubManager' ) )
165
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Locale\\Manager\\Standard')
166
+			->setConstructorArgs(array($this->context))
167
+			->setMethods(array('getSubManager'))
168 168
 			->getMock();
169 169
 
170
-		$siteStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Locale\\Manager\\Site\\Standard' )
171
-			->setConstructorArgs( array( $this->context ) )
172
-			->setMethods( $methods )
170
+		$siteStub = $this->getMockBuilder('\\Aimeos\\MShop\\Locale\\Manager\\Site\\Standard')
171
+			->setConstructorArgs(array($this->context))
172
+			->setMethods($methods)
173 173
 			->getMock();
174 174
 
175
-		$stub->expects( $this->once() )->method( 'getSubManager' )
176
-			->will( $this->returnValue( $siteStub ) );
175
+		$stub->expects($this->once())->method('getSubManager')
176
+			->will($this->returnValue($siteStub));
177 177
 
178
-		\Aimeos\MShop\Locale\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Locale\\Manager\\' . $name, $stub );
178
+		\Aimeos\MShop\Locale\Manager\Factory::injectManager('\\Aimeos\\MShop\\Locale\\Manager\\' . $name, $stub);
179 179
 
180 180
 		return $siteStub;
181 181
 	}
Please login to merge, or discard this patch.