Completed
Push — master ( 9d04b2...18840f )
by Aimeos
08:12
created
admin/jsonadm/tests/Admin/JsonAdm/StandardTest.php 1 patch
Spacing   +320 added lines, -320 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,42 +34,42 @@  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 43
 		$header = array();
44 44
 		$status = 500;
45 45
 
46
-		$result = json_decode( $this->object->delete( '', $header, $status ), true );
46
+		$result = json_decode($this->object->delete('', $header, $status), true);
47 47
 
48
-		$this->assertEquals( 200, $status );
49
-		$this->assertEquals( 1, count( $header ) );
50
-		$this->assertEquals( 1, $result['meta']['total'] );
51
-		$this->assertArrayNotHasKey( 'included', $result );
52
-		$this->assertArrayNotHasKey( 'data', $result );
53
-		$this->assertArrayNotHasKey( 'errors', $result );
48
+		$this->assertEquals(200, $status);
49
+		$this->assertEquals(1, count($header));
50
+		$this->assertEquals(1, $result['meta']['total']);
51
+		$this->assertArrayNotHasKey('included', $result);
52
+		$this->assertArrayNotHasKey('data', $result);
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 
56 56
 
57 57
 	public function testDeleteBulk()
58 58
 	{
59
-		$this->getProductMock( array( 'deleteItems' ) )->expects( $this->once() )->method( 'deleteItems' );
59
+		$this->getProductMock(array('deleteItems'))->expects($this->once())->method('deleteItems');
60 60
 
61 61
 		$body = '{"data":[{"type": "product", "id": "-1"},{"type": "product", "id": "-2"}]}';
62 62
 		$header = array();
63 63
 		$status = 500;
64 64
 
65
-		$result = json_decode( $this->object->delete( $body, $header, $status ), true );
65
+		$result = json_decode($this->object->delete($body, $header, $status), true);
66 66
 
67
-		$this->assertEquals( 200, $status );
68
-		$this->assertEquals( 1, count( $header ) );
69
-		$this->assertEquals( 2, $result['meta']['total'] );
70
-		$this->assertArrayNotHasKey( 'included', $result );
71
-		$this->assertArrayNotHasKey( 'data', $result );
72
-		$this->assertArrayNotHasKey( 'errors', $result );
67
+		$this->assertEquals(200, $status);
68
+		$this->assertEquals(1, count($header));
69
+		$this->assertEquals(2, $result['meta']['total']);
70
+		$this->assertArrayNotHasKey('included', $result);
71
+		$this->assertArrayNotHasKey('data', $result);
72
+		$this->assertArrayNotHasKey('errors', $result);
73 73
 	}
74 74
 
75 75
 
@@ -79,52 +79,52 @@  discard block
 block discarded – undo
79 79
 		$header = array();
80 80
 		$status = 500;
81 81
 
82
-		$result = json_decode( $this->object->delete( $body, $header, $status ), true );
82
+		$result = json_decode($this->object->delete($body, $header, $status), true);
83 83
 
84
-		$this->assertEquals( 400, $status );
85
-		$this->assertEquals( 1, count( $header ) );
86
-		$this->assertEquals( 0, $result['meta']['total'] );
87
-		$this->assertArrayHasKey( 'errors', $result );
88
-		$this->assertArrayNotHasKey( 'included', $result );
89
-		$this->assertArrayNotHasKey( 'data', $result );
84
+		$this->assertEquals(400, $status);
85
+		$this->assertEquals(1, count($header));
86
+		$this->assertEquals(0, $result['meta']['total']);
87
+		$this->assertArrayHasKey('errors', $result);
88
+		$this->assertArrayNotHasKey('included', $result);
89
+		$this->assertArrayNotHasKey('data', $result);
90 90
 	}
91 91
 
92 92
 
93 93
 	public function testDeleteException()
94 94
 	{
95
-		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' )
96
-			->will( $this->throwException( new \Exception( 'test exception' ) ) );
95
+		$this->getProductMock(array('deleteItem'))->expects($this->once())->method('deleteItem')
96
+			->will($this->throwException(new \Exception('test exception')));
97 97
 
98
-		$params = array( 'id' => $this->getProductItem()->getId() );
99
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
100
-		$this->view->addHelper( 'param', $helper );
98
+		$params = array('id' => $this->getProductItem()->getId());
99
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
100
+		$this->view->addHelper('param', $helper);
101 101
 
102 102
 		$header = array();
103 103
 		$status = 500;
104 104
 
105
-		$result = json_decode( $this->object->delete( '', $header, $status ), true );
105
+		$result = json_decode($this->object->delete('', $header, $status), true);
106 106
 
107
-		$this->assertEquals( 500, $status );
108
-		$this->assertArrayHasKey( 'errors', $result );
107
+		$this->assertEquals(500, $status);
108
+		$this->assertArrayHasKey('errors', $result);
109 109
 	}
110 110
 
111 111
 
112 112
 	public function testDeleteMShopException()
113 113
 	{
114
-		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' )
115
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
114
+		$this->getProductMock(array('deleteItem'))->expects($this->once())->method('deleteItem')
115
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
116 116
 
117
-		$params = array( 'id' => $this->getProductItem()->getId() );
118
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
119
-		$this->view->addHelper( 'param', $helper );
117
+		$params = array('id' => $this->getProductItem()->getId());
118
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
119
+		$this->view->addHelper('param', $helper);
120 120
 
121 121
 		$header = array();
122 122
 		$status = 500;
123 123
 
124
-		$result = json_decode( $this->object->delete( '', $header, $status ), true );
124
+		$result = json_decode($this->object->delete('', $header, $status), true);
125 125
 
126
-		$this->assertEquals( 404, $status );
127
-		$this->assertArrayHasKey( 'errors', $result );
126
+		$this->assertEquals(404, $status);
127
+		$this->assertArrayHasKey('errors', $result);
128 128
 	}
129 129
 
130 130
 
@@ -133,18 +133,18 @@  discard block
 block discarded – undo
133 133
 		$header = array();
134 134
 		$status = 500;
135 135
 
136
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
136
+		$result = json_decode($this->object->get('', $header, $status), true);
137 137
 
138
-		$this->assertEquals( 200, $status );
139
-		$this->assertEquals( 1, count( $header ) );
140
-		$this->assertEquals( 28, $result['meta']['total'] );
141
-		$this->assertEquals( 25, count( $result['data'] ) );
142
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
143
-		$this->assertEquals( 0, count( $result['included'] ) );
144
-		$this->assertArrayHasKey( 'next', $result['links'] );
145
-		$this->assertArrayHasKey( 'last', $result['links'] );
146
-		$this->assertArrayHasKey( 'self', $result['links'] );
147
-		$this->assertArrayNotHasKey( 'errors', $result );
138
+		$this->assertEquals(200, $status);
139
+		$this->assertEquals(1, count($header));
140
+		$this->assertEquals(28, $result['meta']['total']);
141
+		$this->assertEquals(25, count($result['data']));
142
+		$this->assertEquals('product', $result['data'][0]['type']);
143
+		$this->assertEquals(0, count($result['included']));
144
+		$this->assertArrayHasKey('next', $result['links']);
145
+		$this->assertArrayHasKey('last', $result['links']);
146
+		$this->assertArrayHasKey('self', $result['links']);
147
+		$this->assertArrayNotHasKey('errors', $result);
148 148
 	}
149 149
 
150 150
 
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
 		$status = 500;
155 155
 
156 156
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
157
-		$object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'product/stock/warehouse' );
157
+		$object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'product/stock/warehouse');
158 158
 
159
-		$result = json_decode( $object->get( '', $header, $status ), true );
159
+		$result = json_decode($object->get('', $header, $status), true);
160 160
 
161
-		$this->assertEquals( 200, $status );
162
-		$this->assertEquals( 1, count( $header ) );
163
-		$this->assertEquals( 6, $result['meta']['total'] );
164
-		$this->assertEquals( 6, count( $result['data'] ) );
165
-		$this->assertEquals( 'product/stock/warehouse', $result['data'][0]['type'] );
166
-		$this->assertEquals( 0, count( $result['included'] ) );
167
-		$this->assertArrayNotHasKey( 'errors', $result );
161
+		$this->assertEquals(200, $status);
162
+		$this->assertEquals(1, count($header));
163
+		$this->assertEquals(6, $result['meta']['total']);
164
+		$this->assertEquals(6, count($result['data']));
165
+		$this->assertEquals('product/stock/warehouse', $result['data'][0]['type']);
166
+		$this->assertEquals(0, count($result['included']));
167
+		$this->assertArrayNotHasKey('errors', $result);
168 168
 	}
169 169
 
170 170
 
@@ -174,55 +174,55 @@  discard block
 block discarded – undo
174 174
 		$status = 500;
175 175
 
176 176
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
177
-		$object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'invalid' );
177
+		$object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'invalid');
178 178
 
179
-		$result = json_decode( $object->get( '', $header, $status ), true );
179
+		$result = json_decode($object->get('', $header, $status), true);
180 180
 
181
-		$this->assertEquals( 404, $status );
182
-		$this->assertEquals( 1, count( $header ) );
183
-		$this->assertEquals( 1, count( $result['errors'] ) );
184
-		$this->assertArrayHasKey( 'title', $result['errors'][0] );
185
-		$this->assertArrayHasKey( 'detail', $result['errors'][0] );
186
-		$this->assertArrayNotHasKey( 'data', $result );
187
-		$this->assertArrayNotHasKey( 'indluded', $result );
181
+		$this->assertEquals(404, $status);
182
+		$this->assertEquals(1, count($header));
183
+		$this->assertEquals(1, count($result['errors']));
184
+		$this->assertArrayHasKey('title', $result['errors'][0]);
185
+		$this->assertArrayHasKey('detail', $result['errors'][0]);
186
+		$this->assertArrayNotHasKey('data', $result);
187
+		$this->assertArrayNotHasKey('indluded', $result);
188 188
 	}
189 189
 
190 190
 
191 191
 	public function testGetException()
192 192
 	{
193
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
194
-			->will( $this->throwException( new \Exception( 'test exception' ) ) );
193
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
194
+			->will($this->throwException(new \Exception('test exception')));
195 195
 
196
-		$params = array( 'id' => -1 );
197
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
198
-		$this->view->addHelper( 'param', $helper );
196
+		$params = array('id' => -1);
197
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
198
+		$this->view->addHelper('param', $helper);
199 199
 
200 200
 		$header = array();
201 201
 		$status = 500;
202 202
 
203
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
203
+		$result = json_decode($this->object->get('', $header, $status), true);
204 204
 
205
-		$this->assertEquals( 500, $status );
206
-		$this->assertArrayHasKey( 'errors', $result );
205
+		$this->assertEquals(500, $status);
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 219
 		$header = array();
220 220
 		$status = 500;
221 221
 
222
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
222
+		$result = json_decode($this->object->get('', $header, $status), true);
223 223
 
224
-		$this->assertEquals( 404, $status );
225
-		$this->assertArrayHasKey( 'errors', $result );
224
+		$this->assertEquals(404, $status);
225
+		$this->assertArrayHasKey('errors', $result);
226 226
 	}
227 227
 
228 228
 
@@ -230,24 +230,24 @@  discard block
 block discarded – undo
230 230
 	{
231 231
 		$params = array(
232 232
 			'filter' => array(
233
-				'==' => array( 'product.type.code' => 'select' )
233
+				'==' => array('product.type.code' => 'select')
234 234
 			)
235 235
 		);
236
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
237
-		$this->view->addHelper( 'param', $helper );
236
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
237
+		$this->view->addHelper('param', $helper);
238 238
 
239 239
 		$header = array();
240 240
 		$status = 500;
241 241
 
242
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
242
+		$result = json_decode($this->object->get('', $header, $status), true);
243 243
 
244
-		$this->assertEquals( 200, $status );
245
-		$this->assertEquals( 1, count( $header ) );
246
-		$this->assertEquals( 3, $result['meta']['total'] );
247
-		$this->assertEquals( 3, count( $result['data'] ) );
248
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
249
-		$this->assertEquals( 0, count( $result['included'] ) );
250
-		$this->assertArrayNotHasKey( 'errors', $result );
244
+		$this->assertEquals(200, $status);
245
+		$this->assertEquals(1, count($header));
246
+		$this->assertEquals(3, $result['meta']['total']);
247
+		$this->assertEquals(3, count($result['data']));
248
+		$this->assertEquals('product', $result['data'][0]['type']);
249
+		$this->assertEquals(0, count($result['included']));
250
+		$this->assertArrayNotHasKey('errors', $result);
251 251
 	}
252 252
 
253 253
 
@@ -256,26 +256,26 @@  discard block
 block discarded – undo
256 256
 		$params = array(
257 257
 			'filter' => array(
258 258
 				'&&' => array(
259
-					array( '=~' => array( 'product.label' => 'Unittest: Test' ) ),
260
-					array( '==' => array( 'product.type.code' => 'select' ) ),
259
+					array('=~' => array('product.label' => 'Unittest: Test')),
260
+					array('==' => array('product.type.code' => 'select')),
261 261
 				)
262 262
 			)
263 263
 		);
264
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
265
-		$this->view->addHelper( 'param', $helper );
264
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
265
+		$this->view->addHelper('param', $helper);
266 266
 
267 267
 		$header = array();
268 268
 		$status = 500;
269 269
 
270
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
270
+		$result = json_decode($this->object->get('', $header, $status), true);
271 271
 
272
-		$this->assertEquals( 200, $status );
273
-		$this->assertEquals( 1, count( $header ) );
274
-		$this->assertEquals( 2, $result['meta']['total'] );
275
-		$this->assertEquals( 2, count( $result['data'] ) );
276
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
277
-		$this->assertEquals( 0, count( $result['included'] ) );
278
-		$this->assertArrayNotHasKey( 'errors', $result );
272
+		$this->assertEquals(200, $status);
273
+		$this->assertEquals(1, count($header));
274
+		$this->assertEquals(2, $result['meta']['total']);
275
+		$this->assertEquals(2, count($result['data']));
276
+		$this->assertEquals('product', $result['data'][0]['type']);
277
+		$this->assertEquals(0, count($result['included']));
278
+		$this->assertArrayNotHasKey('errors', $result);
279 279
 	}
280 280
 
281 281
 
@@ -287,24 +287,24 @@  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 293
 		$header = array();
294 294
 		$status = 500;
295 295
 
296
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
296
+		$result = json_decode($this->object->get('', $header, $status), true);
297 297
 
298
-		$this->assertEquals( 200, $status );
299
-		$this->assertEquals( 1, count( $header ) );
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
-		$this->assertArrayNotHasKey( 'errors', $result );
298
+		$this->assertEquals(200, $status);
299
+		$this->assertEquals(1, count($header));
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
+		$this->assertArrayNotHasKey('errors', $result);
308 308
 	}
309 309
 
310 310
 
@@ -313,23 +313,23 @@  discard block
 block discarded – undo
313 313
 		$params = array(
314 314
 			'sort' => 'product.label,-product.code'
315 315
 		);
316
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
317
-		$this->view->addHelper( 'param', $helper );
316
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
317
+		$this->view->addHelper('param', $helper);
318 318
 
319 319
 		$header = array();
320 320
 		$status = 500;
321 321
 
322
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
322
+		$result = json_decode($this->object->get('', $header, $status), true);
323 323
 
324
-		$this->assertEquals( 200, $status );
325
-		$this->assertEquals( 1, count( $header ) );
326
-		$this->assertEquals( 28, $result['meta']['total'] );
327
-		$this->assertEquals( 25, count( $result['data'] ) );
328
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
329
-		$this->assertEquals( 'QRST', $result['data'][0]['attributes']['product.code'] );
330
-		$this->assertEquals( '16 discs', $result['data'][0]['attributes']['product.label'] );
331
-		$this->assertEquals( 0, count( $result['included'] ) );
332
-		$this->assertArrayNotHasKey( 'errors', $result );
324
+		$this->assertEquals(200, $status);
325
+		$this->assertEquals(1, count($header));
326
+		$this->assertEquals(28, $result['meta']['total']);
327
+		$this->assertEquals(25, count($result['data']));
328
+		$this->assertEquals('product', $result['data'][0]['type']);
329
+		$this->assertEquals('QRST', $result['data'][0]['attributes']['product.code']);
330
+		$this->assertEquals('16 discs', $result['data'][0]['attributes']['product.label']);
331
+		$this->assertEquals(0, count($result['included']));
332
+		$this->assertArrayNotHasKey('errors', $result);
333 333
 	}
334 334
 
335 335
 
@@ -342,88 +342,88 @@  discard block
 block discarded – undo
342 342
 			'sort' => 'product.id',
343 343
 			'include' => 'product'
344 344
 		);
345
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
346
-		$this->view->addHelper( 'param', $helper );
345
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
346
+		$this->view->addHelper('param', $helper);
347 347
 
348 348
 		$header = array();
349 349
 		$status = 500;
350 350
 
351
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
351
+		$result = json_decode($this->object->get('', $header, $status), true);
352 352
 
353
-		$this->assertEquals( 200, $status );
354
-		$this->assertEquals( 1, count( $header ) );
355
-		$this->assertEquals( 28, $result['meta']['total'] );
356
-		$this->assertEquals( 25, count( $result['data'] ) );
357
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
358
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
359
-		$this->assertArrayNotHasKey( 'errors', $result );
353
+		$this->assertEquals(200, $status);
354
+		$this->assertEquals(1, count($header));
355
+		$this->assertEquals(28, $result['meta']['total']);
356
+		$this->assertEquals(25, count($result['data']));
357
+		$this->assertEquals('product', $result['data'][0]['type']);
358
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
359
+		$this->assertArrayNotHasKey('errors', $result);
360 360
 	}
361 361
 
362 362
 
363 363
 	public function testPatch()
364 364
 	{
365
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
365
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
366 366
 
367 367
 		$item = $productManagerStub->createItem();
368
-		$item->setLabel( 'test' );
369
-		$item->setId( '-1' );
368
+		$item->setLabel('test');
369
+		$item->setId('-1');
370 370
 
371
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' );
372
-		$productManagerStub->expects( $this->atLeastOnce() )->method( 'getItem' )
373
-			->will( $this->returnValue( $item ) );
371
+		$productManagerStub->expects($this->once())->method('saveItem');
372
+		$productManagerStub->expects($this->atLeastOnce())->method('getItem')
373
+			->will($this->returnValue($item));
374 374
 
375 375
 
376
-		$params = array( 'id' => '-1' );
377
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
378
-		$this->view->addHelper( 'param', $helper );
376
+		$params = array('id' => '-1');
377
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
378
+		$this->view->addHelper('param', $helper);
379 379
 
380 380
 		$body = '{"data": {"type": "product", "attributes": {"product.label": "test"}}}';
381 381
 		$header = array();
382 382
 		$status = 500;
383 383
 
384
-		$result = json_decode( $this->object->patch( $body, $header, $status ), true );
384
+		$result = json_decode($this->object->patch($body, $header, $status), true);
385 385
 
386
-		$this->assertEquals( 200, $status );
387
-		$this->assertEquals( 1, count( $header ) );
388
-		$this->assertEquals( 1, $result['meta']['total'] );
389
-		$this->assertArrayHasKey( 'data', $result );
390
-		$this->assertEquals( '-1', $result['data']['id'] );
391
-		$this->assertEquals( 'product', $result['data']['type'] );
392
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
393
-		$this->assertArrayNotHasKey( 'included', $result );
394
-		$this->assertArrayNotHasKey( 'errors', $result );
386
+		$this->assertEquals(200, $status);
387
+		$this->assertEquals(1, count($header));
388
+		$this->assertEquals(1, $result['meta']['total']);
389
+		$this->assertArrayHasKey('data', $result);
390
+		$this->assertEquals('-1', $result['data']['id']);
391
+		$this->assertEquals('product', $result['data']['type']);
392
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
393
+		$this->assertArrayNotHasKey('included', $result);
394
+		$this->assertArrayNotHasKey('errors', $result);
395 395
 	}
396 396
 
397 397
 
398 398
 	public function testPatchBulk()
399 399
 	{
400
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
400
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
401 401
 
402 402
 		$item = $productManagerStub->createItem();
403
-		$item->setLabel( 'test' );
404
-		$item->setId( '-1' );
403
+		$item->setLabel('test');
404
+		$item->setId('-1');
405 405
 
406
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' );
407
-		$productManagerStub->expects( $this->atLeastOnce() )->method( 'getItem' )
408
-			->will( $this->returnValue( $item ) );
406
+		$productManagerStub->expects($this->exactly(2))->method('saveItem');
407
+		$productManagerStub->expects($this->atLeastOnce())->method('getItem')
408
+			->will($this->returnValue($item));
409 409
 
410 410
 
411 411
 		$body = '{"data": [{"id": "-1", "type": "product", "attributes": {"product.label": "test"}}, {"id": "-1", "type": "product", "attributes": {"product.label": "test"}}]}';
412 412
 		$header = array();
413 413
 		$status = 500;
414 414
 
415
-		$result = json_decode( $this->object->patch( $body, $header, $status ), true );
415
+		$result = json_decode($this->object->patch($body, $header, $status), true);
416 416
 
417
-		$this->assertEquals( 200, $status );
418
-		$this->assertEquals( 1, count( $header ) );
419
-		$this->assertEquals( 2, $result['meta']['total'] );
420
-		$this->assertArrayHasKey( 'data', $result );
421
-		$this->assertEquals( 2, count( $result['data'] ) );
422
-		$this->assertEquals( '-1', $result['data'][0]['id'] );
423
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
424
-		$this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] );
425
-		$this->assertArrayNotHasKey( 'included', $result );
426
-		$this->assertArrayNotHasKey( 'errors', $result );
417
+		$this->assertEquals(200, $status);
418
+		$this->assertEquals(1, count($header));
419
+		$this->assertEquals(2, $result['meta']['total']);
420
+		$this->assertArrayHasKey('data', $result);
421
+		$this->assertEquals(2, count($result['data']));
422
+		$this->assertEquals('-1', $result['data'][0]['id']);
423
+		$this->assertEquals('product', $result['data'][0]['type']);
424
+		$this->assertEquals('test', $result['data'][0]['attributes']['product.label']);
425
+		$this->assertArrayNotHasKey('included', $result);
426
+		$this->assertArrayNotHasKey('errors', $result);
427 427
 	}
428 428
 
429 429
 
@@ -433,14 +433,14 @@  discard block
 block discarded – undo
433 433
 		$header = array();
434 434
 		$status = 500;
435 435
 
436
-		$result = json_decode( $this->object->patch( $body, $header, $status ), true );
436
+		$result = json_decode($this->object->patch($body, $header, $status), true);
437 437
 
438
-		$this->assertEquals( 400, $status );
439
-		$this->assertEquals( 1, count( $header ) );
440
-		$this->assertEquals( 0, $result['meta']['total'] );
441
-		$this->assertArrayHasKey( 'errors', $result );
442
-		$this->assertArrayNotHasKey( 'included', $result );
443
-		$this->assertArrayNotHasKey( 'data', $result );
438
+		$this->assertEquals(400, $status);
439
+		$this->assertEquals(1, count($header));
440
+		$this->assertEquals(0, $result['meta']['total']);
441
+		$this->assertArrayHasKey('errors', $result);
442
+		$this->assertArrayNotHasKey('included', $result);
443
+		$this->assertArrayNotHasKey('data', $result);
444 444
 	}
445 445
 
446 446
 
@@ -450,127 +450,127 @@  discard block
 block discarded – undo
450 450
 		$header = array();
451 451
 		$status = 500;
452 452
 
453
-		$result = json_decode( $this->object->patch( $body, $header, $status ), true );
453
+		$result = json_decode($this->object->patch($body, $header, $status), true);
454 454
 
455
-		$this->assertEquals( 400, $status );
456
-		$this->assertEquals( 1, count( $header ) );
457
-		$this->assertEquals( 0, $result['meta']['total'] );
458
-		$this->assertArrayHasKey( 'errors', $result );
455
+		$this->assertEquals(400, $status);
456
+		$this->assertEquals(1, count($header));
457
+		$this->assertEquals(0, $result['meta']['total']);
458
+		$this->assertArrayHasKey('errors', $result);
459 459
 	}
460 460
 
461 461
 
462 462
 	public function testPatchException()
463 463
 	{
464
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
465
-			->will( $this->throwException( new \Exception( 'test exception' ) ) );
464
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
465
+			->will($this->throwException(new \Exception('test exception')));
466 466
 
467 467
 		$header = array();
468 468
 		$status = 500;
469 469
 
470
-		$result = json_decode( $this->object->patch( '{"data":[{"id":-1}]}', $header, $status ), true );
470
+		$result = json_decode($this->object->patch('{"data":[{"id":-1}]}', $header, $status), true);
471 471
 
472
-		$this->assertEquals( 500, $status );
473
-		$this->assertArrayHasKey( 'errors', $result );
472
+		$this->assertEquals(500, $status);
473
+		$this->assertArrayHasKey('errors', $result);
474 474
 	}
475 475
 
476 476
 
477 477
 	public function testPatchMShopException()
478 478
 	{
479
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
480
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
479
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
480
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
481 481
 
482 482
 		$header = array();
483 483
 		$status = 500;
484 484
 
485
-		$result = json_decode( $this->object->patch( '{"data":[{"id":-1}]}', $header, $status ), true );
485
+		$result = json_decode($this->object->patch('{"data":[{"id":-1}]}', $header, $status), true);
486 486
 
487
-		$this->assertEquals( 404, $status );
488
-		$this->assertArrayHasKey( 'errors', $result );
487
+		$this->assertEquals(404, $status);
488
+		$this->assertArrayHasKey('errors', $result);
489 489
 	}
490 490
 
491 491
 
492 492
 	public function testPost()
493 493
 	{
494
-		$productManagerStub = $this->getProductMock( array( 'createItem', 'getItem', 'saveItem' ) );
494
+		$productManagerStub = $this->getProductMock(array('createItem', 'getItem', 'saveItem'));
495 495
 
496 496
 		$item = new \Aimeos\MShop\Product\Item\Standard();
497
-		$item->setId( '-1' );
497
+		$item->setId('-1');
498 498
 
499
-		$productManagerStub->expects( $this->once() )->method( 'createItem' )
500
-			->will( $this->returnValue( $item ) );
501
-		$productManagerStub->expects( $this->any() )->method( 'getItem' )
502
-			->will( $this->returnValue( $item ) );
503
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' );
499
+		$productManagerStub->expects($this->once())->method('createItem')
500
+			->will($this->returnValue($item));
501
+		$productManagerStub->expects($this->any())->method('getItem')
502
+			->will($this->returnValue($item));
503
+		$productManagerStub->expects($this->once())->method('saveItem');
504 504
 
505 505
 
506 506
 		$body = '{"data": {"type": "product", "attributes": {"product.type": "default", "product.label": "test"}}}';
507 507
 		$header = array();
508 508
 		$status = 500;
509 509
 
510
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
510
+		$result = json_decode($this->object->post($body, $header, $status), true);
511 511
 
512
-		$this->assertEquals( 201, $status );
513
-		$this->assertEquals( 1, count( $header ) );
514
-		$this->assertEquals( 1, $result['meta']['total'] );
515
-		$this->assertArrayHasKey( 'data', $result );
516
-		$this->assertEquals( '-1', $result['data']['id'] );
517
-		$this->assertEquals( 'product', $result['data']['type'] );
518
-		$this->assertGreaterThan( 0, $result['data']['attributes']['product.typeid'] );
519
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
520
-		$this->assertArrayNotHasKey( 'included', $result );
521
-		$this->assertArrayNotHasKey( 'errors', $result );
512
+		$this->assertEquals(201, $status);
513
+		$this->assertEquals(1, count($header));
514
+		$this->assertEquals(1, $result['meta']['total']);
515
+		$this->assertArrayHasKey('data', $result);
516
+		$this->assertEquals('-1', $result['data']['id']);
517
+		$this->assertEquals('product', $result['data']['type']);
518
+		$this->assertGreaterThan(0, $result['data']['attributes']['product.typeid']);
519
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
520
+		$this->assertArrayNotHasKey('included', $result);
521
+		$this->assertArrayNotHasKey('errors', $result);
522 522
 	}
523 523
 
524 524
 
525 525
 	public function testPostBulk()
526 526
 	{
527
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
527
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
528 528
 
529 529
 		$item = $productManagerStub->createItem();
530
-		$item->setLabel( 'test' );
531
-		$item->setId( '-1' );
530
+		$item->setLabel('test');
531
+		$item->setId('-1');
532 532
 
533
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' );
534
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'getItem' )
535
-			->will( $this->returnValue( $item ) );
533
+		$productManagerStub->expects($this->exactly(2))->method('saveItem');
534
+		$productManagerStub->expects($this->exactly(2))->method('getItem')
535
+			->will($this->returnValue($item));
536 536
 
537 537
 
538 538
 		$body = '{"data": [{"type": "product", "attributes": {"product.label": "test"}}, {"type": "product", "attributes": {"product.label": "test"}}]}';
539 539
 		$header = array();
540 540
 		$status = 500;
541 541
 
542
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
542
+		$result = json_decode($this->object->post($body, $header, $status), true);
543 543
 
544
-		$this->assertEquals( 201, $status );
545
-		$this->assertEquals( 1, count( $header ) );
546
-		$this->assertEquals( 2, $result['meta']['total'] );
547
-		$this->assertArrayHasKey( 'data', $result );
548
-		$this->assertEquals( 2, count( $result['data'] ) );
549
-		$this->assertEquals( '-1', $result['data'][0]['id'] );
550
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
551
-		$this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] );
552
-		$this->assertArrayNotHasKey( 'included', $result );
553
-		$this->assertArrayNotHasKey( 'errors', $result );
544
+		$this->assertEquals(201, $status);
545
+		$this->assertEquals(1, count($header));
546
+		$this->assertEquals(2, $result['meta']['total']);
547
+		$this->assertArrayHasKey('data', $result);
548
+		$this->assertEquals(2, count($result['data']));
549
+		$this->assertEquals('-1', $result['data'][0]['id']);
550
+		$this->assertEquals('product', $result['data'][0]['type']);
551
+		$this->assertEquals('test', $result['data'][0]['attributes']['product.label']);
552
+		$this->assertArrayNotHasKey('included', $result);
553
+		$this->assertArrayNotHasKey('errors', $result);
554 554
 	}
555 555
 
556 556
 
557 557
 	public function testPostRelationships()
558 558
 	{
559
-		$productManagerStub = $this->getProductMock( array( 'getSubManager', 'createItem', 'getItem', 'saveItem' ) );
560
-		$productManagerListsStub = $this->getProductListsMock( array( 'saveItem' ) );
559
+		$productManagerStub = $this->getProductMock(array('getSubManager', 'createItem', 'getItem', 'saveItem'));
560
+		$productManagerListsStub = $this->getProductListsMock(array('saveItem'));
561 561
 
562 562
 		$item = new \Aimeos\MShop\Product\Item\Standard();
563
-		$item->setId( '-1' );
563
+		$item->setId('-1');
564 564
 
565
-		$productManagerStub->expects( $this->once() )->method( 'createItem' )
566
-			->will( $this->returnValue( $item ) );
567
-		$productManagerStub->expects( $this->any() )->method( 'getItem' )
568
-			->will( $this->returnValue( $item ) );
569
-		$productManagerStub->expects( $this->once() )->method( 'getSubManager' )
570
-			->will( $this->returnValue( $productManagerListsStub ) );
571
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' );
565
+		$productManagerStub->expects($this->once())->method('createItem')
566
+			->will($this->returnValue($item));
567
+		$productManagerStub->expects($this->any())->method('getItem')
568
+			->will($this->returnValue($item));
569
+		$productManagerStub->expects($this->once())->method('getSubManager')
570
+			->will($this->returnValue($productManagerListsStub));
571
+		$productManagerStub->expects($this->once())->method('saveItem');
572 572
 
573
-		$productManagerListsStub->expects( $this->once() )->method( 'saveItem' );
573
+		$productManagerListsStub->expects($this->once())->method('saveItem');
574 574
 
575 575
 		$body = '{"data": {"type": "product",
576 576
 			"attributes": {"product.label": "test"},
@@ -581,17 +581,17 @@  discard block
 block discarded – undo
581 581
 		$header = array();
582 582
 		$status = 500;
583 583
 
584
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
584
+		$result = json_decode($this->object->post($body, $header, $status), true);
585 585
 
586
-		$this->assertEquals( 201, $status );
587
-		$this->assertEquals( 1, count( $header ) );
588
-		$this->assertEquals( 1, $result['meta']['total'] );
589
-		$this->assertArrayHasKey( 'data', $result );
590
-		$this->assertEquals( '-1', $result['data']['id'] );
591
-		$this->assertEquals( 'product', $result['data']['type'] );
592
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
593
-		$this->assertArrayNotHasKey( 'included', $result );
594
-		$this->assertArrayNotHasKey( 'errors', $result );
586
+		$this->assertEquals(201, $status);
587
+		$this->assertEquals(1, count($header));
588
+		$this->assertEquals(1, $result['meta']['total']);
589
+		$this->assertArrayHasKey('data', $result);
590
+		$this->assertEquals('-1', $result['data']['id']);
591
+		$this->assertEquals('product', $result['data']['type']);
592
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
593
+		$this->assertArrayNotHasKey('included', $result);
594
+		$this->assertArrayNotHasKey('errors', $result);
595 595
 	}
596 596
 
597 597
 
@@ -601,14 +601,14 @@  discard block
 block discarded – undo
601 601
 		$header = array();
602 602
 		$status = 500;
603 603
 
604
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
604
+		$result = json_decode($this->object->post($body, $header, $status), true);
605 605
 
606
-		$this->assertEquals( 400, $status );
607
-		$this->assertEquals( 1, count( $header ) );
608
-		$this->assertEquals( 0, $result['meta']['total'] );
609
-		$this->assertArrayHasKey( 'errors', $result );
610
-		$this->assertArrayNotHasKey( 'included', $result );
611
-		$this->assertArrayNotHasKey( 'data', $result );
606
+		$this->assertEquals(400, $status);
607
+		$this->assertEquals(1, count($header));
608
+		$this->assertEquals(0, $result['meta']['total']);
609
+		$this->assertArrayHasKey('errors', $result);
610
+		$this->assertArrayNotHasKey('included', $result);
611
+		$this->assertArrayNotHasKey('data', $result);
612 612
 	}
613 613
 
614 614
 
@@ -618,42 +618,42 @@  discard block
 block discarded – undo
618 618
 		$header = array();
619 619
 		$status = 500;
620 620
 
621
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
621
+		$result = json_decode($this->object->post($body, $header, $status), true);
622 622
 
623
-		$this->assertEquals( 403, $status );
624
-		$this->assertEquals( 1, count( $header ) );
625
-		$this->assertEquals( 0, $result['meta']['total'] );
626
-		$this->assertArrayHasKey( 'errors', $result );
623
+		$this->assertEquals(403, $status);
624
+		$this->assertEquals(1, count($header));
625
+		$this->assertEquals(0, $result['meta']['total']);
626
+		$this->assertArrayHasKey('errors', $result);
627 627
 	}
628 628
 
629 629
 
630 630
 	public function testPostException()
631 631
 	{
632
-		$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' )
633
-			->will( $this->throwException( new \Exception( 'test exception' ) ) );
632
+		$this->getProductMock(array('saveItem'))->expects($this->once())->method('saveItem')
633
+			->will($this->throwException(new \Exception('test exception')));
634 634
 
635 635
 		$header = array();
636 636
 		$status = 500;
637 637
 
638
-		$result = json_decode( $this->object->post( '{"data":{}}', $header, $status ), true );
638
+		$result = json_decode($this->object->post('{"data":{}}', $header, $status), true);
639 639
 
640
-		$this->assertEquals( 500, $status );
641
-		$this->assertArrayHasKey( 'errors', $result );
640
+		$this->assertEquals(500, $status);
641
+		$this->assertArrayHasKey('errors', $result);
642 642
 	}
643 643
 
644 644
 
645 645
 	public function testPostMShopException()
646 646
 	{
647
-		$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' )
648
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
647
+		$this->getProductMock(array('saveItem'))->expects($this->once())->method('saveItem')
648
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
649 649
 
650 650
 		$header = array();
651 651
 		$status = 500;
652 652
 
653
-		$result = json_decode( $this->object->post( '{"data":{}}', $header, $status ), true );
653
+		$result = json_decode($this->object->post('{"data":{}}', $header, $status), true);
654 654
 
655
-		$this->assertEquals( 404, $status );
656
-		$this->assertArrayHasKey( 'errors', $result );
655
+		$this->assertEquals(404, $status);
656
+		$this->assertArrayHasKey('errors', $result);
657 657
 	}
658 658
 
659 659
 
@@ -663,11 +663,11 @@  discard block
 block discarded – undo
663 663
 		$header = array();
664 664
 		$status = 500;
665 665
 
666
-		$result = json_decode( $this->object->put( $body, $header, $status ), true );
666
+		$result = json_decode($this->object->put($body, $header, $status), true);
667 667
 
668
-		$this->assertEquals( 501, $status );
669
-		$this->assertEquals( 1, count( $header ) );
670
-		$this->assertArrayHasKey( 'errors', $result );
668
+		$this->assertEquals(501, $status);
669
+		$this->assertEquals(1, count($header));
670
+		$this->assertArrayHasKey('errors', $result);
671 671
 	}
672 672
 
673 673
 
@@ -676,87 +676,87 @@  discard block
 block discarded – undo
676 676
 		$header = array();
677 677
 		$status = 500;
678 678
 
679
-		$result = json_decode( $this->object->options( '', $header, $status ), true );
679
+		$result = json_decode($this->object->options('', $header, $status), true);
680 680
 
681
-		$this->assertEquals( 200, $status );
682
-		$this->assertEquals( 2, count( $header ) );
683
-		$this->assertEquals( 59, count( $result['meta']['resources'] ) );
684
-		$this->assertGreaterThan( 0, count( $result['meta']['attributes'] ) );
685
-		$this->assertArrayNotHasKey( 'errors', $result );
681
+		$this->assertEquals(200, $status);
682
+		$this->assertEquals(2, count($header));
683
+		$this->assertEquals(59, count($result['meta']['resources']));
684
+		$this->assertGreaterThan(0, count($result['meta']['attributes']));
685
+		$this->assertArrayNotHasKey('errors', $result);
686 686
 	}
687 687
 
688 688
 
689 689
 	public function testOptionsException()
690 690
 	{
691
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
692
-			->will( $this->throwException( new \Exception( 'test exception' ) ) );
691
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
692
+			->will($this->throwException(new \Exception('test exception')));
693 693
 
694 694
 		$header = array();
695 695
 		$status = 500;
696 696
 
697
-		$result = json_decode( $this->object->options( '', $header, $status ), true );
697
+		$result = json_decode($this->object->options('', $header, $status), true);
698 698
 
699
-		$this->assertEquals( 500, $status );
700
-		$this->assertArrayHasKey( 'errors', $result );
699
+		$this->assertEquals(500, $status);
700
+		$this->assertArrayHasKey('errors', $result);
701 701
 	}
702 702
 
703 703
 
704 704
 	public function testOptionsMShopException()
705 705
 	{
706
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
707
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
706
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
707
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
708 708
 
709 709
 		$header = array();
710 710
 		$status = 500;
711 711
 
712
-		$result = json_decode( $this->object->options( '', $header, $status ), true );
712
+		$result = json_decode($this->object->options('', $header, $status), true);
713 713
 
714
-		$this->assertEquals( 404, $status );
715
-		$this->assertArrayHasKey( 'errors', $result );
714
+		$this->assertEquals(404, $status);
715
+		$this->assertArrayHasKey('errors', $result);
716 716
 	}
717 717
 
718 718
 
719
-	protected function getProductMock( array $methods )
719
+	protected function getProductMock(array $methods)
720 720
 	{
721 721
 		$name = 'ClientJsonAdmStandard';
722
-		$this->context->getConfig()->set( 'mshop/product/manager/name', $name );
722
+		$this->context->getConfig()->set('mshop/product/manager/name', $name);
723 723
 
724
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' )
725
-			->setConstructorArgs( array( $this->context ) )
726
-			->setMethods( $methods )
724
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')
725
+			->setConstructorArgs(array($this->context))
726
+			->setMethods($methods)
727 727
 			->getMock();
728 728
 
729
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $stub );
729
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $stub);
730 730
 
731 731
 		return $stub;
732 732
 	}
733 733
 
734 734
 
735
-	protected function getProductListsMock( array $methods )
735
+	protected function getProductListsMock(array $methods)
736 736
 	{
737 737
 		$name = 'ClientJsonAdmStandard';
738
-		$this->context->getConfig()->set( 'mshop/product/manager/lists/name', $name );
738
+		$this->context->getConfig()->set('mshop/product/manager/lists/name', $name);
739 739
 
740
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard' )
741
-			->setConstructorArgs( array( $this->context ) )
742
-			->setMethods( $methods )
740
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard')
741
+			->setConstructorArgs(array($this->context))
742
+			->setMethods($methods)
743 743
 			->getMock();
744 744
 
745
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\' . $name, $stub );
745
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\Lists\\' . $name, $stub);
746 746
 
747 747
 		return $stub;
748 748
 	}
749 749
 
750 750
 
751
-	protected function getProductItem( $code = 'CNC' )
751
+	protected function getProductItem($code = 'CNC')
752 752
 	{
753
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
753
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
754 754
 		$search = $manager->createSearch();
755
-		$search->setConditions( $search->compare( '==', 'product.code', $code ) );
756
-		$items = $manager->searchItems( $search );
755
+		$search->setConditions($search->compare('==', 'product.code', $code));
756
+		$items = $manager->searchItems($search);
757 757
 
758
-		if( ( $item = reset( $items ) ) === false ) {
759
-			throw new \Exception( sprintf( 'No product item with code "%1$s" found', $code ) );
758
+		if (($item = reset($items)) === false) {
759
+			throw new \Exception(sprintf('No product item with code "%1$s" found', $code));
760 760
 		}
761 761
 
762 762
 		return $item;
Please login to merge, or discard this patch.