Completed
Branch master (eb8dc7)
by Aimeos
03:09
created
admin/jsonadm/src/Admin/JsonAdm/Base.php 4 patches
Doc Comments   +6 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,6 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param string $body Request body
50 50
 	 * @param array &$header Variable which contains the HTTP headers and the new ones afterwards
51 51
 	 * @param integer &$status Variable which contains the HTTP status afterwards
52
+	 * @param integer $status
52 53
 	 * @return string Content for response body
53 54
 	 */
54 55
 	public function delete( $body, array &$header, &$status )
@@ -252,6 +253,7 @@  discard block
 block discarded – undo
252 253
 	 * @param string $body Request body
253 254
 	 * @param array &$header Variable which contains the HTTP headers and the new ones afterwards
254 255
 	 * @param integer &$status Variable which contains the HTTP status afterwards
256
+	 * @param integer $status
255 257
 	 * @return string Content for response body
256 258
 	 */
257 259
 	public function patch( $body, array &$header, &$status )
@@ -380,6 +382,7 @@  discard block
 block discarded – undo
380 382
 	 * @param string $body Request body
381 383
 	 * @param array &$header Variable which contains the HTTP headers and the new ones afterwards
382 384
 	 * @param integer &$status Variable which contains the HTTP status afterwards
385
+	 * @param integer $status
383 386
 	 * @return string Content for response body
384 387
 	 */
385 388
 	public function post( $body, array &$header, &$status )
@@ -508,6 +511,7 @@  discard block
 block discarded – undo
508 511
 	 * @param string $body Request body
509 512
 	 * @param array &$header Variable which contains the HTTP headers and the new ones afterwards
510 513
 	 * @param integer &$status Variable which contains the HTTP status afterwards
514
+	 * @param integer $status
511 515
 	 * @return string Content for response body
512 516
 	 */
513 517
 	public function put( $body, array &$header, &$status )
@@ -559,6 +563,7 @@  discard block
 block discarded – undo
559 563
 	 * @param string $body Request body
560 564
 	 * @param array &$header Variable which contains the HTTP headers and the new ones afterwards
561 565
 	 * @param integer &$status Variable which contains the HTTP status afterwards
566
+	 * @param integer $status
562 567
 	 * @return string Content for response body
563 568
 	 */
564 569
 	public function options( $body, array &$header, &$status )
@@ -785,7 +790,7 @@  discard block
 block discarded – undo
785 790
 	/**
786 791
 	 * Returns the items associated via a lists table
787 792
 	 *
788
-	 * @param array $items List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
793
+	 * @param array $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
789 794
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
790 795
 	 */
791 796
 	protected function getRefItems( array $listItems )
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 		 * @see admin/jsonadm/standard/template-post
546 546
 		 * @see admin/jsonadm/standard/template-get
547 547
 		 * @see admin/jsonadm/standard/template-options
548
-		*/
548
+		 */
549 549
 		$tplconf = 'admin/jsonadm/standard/template-put';
550 550
 		$default = 'put-default.php';
551 551
 
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 		 * @see admin/jsonadm/standard/template-post
660 660
 		 * @see admin/jsonadm/standard/template-get
661 661
 		 * @see admin/jsonadm/standard/template-put
662
-		*/
662
+		 */
663 663
 		$tplconf = 'admin/jsonadm/standard/template-options';
664 664
 		$default = 'options-default.php';
665 665
 
Please login to merge, or discard this patch.
Spacing   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param string $path Name of the client separated by slashes, e.g "product/stock"
35 35
 	 * @return void
36 36
 	 */
37
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path )
37
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, array $templatePaths, $path)
38 38
 	{
39 39
 		$this->view = $view;
40 40
 		$this->context = $context;
@@ -51,73 +51,73 @@  discard block
 block discarded – undo
51 51
 	 * @param integer &$status Variable which contains the HTTP status afterwards
52 52
 	 * @return string Content for response body
53 53
 	 */
54
-	public function delete( $body, array &$header, &$status )
54
+	public function delete($body, array &$header, &$status)
55 55
 	{
56
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
56
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
57 57
 		$context = $this->getContext();
58 58
 		$view = $this->getView();
59 59
 
60 60
 		try
61 61
 		{
62
-			$manager = \Aimeos\MShop\Factory::createManager( $context, $this->getPath() );
62
+			$manager = \Aimeos\MShop\Factory::createManager($context, $this->getPath());
63 63
 
64
-			if( ( $id = $view->param( 'id' ) ) == null )
64
+			if (($id = $view->param('id')) == null)
65 65
 			{
66
-				if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) || !is_array( $request->data ) ) {
67
-					throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 );
66
+				if (($request = json_decode($body)) === null || !isset($request->data) || !is_array($request->data)) {
67
+					throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400);
68 68
 				}
69 69
 
70 70
 				$ids = array();
71 71
 
72
-				foreach( $request->data as $entry )
72
+				foreach ($request->data as $entry)
73 73
 				{
74
-					if( isset( $entry->id ) ) {
74
+					if (isset($entry->id)) {
75 75
 						$ids[] = $entry->id;
76 76
 					}
77 77
 				}
78 78
 
79
-				$manager->deleteItems( $ids );
80
-				$view->total = count( $ids );
79
+				$manager->deleteItems($ids);
80
+				$view->total = count($ids);
81 81
 			}
82 82
 			else
83 83
 			{
84
-				$manager->deleteItem( $id );
84
+				$manager->deleteItem($id);
85 85
 				$view->total = 1;
86 86
 			}
87 87
 
88 88
 			$status = 200;
89 89
 		}
90
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
90
+		catch (\Aimeos\Admin\JsonAdm\Exception $e)
91 91
 		{
92 92
 			$status = $e->getCode();
93
-			$view->errors = array( array(
94
-				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
93
+			$view->errors = array(array(
94
+				'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()),
95 95
 				'detail' => $e->getTraceAsString(),
96
-			) );
96
+			));
97 97
 		}
98
-		catch( \Aimeos\MAdmin\Exception $e )
98
+		catch (\Aimeos\MAdmin\Exception $e)
99 99
 		{
100 100
 			$status = 404;
101
-			$view->errors = array( array(
102
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
101
+			$view->errors = array(array(
102
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
103 103
 				'detail' => $e->getTraceAsString(),
104
-			) );
104
+			));
105 105
 		}
106
-		catch( \Aimeos\MShop\Exception $e )
106
+		catch (\Aimeos\MShop\Exception $e)
107 107
 		{
108 108
 			$status = 404;
109
-			$view->errors = array( array(
110
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
109
+			$view->errors = array(array(
110
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
111 111
 				'detail' => $e->getTraceAsString(),
112
-			) );
112
+			));
113 113
 		}
114
-		catch( \Exception $e )
114
+		catch (\Exception $e)
115 115
 		{
116 116
 			$status = 500;
117
-			$view->errors = array( array(
117
+			$view->errors = array(array(
118 118
 				'title' => $e->getMessage(),
119 119
 				'detail' => $e->getTraceAsString(),
120
-			) );
120
+			));
121 121
 		}
122 122
 
123 123
 		/** admin/jsonadm/standard/template-delete
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		$tplconf = 'admin/jsonadm/standard/template-delete';
148 148
 		$default = 'delete-default.php';
149 149
 
150
-		return $view->render( $view->config( $tplconf, $default ) );
150
+		return $view->render($view->config($tplconf, $default));
151 151
 	}
152 152
 
153 153
 
@@ -159,60 +159,60 @@  discard block
 block discarded – undo
159 159
 	 * @param integer &$status Variable which contains the HTTP status afterwards
160 160
 	 * @return string Content for response body
161 161
 	 */
162
-	public function get( $body, array &$header, &$status )
162
+	public function get($body, array &$header, &$status)
163 163
 	{
164
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
164
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
165 165
 		$context = $this->getContext();
166 166
 		$view = $this->getView();
167 167
 		$total = 1;
168 168
 
169 169
 		try
170 170
 		{
171
-			$manager = \Aimeos\MShop\Factory::createManager( $context, $this->getPath() );
172
-			$include = ( ( $include = $view->param( 'include' ) ) !== null ? explode( ',', $include ) : array() );
171
+			$manager = \Aimeos\MShop\Factory::createManager($context, $this->getPath());
172
+			$include = (($include = $view->param('include')) !== null ? explode(',', $include) : array());
173 173
 
174
-			if( ( $id = $view->param( 'id' ) ) == null )
174
+			if (($id = $view->param('id')) == null)
175 175
 			{
176
-				$search = $this->initCriteria( $manager->createSearch(), $view->param() );
177
-				$view->data = $manager->searchItems( $search, array(), $total );
178
-				$view->childItems = $this->getChildItems( $view->data, $include );
179
-				$view->listItems = $this->getListItems( $view->data, $include );
176
+				$search = $this->initCriteria($manager->createSearch(), $view->param());
177
+				$view->data = $manager->searchItems($search, array(), $total);
178
+				$view->childItems = $this->getChildItems($view->data, $include);
179
+				$view->listItems = $this->getListItems($view->data, $include);
180 180
 			}
181 181
 			else
182 182
 			{
183
-				$view->data = $manager->getItem( $id, array() );
184
-				$view->childItems = $this->getChildItems( array( $id => $view->data ), $include );
185
-				$view->listItems = $this->getListItems( array( $id => $view->data ), $include );
183
+				$view->data = $manager->getItem($id, array());
184
+				$view->childItems = $this->getChildItems(array($id => $view->data), $include);
185
+				$view->listItems = $this->getListItems(array($id => $view->data), $include);
186 186
 			}
187 187
 
188
-			$view->refItems = $this->getRefItems( $view->listItems );
188
+			$view->refItems = $this->getRefItems($view->listItems);
189 189
 
190 190
 			$view->total = $total;
191 191
 			$status = 200;
192 192
 		}
193
-		catch( \Aimeos\MAdmin\Exception $e )
193
+		catch (\Aimeos\MAdmin\Exception $e)
194 194
 		{
195 195
 			$status = 404;
196
-			$view->errors = array( array(
197
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
196
+			$view->errors = array(array(
197
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
198 198
 				'detail' => $e->getTraceAsString(),
199
-			) );
199
+			));
200 200
 		}
201
-		catch( \Aimeos\MShop\Exception $e )
201
+		catch (\Aimeos\MShop\Exception $e)
202 202
 		{
203 203
 			$status = 404;
204
-			$view->errors = array( array(
205
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
204
+			$view->errors = array(array(
205
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
206 206
 				'detail' => $e->getTraceAsString(),
207
-			) );
207
+			));
208 208
 		}
209
-		catch( \Exception $e )
209
+		catch (\Exception $e)
210 210
 		{
211 211
 			$status = 500;
212
-			$view->errors = array( array(
212
+			$view->errors = array(array(
213 213
 				'title' => $e->getMessage(),
214 214
 				'detail' => $e->getTraceAsString(),
215
-			) );
215
+			));
216 216
 		}
217 217
 
218 218
 		/** admin/jsonadm/standard/template-get
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 		$tplconf = 'admin/jsonadm/standard/template-get';
243 243
 		$default = 'get-default.php';
244 244
 
245
-		return $view->render( $view->config( $tplconf, $default ) );
245
+		return $view->render($view->config($tplconf, $default));
246 246
 	}
247 247
 
248 248
 
@@ -254,54 +254,54 @@  discard block
 block discarded – undo
254 254
 	 * @param integer &$status Variable which contains the HTTP status afterwards
255 255
 	 * @return string Content for response body
256 256
 	 */
257
-	public function patch( $body, array &$header, &$status )
257
+	public function patch($body, array &$header, &$status)
258 258
 	{
259
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
259
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
260 260
 		$context = $this->getContext();
261 261
 		$view = $this->getView();
262 262
 
263 263
 		try
264 264
 		{
265
-			if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) ) {
266
-				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 );
265
+			if (($request = json_decode($body)) === null || !isset($request->data)) {
266
+				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400);
267 267
 			}
268 268
 
269 269
 			$data = null;
270
-			$manager = \Aimeos\MShop\Factory::createManager( $context, $this->getPath() );
270
+			$manager = \Aimeos\MShop\Factory::createManager($context, $this->getPath());
271 271
 
272
-			if( is_array( $request->data ) )
272
+			if (is_array($request->data))
273 273
 			{
274 274
 				$data = array();
275 275
 
276
-				foreach( $request->data as $entry )
276
+				foreach ($request->data as $entry)
277 277
 				{
278
-					if( isset( $entry->attributes ) && isset( $entry->id ) )
278
+					if (isset($entry->attributes) && isset($entry->id))
279 279
 					{
280
-						$item = $manager->getItem( $entry->id );
281
-						$item->fromArray( (array) $entry->attributes );
280
+						$item = $manager->getItem($entry->id);
281
+						$item->fromArray((array) $entry->attributes);
282 282
 
283
-						$manager->saveItem( $item );
284
-						$data[] = $manager->getItem( $entry->id );
283
+						$manager->saveItem($item);
284
+						$data[] = $manager->getItem($entry->id);
285 285
 					}
286 286
 				}
287 287
 
288 288
 				$view->data = $data;
289
-				$view->total = count( $data );
289
+				$view->total = count($data);
290 290
 				$header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"';
291 291
 			}
292 292
 			else
293 293
 			{
294
-				if( ( $id = $view->param( 'id' ) ) == null ) {
295
-					throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 );
294
+				if (($id = $view->param('id')) == null) {
295
+					throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('No ID given'), 400);
296 296
 				}
297 297
 
298
-				if( isset( $request->data->attributes ) )
298
+				if (isset($request->data->attributes))
299 299
 				{
300
-					$item = $manager->getItem( $id );
301
-					$item->fromArray( (array) $request->data->attributes );
300
+					$item = $manager->getItem($id);
301
+					$item->fromArray((array) $request->data->attributes);
302 302
 
303
-					$manager->saveItem( $item );
304
-					$data = $manager->getItem( $id );
303
+					$manager->saveItem($item);
304
+					$data = $manager->getItem($id);
305 305
 				}
306 306
 
307 307
 				$view->data = $data;
@@ -310,37 +310,37 @@  discard block
 block discarded – undo
310 310
 
311 311
 			$status = 200;
312 312
 		}
313
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
313
+		catch (\Aimeos\Admin\JsonAdm\Exception $e)
314 314
 		{
315 315
 			$status = $e->getCode();
316
-			$view->errors = array( array(
317
-				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
316
+			$view->errors = array(array(
317
+				'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()),
318 318
 				'detail' => $e->getTraceAsString(),
319
-			) );
319
+			));
320 320
 		}
321
-		catch( \Aimeos\MAdmin\Exception $e )
321
+		catch (\Aimeos\MAdmin\Exception $e)
322 322
 		{
323 323
 			$status = 404;
324
-			$view->errors = array( array(
325
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
324
+			$view->errors = array(array(
325
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
326 326
 				'detail' => $e->getTraceAsString(),
327
-			) );
327
+			));
328 328
 		}
329
-		catch( \Aimeos\MShop\Exception $e )
329
+		catch (\Aimeos\MShop\Exception $e)
330 330
 		{
331 331
 			$status = 404;
332
-			$view->errors = array( array(
333
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
332
+			$view->errors = array(array(
333
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
334 334
 				'detail' => $e->getTraceAsString(),
335
-			) );
335
+			));
336 336
 		}
337
-		catch( \Aimeos\MW\Exception $e )
337
+		catch (\Aimeos\MW\Exception $e)
338 338
 		{
339 339
 			$status = 500;
340
-			$view->errors = array( array(
340
+			$view->errors = array(array(
341 341
 				'title' => $e->getMessage(),
342 342
 				'detail' => $e->getTraceAsString(),
343
-			) );
343
+			));
344 344
 		}
345 345
 
346 346
 		/** admin/jsonadm/standard/template-patch
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 		$tplconf = 'admin/jsonadm/standard/template-patch';
371 371
 		$default = 'patch-default.php';
372 372
 
373
-		return $view->render( $view->config( $tplconf, $default ) );
373
+		return $view->render($view->config($tplconf, $default));
374 374
 	}
375 375
 
376 376
 
@@ -382,54 +382,54 @@  discard block
 block discarded – undo
382 382
 	 * @param integer &$status Variable which contains the HTTP status afterwards
383 383
 	 * @return string Content for response body
384 384
 	 */
385
-	public function post( $body, array &$header, &$status )
385
+	public function post($body, array &$header, &$status)
386 386
 	{
387
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
387
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
388 388
 		$context = $this->getContext();
389 389
 		$view = $this->getView();
390 390
 
391 391
 		try
392 392
 		{
393
-			if( ( $request = json_decode( $body ) ) === null || !isset( $request->data ) ) {
394
-				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid JSON in body' ), 400 );
393
+			if (($request = json_decode($body)) === null || !isset($request->data)) {
394
+				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid JSON in body'), 400);
395 395
 			}
396 396
 
397
-			if( isset( $request->data->id ) || $view->param( 'id' ) != null ) {
398
-				throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Client generated IDs are not supported' ), 403 );
397
+			if (isset($request->data->id) || $view->param('id') != null) {
398
+				throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Client generated IDs are not supported'), 403);
399 399
 			}
400 400
 
401 401
 			$data = null;
402
-			$manager = \Aimeos\MShop\Factory::createManager( $context, $this->getPath() );
402
+			$manager = \Aimeos\MShop\Factory::createManager($context, $this->getPath());
403 403
 
404
-			if( is_array( $request->data ) )
404
+			if (is_array($request->data))
405 405
 			{
406 406
 				$data = array();
407 407
 
408
-				foreach( $request->data as $entry )
408
+				foreach ($request->data as $entry)
409 409
 				{
410
-					if( isset( $entry->attributes ) )
410
+					if (isset($entry->attributes))
411 411
 					{
412 412
 						$item = $manager->createItem();
413
-						$item->fromArray( (array) $entry->attributes );
413
+						$item->fromArray((array) $entry->attributes);
414 414
 
415
-						$manager->saveItem( $item );
416
-						$data[] = $manager->getItem( $item->getId() );
415
+						$manager->saveItem($item);
416
+						$data[] = $manager->getItem($item->getId());
417 417
 					}
418 418
 				}
419 419
 
420 420
 				$view->data = $data;
421
-				$view->total = count( $data );
421
+				$view->total = count($data);
422 422
 				$header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"';
423 423
 			}
424 424
 			else
425 425
 			{
426
-				if( isset( $request->data->attributes ) )
426
+				if (isset($request->data->attributes))
427 427
 				{
428 428
 					$item = $manager->createItem();
429
-					$item->fromArray( (array) $request->data->attributes );
429
+					$item->fromArray((array) $request->data->attributes);
430 430
 
431
-					$manager->saveItem( $item );
432
-					$data = $manager->getItem( $item->getId() );
431
+					$manager->saveItem($item);
432
+					$data = $manager->getItem($item->getId());
433 433
 				}
434 434
 
435 435
 				$view->data = $data;
@@ -438,37 +438,37 @@  discard block
 block discarded – undo
438 438
 
439 439
 			$status = 201;
440 440
 		}
441
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
441
+		catch (\Aimeos\Admin\JsonAdm\Exception $e)
442 442
 		{
443 443
 			$status = $e->getCode();
444
-			$view->errors = array( array(
445
-				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
444
+			$view->errors = array(array(
445
+				'title' => $context->getI18n()->dt('admin/jsonadm', $e->getMessage()),
446 446
 				'detail' => $e->getTraceAsString(),
447
-			) );
447
+			));
448 448
 		}
449
-		catch( \Aimeos\MAdmin\Exception $e )
449
+		catch (\Aimeos\MAdmin\Exception $e)
450 450
 		{
451 451
 			$status = 404;
452
-			$view->errors = array( array(
453
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
452
+			$view->errors = array(array(
453
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
454 454
 				'detail' => $e->getTraceAsString(),
455
-			) );
455
+			));
456 456
 		}
457
-		catch( \Aimeos\MShop\Exception $e )
457
+		catch (\Aimeos\MShop\Exception $e)
458 458
 		{
459 459
 			$status = 404;
460
-			$view->errors = array( array(
461
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
460
+			$view->errors = array(array(
461
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
462 462
 				'detail' => $e->getTraceAsString(),
463
-			) );
463
+			));
464 464
 		}
465
-		catch( \Exception $e )
465
+		catch (\Exception $e)
466 466
 		{
467 467
 			$status = 500;
468
-			$view->errors = array( array(
468
+			$view->errors = array(array(
469 469
 				'title' => $e->getMessage(),
470 470
 				'detail' => $e->getTraceAsString(),
471
-			) );
471
+			));
472 472
 		}
473 473
 
474 474
 		/** admin/jsonadm/standard/template-post
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 		$tplconf = 'admin/jsonadm/standard/template-post';
499 499
 		$default = 'post-default.php';
500 500
 
501
-		return $view->render( $view->config( $tplconf, $default ) );
501
+		return $view->render($view->config($tplconf, $default));
502 502
 	}
503 503
 
504 504
 
@@ -510,17 +510,17 @@  discard block
 block discarded – undo
510 510
 	 * @param integer &$status Variable which contains the HTTP status afterwards
511 511
 	 * @return string Content for response body
512 512
 	 */
513
-	public function put( $body, array &$header, &$status )
513
+	public function put($body, array &$header, &$status)
514 514
 	{
515
-		$header = array( 'Content-Type' => 'application/vnd.api+json; supported-ext="bulk"' );
515
+		$header = array('Content-Type' => 'application/vnd.api+json; supported-ext="bulk"');
516 516
 		$status = 501;
517 517
 
518 518
 		$context = $this->getContext();
519 519
 		$view = $this->getView();
520 520
 
521
-		$view->errors = array( array(
522
-			'title' => $context->getI18n()->dt( 'admin/jsonadm', 'Not implemented, use PATCH instead' ),
523
-		) );
521
+		$view->errors = array(array(
522
+			'title' => $context->getI18n()->dt('admin/jsonadm', 'Not implemented, use PATCH instead'),
523
+		));
524 524
 
525 525
 		/** admin/jsonadm/standard/template-put
526 526
 		 * Relative path to the JSON API template for PUT requests
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 		$tplconf = 'admin/jsonadm/standard/template-put';
550 550
 		$default = 'put-default.php';
551 551
 
552
-		return $view->render( $view->config( $tplconf, $default ) );
552
+		return $view->render($view->config($tplconf, $default));
553 553
 	}
554 554
 
555 555
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 	 * @param integer &$status Variable which contains the HTTP status afterwards
562 562
 	 * @return string Content for response body
563 563
 	 */
564
-	public function options( $body, array &$header, &$status )
564
+	public function options($body, array &$header, &$status)
565 565
 	{
566 566
 		$context = $this->getContext();
567 567
 		$view = $this->getView();
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 		{
571 571
 			$resources = $attributes = array();
572 572
 
573
-			if( ( $domains = $view->param( 'resource' ) ) == '' )
573
+			if (($domains = $view->param('resource')) == '')
574 574
 			{
575 575
 				/** admin/jsonadm/domains
576 576
 				 * A list of domain names whose clients are available for the JSON API
@@ -592,14 +592,14 @@  discard block
 block discarded – undo
592 592
 					'attribute', 'catalog', 'coupon', 'customer', 'locale', 'media',
593 593
 					'order', 'plugin', 'price', 'product', 'service', 'supplier', 'tag', 'text'
594 594
 				);
595
-				$domains = $context->getConfig()->get( 'admin/jsonadm/domains', $default );
595
+				$domains = $context->getConfig()->get('admin/jsonadm/domains', $default);
596 596
 			}
597 597
 
598
-			foreach( (array) $domains as $domain )
598
+			foreach ((array) $domains as $domain)
599 599
 			{
600
-				$manager = \Aimeos\MShop\Factory::createManager( $context, $domain );
601
-				$resources = array_merge( $resources, $manager->getResourceType( true ) );
602
-				$attributes = array_merge( $attributes, $manager->getSearchAttributes( true ) );
600
+				$manager = \Aimeos\MShop\Factory::createManager($context, $domain);
601
+				$resources = array_merge($resources, $manager->getResourceType(true));
602
+				$attributes = array_merge($attributes, $manager->getSearchAttributes(true));
603 603
 			}
604 604
 
605 605
 			$view->resources = $resources;
@@ -611,29 +611,29 @@  discard block
 block discarded – undo
611 611
 			);
612 612
 			$status = 200;
613 613
 		}
614
-		catch( \Aimeos\MAdmin\Exception $e )
614
+		catch (\Aimeos\MAdmin\Exception $e)
615 615
 		{
616 616
 			$status = 404;
617
-			$view->errors = array( array(
618
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
617
+			$view->errors = array(array(
618
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
619 619
 				'detail' => $e->getTraceAsString(),
620
-			) );
620
+			));
621 621
 		}
622
-		catch( \Aimeos\MShop\Exception $e )
622
+		catch (\Aimeos\MShop\Exception $e)
623 623
 		{
624 624
 			$status = 404;
625
-			$view->errors = array( array(
626
-				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
625
+			$view->errors = array(array(
626
+				'title' => $context->getI18n()->dt('mshop', $e->getMessage()),
627 627
 				'detail' => $e->getTraceAsString(),
628
-			) );
628
+			));
629 629
 		}
630
-		catch( \Exception $e )
630
+		catch (\Exception $e)
631 631
 		{
632 632
 			$status = 500;
633
-			$view->errors = array( array(
633
+			$view->errors = array(array(
634 634
 				'title' => $e->getMessage(),
635 635
 				'detail' => $e->getTraceAsString(),
636
-			) );
636
+			));
637 637
 		}
638 638
 
639 639
 		/** admin/jsonadm/standard/template-options
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 		$tplconf = 'admin/jsonadm/standard/template-options';
664 664
 		$default = 'options-default.php';
665 665
 
666
-		return $view->render( $view->config( $tplconf, $default ) );
666
+		return $view->render($view->config($tplconf, $default));
667 667
 	}
668 668
 
669 669
 
@@ -685,11 +685,11 @@  discard block
 block discarded – undo
685 685
 	 * @param array $params List of criteria data with condition, sorting and paging
686 686
 	 * @return \Aimeos\MW\Criteria\Iface Initialized criteria object
687 687
 	 */
688
-	protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params )
688
+	protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $params)
689 689
 	{
690
-		$this->initCriteriaConditions( $criteria, $params );
691
-		$this->initCriteriaSortations( $criteria, $params );
692
-		$this->initCriteriaSlice( $criteria, $params );
690
+		$this->initCriteriaConditions($criteria, $params);
691
+		$this->initCriteriaSortations($criteria, $params);
692
+		$this->initCriteriaSlice($criteria, $params);
693 693
 
694 694
 		return $criteria;
695 695
 	}
@@ -701,15 +701,15 @@  discard block
 block discarded – undo
701 701
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
702 702
 	 * @param array $params List of criteria data with condition, sorting and paging
703 703
 	 */
704
-	private function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params )
704
+	private function initCriteriaConditions(\Aimeos\MW\Criteria\Iface $criteria, array $params)
705 705
 	{
706
-		if( isset( $params['filter'] ) && is_array( $params['filter'] ) )
706
+		if (isset($params['filter']) && is_array($params['filter']))
707 707
 		{
708 708
 			$existing = $criteria->getConditions();
709
-			$criteria->setConditions( $criteria->toConditions( (array) $params['filter'] ) );
709
+			$criteria->setConditions($criteria->toConditions((array) $params['filter']));
710 710
 
711
-			$expr = array( $criteria->getConditions(), $existing );
712
-			$criteria->setConditions( $criteria->combine( '&&', $expr ) );
711
+			$expr = array($criteria->getConditions(), $existing);
712
+			$criteria->setConditions($criteria->combine('&&', $expr));
713 713
 		}
714 714
 	}
715 715
 
@@ -720,12 +720,12 @@  discard block
 block discarded – undo
720 720
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
721 721
 	 * @param array $params List of criteria data with condition, sorting and paging
722 722
 	 */
723
-	private function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params )
723
+	private function initCriteriaSlice(\Aimeos\MW\Criteria\Iface $criteria, array $params)
724 724
 	{
725
-		$start = ( isset( $params['page']['offset'] ) ? $params['page']['offset'] : 0 );
726
-		$size = ( isset( $params['page']['limit'] ) ? $params['page']['limit'] : 25 );
725
+		$start = (isset($params['page']['offset']) ? $params['page']['offset'] : 0);
726
+		$size = (isset($params['page']['limit']) ? $params['page']['limit'] : 25);
727 727
 
728
-		$criteria->setSlice( $start, $size );
728
+		$criteria->setSlice($start, $size);
729 729
 	}
730 730
 
731 731
 
@@ -735,24 +735,24 @@  discard block
 block discarded – undo
735 735
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
736 736
 	 * @param array $params List of criteria data with condition, sorting and paging
737 737
 	 */
738
-	private function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params )
738
+	private function initCriteriaSortations(\Aimeos\MW\Criteria\Iface $criteria, array $params)
739 739
 	{
740
-		if( !isset( $params['sort'] ) ) {
740
+		if (!isset($params['sort'])) {
741 741
 			return;
742 742
 		}
743 743
 
744 744
 		$sortation = array();
745 745
 
746
-		foreach( explode( ',', $params['sort'] ) as $sort )
746
+		foreach (explode(',', $params['sort']) as $sort)
747 747
 		{
748
-			if( $sort[0] === '-' ) {
749
-				$sortation[] = $criteria->sort( '-', substr( $sort, 1 ) );
748
+			if ($sort[0] === '-') {
749
+				$sortation[] = $criteria->sort('-', substr($sort, 1));
750 750
 			} else {
751
-				$sortation[] = $criteria->sort( '+', $sort ); break;
751
+				$sortation[] = $criteria->sort('+', $sort); break;
752 752
 			}
753 753
 		}
754 754
 
755
-		$criteria->setSortations( $sortation );
755
+		$criteria->setSortations($sortation);
756 756
 	}
757 757
 
758 758
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 	 * @param array $include List of resource types that should be fetched
764 764
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
765 765
 	 */
766
-	protected function getChildItems( array $items, array $include )
766
+	protected function getChildItems(array $items, array $include)
767 767
 	{
768 768
 		return array();
769 769
 	}
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 	 * @param array $include List of resource types that should be fetched
777 777
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
778 778
 	 */
779
-	protected function getListItems( array $items, array $include )
779
+	protected function getListItems(array $items, array $include)
780 780
 	{
781 781
 		return array();
782 782
 	}
@@ -788,22 +788,22 @@  discard block
 block discarded – undo
788 788
 	 * @param array $items List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
789 789
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
790 790
 	 */
791
-	protected function getRefItems( array $listItems )
791
+	protected function getRefItems(array $listItems)
792 792
 	{
793 793
 		$list = $map = array();
794 794
 
795
-		foreach( $listItems as $listItem ) {
795
+		foreach ($listItems as $listItem) {
796 796
 			$map[$listItem->getDomain()][] = $listItem->getRefId();
797 797
 		}
798 798
 
799
-		foreach( $map as $domain => $ids )
799
+		foreach ($map as $domain => $ids)
800 800
 		{
801
-			$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $domain );
801
+			$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $domain);
802 802
 
803 803
 			$search = $manager->createSearch();
804
-			$search->setConditions( $search->compare( '==', $domain . '.id', $ids ) );
804
+			$search->setConditions($search->compare('==', $domain . '.id', $ids));
805 805
 
806
-			$list = array_merge( $list, $manager->searchItems( $search ) );
806
+			$list = array_merge($list, $manager->searchItems($search));
807 807
 		}
808 808
 
809 809
 		return $list;
Please login to merge, or discard this patch.
Braces   +22 added lines, -44 removed lines patch added patch discarded remove patch
@@ -78,40 +78,35 @@  discard block
 block discarded – undo
78 78
 
79 79
 				$manager->deleteItems( $ids );
80 80
 				$view->total = count( $ids );
81
-			}
82
-			else
81
+			} else
83 82
 			{
84 83
 				$manager->deleteItem( $id );
85 84
 				$view->total = 1;
86 85
 			}
87 86
 
88 87
 			$status = 200;
89
-		}
90
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
88
+		} catch( \Aimeos\Admin\JsonAdm\Exception $e )
91 89
 		{
92 90
 			$status = $e->getCode();
93 91
 			$view->errors = array( array(
94 92
 				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
95 93
 				'detail' => $e->getTraceAsString(),
96 94
 			) );
97
-		}
98
-		catch( \Aimeos\MAdmin\Exception $e )
95
+		} catch( \Aimeos\MAdmin\Exception $e )
99 96
 		{
100 97
 			$status = 404;
101 98
 			$view->errors = array( array(
102 99
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
103 100
 				'detail' => $e->getTraceAsString(),
104 101
 			) );
105
-		}
106
-		catch( \Aimeos\MShop\Exception $e )
102
+		} catch( \Aimeos\MShop\Exception $e )
107 103
 		{
108 104
 			$status = 404;
109 105
 			$view->errors = array( array(
110 106
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
111 107
 				'detail' => $e->getTraceAsString(),
112 108
 			) );
113
-		}
114
-		catch( \Exception $e )
109
+		} catch( \Exception $e )
115 110
 		{
116 111
 			$status = 500;
117 112
 			$view->errors = array( array(
@@ -177,8 +172,7 @@  discard block
 block discarded – undo
177 172
 				$view->data = $manager->searchItems( $search, array(), $total );
178 173
 				$view->childItems = $this->getChildItems( $view->data, $include );
179 174
 				$view->listItems = $this->getListItems( $view->data, $include );
180
-			}
181
-			else
175
+			} else
182 176
 			{
183 177
 				$view->data = $manager->getItem( $id, array() );
184 178
 				$view->childItems = $this->getChildItems( array( $id => $view->data ), $include );
@@ -189,24 +183,21 @@  discard block
 block discarded – undo
189 183
 
190 184
 			$view->total = $total;
191 185
 			$status = 200;
192
-		}
193
-		catch( \Aimeos\MAdmin\Exception $e )
186
+		} catch( \Aimeos\MAdmin\Exception $e )
194 187
 		{
195 188
 			$status = 404;
196 189
 			$view->errors = array( array(
197 190
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
198 191
 				'detail' => $e->getTraceAsString(),
199 192
 			) );
200
-		}
201
-		catch( \Aimeos\MShop\Exception $e )
193
+		} catch( \Aimeos\MShop\Exception $e )
202 194
 		{
203 195
 			$status = 404;
204 196
 			$view->errors = array( array(
205 197
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
206 198
 				'detail' => $e->getTraceAsString(),
207 199
 			) );
208
-		}
209
-		catch( \Exception $e )
200
+		} catch( \Exception $e )
210 201
 		{
211 202
 			$status = 500;
212 203
 			$view->errors = array( array(
@@ -288,8 +279,7 @@  discard block
 block discarded – undo
288 279
 				$view->data = $data;
289 280
 				$view->total = count( $data );
290 281
 				$header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"';
291
-			}
292
-			else
282
+			} else
293 283
 			{
294 284
 				if( ( $id = $view->param( 'id' ) ) == null ) {
295 285
 					throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 );
@@ -309,32 +299,28 @@  discard block
 block discarded – undo
309 299
 			}
310 300
 
311 301
 			$status = 200;
312
-		}
313
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
302
+		} catch( \Aimeos\Admin\JsonAdm\Exception $e )
314 303
 		{
315 304
 			$status = $e->getCode();
316 305
 			$view->errors = array( array(
317 306
 				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
318 307
 				'detail' => $e->getTraceAsString(),
319 308
 			) );
320
-		}
321
-		catch( \Aimeos\MAdmin\Exception $e )
309
+		} catch( \Aimeos\MAdmin\Exception $e )
322 310
 		{
323 311
 			$status = 404;
324 312
 			$view->errors = array( array(
325 313
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
326 314
 				'detail' => $e->getTraceAsString(),
327 315
 			) );
328
-		}
329
-		catch( \Aimeos\MShop\Exception $e )
316
+		} catch( \Aimeos\MShop\Exception $e )
330 317
 		{
331 318
 			$status = 404;
332 319
 			$view->errors = array( array(
333 320
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
334 321
 				'detail' => $e->getTraceAsString(),
335 322
 			) );
336
-		}
337
-		catch( \Aimeos\MW\Exception $e )
323
+		} catch( \Aimeos\MW\Exception $e )
338 324
 		{
339 325
 			$status = 500;
340 326
 			$view->errors = array( array(
@@ -420,8 +406,7 @@  discard block
 block discarded – undo
420 406
 				$view->data = $data;
421 407
 				$view->total = count( $data );
422 408
 				$header['Content-Type'] = 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"';
423
-			}
424
-			else
409
+			} else
425 410
 			{
426 411
 				if( isset( $request->data->attributes ) )
427 412
 				{
@@ -437,32 +422,28 @@  discard block
 block discarded – undo
437 422
 			}
438 423
 
439 424
 			$status = 201;
440
-		}
441
-		catch( \Aimeos\Admin\JsonAdm\Exception $e )
425
+		} catch( \Aimeos\Admin\JsonAdm\Exception $e )
442 426
 		{
443 427
 			$status = $e->getCode();
444 428
 			$view->errors = array( array(
445 429
 				'title' => $context->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ),
446 430
 				'detail' => $e->getTraceAsString(),
447 431
 			) );
448
-		}
449
-		catch( \Aimeos\MAdmin\Exception $e )
432
+		} catch( \Aimeos\MAdmin\Exception $e )
450 433
 		{
451 434
 			$status = 404;
452 435
 			$view->errors = array( array(
453 436
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
454 437
 				'detail' => $e->getTraceAsString(),
455 438
 			) );
456
-		}
457
-		catch( \Aimeos\MShop\Exception $e )
439
+		} catch( \Aimeos\MShop\Exception $e )
458 440
 		{
459 441
 			$status = 404;
460 442
 			$view->errors = array( array(
461 443
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
462 444
 				'detail' => $e->getTraceAsString(),
463 445
 			) );
464
-		}
465
-		catch( \Exception $e )
446
+		} catch( \Exception $e )
466 447
 		{
467 448
 			$status = 500;
468 449
 			$view->errors = array( array(
@@ -610,24 +591,21 @@  discard block
 block discarded – undo
610 591
 				'Allow' => 'DELETE,GET,POST,OPTIONS'
611 592
 			);
612 593
 			$status = 200;
613
-		}
614
-		catch( \Aimeos\MAdmin\Exception $e )
594
+		} catch( \Aimeos\MAdmin\Exception $e )
615 595
 		{
616 596
 			$status = 404;
617 597
 			$view->errors = array( array(
618 598
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
619 599
 				'detail' => $e->getTraceAsString(),
620 600
 			) );
621
-		}
622
-		catch( \Aimeos\MShop\Exception $e )
601
+		} catch( \Aimeos\MShop\Exception $e )
623 602
 		{
624 603
 			$status = 404;
625 604
 			$view->errors = array( array(
626 605
 				'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ),
627 606
 				'detail' => $e->getTraceAsString(),
628 607
 			) );
629
-		}
630
-		catch( \Exception $e )
608
+		} catch( \Exception $e )
631 609
 		{
632 610
 			$status = 500;
633 611
 			$view->errors = array( array(
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Product/StandardTest.php 1 patch
Spacing   +30 added lines, -30 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\Product\Standard( $this->context, $this->view, $templatePaths, 'product' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Product\Standard($this->context, $this->view, $templatePaths, 'product');
26 26
 	}
27 27
 
28 28
 
@@ -30,29 +30,29 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'product.code' => 'CNE' )
33
+				'==' => array('product.code' => 'CNE')
34 34
 			),
35 35
 			'include' => 'text,product,product/property,product/stock'
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 40
 		$header = array();
41 41
 		$status = 500;
42 42
 
43
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
44
-
45
-		$this->assertEquals( 200, $status );
46
-		$this->assertEquals( 1, count( $header ) );
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
50
-		$this->assertEquals( 6, count( $result['data'][0]['relationships']['text'] ) );
51
-		$this->assertEquals( 5, count( $result['data'][0]['relationships']['product'] ) );
52
-		$this->assertEquals( 4, count( $result['data'][0]['relationships']['product/property'] ) );
53
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['product/stock'] ) );
54
-		$this->assertEquals( 15, count( $result['included'] ) );
55
-		$this->assertArrayNotHasKey( 'errors', $result );
43
+		$result = json_decode($this->object->get('', $header, $status), true);
44
+
45
+		$this->assertEquals(200, $status);
46
+		$this->assertEquals(1, count($header));
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('product', $result['data'][0]['type']);
50
+		$this->assertEquals(6, count($result['data'][0]['relationships']['text']));
51
+		$this->assertEquals(5, count($result['data'][0]['relationships']['product']));
52
+		$this->assertEquals(4, count($result['data'][0]['relationships']['product/property']));
53
+		$this->assertEquals(1, count($result['data'][0]['relationships']['product/stock']));
54
+		$this->assertEquals(15, count($result['included']));
55
+		$this->assertArrayNotHasKey('errors', $result);
56 56
 	}
57 57
 
58 58
 
@@ -65,22 +65,22 @@  discard block
 block discarded – undo
65 65
 			'sort' => 'product.id',
66 66
 			'include' => 'product,product/stock'
67 67
 		);
68
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
69
-		$this->view->addHelper( 'param', $helper );
68
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
69
+		$this->view->addHelper('param', $helper);
70 70
 
71 71
 		$header = array();
72 72
 		$status = 500;
73 73
 
74
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
75
-
76
-		$this->assertEquals( 200, $status );
77
-		$this->assertEquals( 1, count( $header ) );
78
-		$this->assertEquals( 28, $result['meta']['total'] );
79
-		$this->assertEquals( 25, count( $result['data'] ) );
80
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
81
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
82
-		$this->assertEquals( 5, count( $result['data'][0]['relationships']['product'] ) );
83
-		$this->assertEquals( 27, count( $result['included'] ) );
84
-		$this->assertArrayNotHasKey( 'errors', $result );
74
+		$result = json_decode($this->object->get('', $header, $status), true);
75
+
76
+		$this->assertEquals(200, $status);
77
+		$this->assertEquals(1, count($header));
78
+		$this->assertEquals(28, $result['meta']['total']);
79
+		$this->assertEquals(25, count($result['data']));
80
+		$this->assertEquals('product', $result['data'][0]['type']);
81
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
82
+		$this->assertEquals(5, count($result['data'][0]['relationships']['product']));
83
+		$this->assertEquals(27, count($result['included']));
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/StandardTest.php 1 patch
Spacing   +246 added lines, -246 removed lines patch added patch discarded remove patch
@@ -22,70 +22,70 @@  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
 
29 29
 	public function testDelete()
30 30
 	{
31 31
 		$name = 'ClientJsonAdmStandard';
32
-		$this->context->getConfig()->set( 'mshop/product/manager/name', $name );
32
+		$this->context->getConfig()->set('mshop/product/manager/name', $name);
33 33
 
34
-		$productManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' )
35
-			->setMethods( array( 'deleteItem' ) )
36
-			->setConstructorArgs( array( $this->context ) )
34
+		$productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')
35
+			->setMethods(array('deleteItem'))
36
+			->setConstructorArgs(array($this->context))
37 37
 			->getMock();
38 38
 
39
-		\Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub );
39
+		\Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub);
40 40
 
41
-		$productManagerStub->expects( $this->once() )->method( 'deleteItem' );
41
+		$productManagerStub->expects($this->once())->method('deleteItem');
42 42
 
43 43
 
44
-		$params = array( 'id' => $this->getProductItem()->getId() );
45
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
46
-		$this->view->addHelper( 'param', $helper );
44
+		$params = array('id' => $this->getProductItem()->getId());
45
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
46
+		$this->view->addHelper('param', $helper);
47 47
 
48 48
 		$header = array();
49 49
 		$status = 500;
50 50
 
51
-		$result = json_decode( $this->object->delete( '', $header, $status ), true );
51
+		$result = json_decode($this->object->delete('', $header, $status), true);
52 52
 
53
-		$this->assertEquals( 200, $status );
54
-		$this->assertEquals( 1, count( $header ) );
55
-		$this->assertEquals( 1, $result['meta']['total'] );
56
-		$this->assertArrayNotHasKey( 'included', $result );
57
-		$this->assertArrayNotHasKey( 'data', $result );
58
-		$this->assertArrayNotHasKey( 'errors', $result );
53
+		$this->assertEquals(200, $status);
54
+		$this->assertEquals(1, count($header));
55
+		$this->assertEquals(1, $result['meta']['total']);
56
+		$this->assertArrayNotHasKey('included', $result);
57
+		$this->assertArrayNotHasKey('data', $result);
58
+		$this->assertArrayNotHasKey('errors', $result);
59 59
 	}
60 60
 
61 61
 
62 62
 	public function testDeleteBulk()
63 63
 	{
64 64
 		$name = 'ClientJsonAdmStandard';
65
-		$this->context->getConfig()->set( 'mshop/product/manager/name', $name );
65
+		$this->context->getConfig()->set('mshop/product/manager/name', $name);
66 66
 
67
-		$productManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' )
68
-			->setMethods( array( 'deleteItems' ) )
69
-			->setConstructorArgs( array( $this->context ) )
67
+		$productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')
68
+			->setMethods(array('deleteItems'))
69
+			->setConstructorArgs(array($this->context))
70 70
 			->getMock();
71 71
 
72
-		\Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub );
72
+		\Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub);
73 73
 
74
-		$productManagerStub->expects( $this->once() )->method( 'deleteItems' );
74
+		$productManagerStub->expects($this->once())->method('deleteItems');
75 75
 
76 76
 
77 77
 		$body = '{"data":[{"type": "product", "id": "-1"},{"type": "product", "id": "-2"}]}';
78 78
 		$header = array();
79 79
 		$status = 500;
80 80
 
81
-		$result = json_decode( $this->object->delete( $body, $header, $status ), true );
81
+		$result = json_decode($this->object->delete($body, $header, $status), true);
82 82
 
83
-		$this->assertEquals( 200, $status );
84
-		$this->assertEquals( 1, count( $header ) );
85
-		$this->assertEquals( 2, $result['meta']['total'] );
86
-		$this->assertArrayNotHasKey( 'included', $result );
87
-		$this->assertArrayNotHasKey( 'data', $result );
88
-		$this->assertArrayNotHasKey( 'errors', $result );
83
+		$this->assertEquals(200, $status);
84
+		$this->assertEquals(1, count($header));
85
+		$this->assertEquals(2, $result['meta']['total']);
86
+		$this->assertArrayNotHasKey('included', $result);
87
+		$this->assertArrayNotHasKey('data', $result);
88
+		$this->assertArrayNotHasKey('errors', $result);
89 89
 	}
90 90
 
91 91
 
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
 		$header = array();
96 96
 		$status = 500;
97 97
 
98
-		$result = json_decode( $this->object->delete( $body, $header, $status ), true );
98
+		$result = json_decode($this->object->delete($body, $header, $status), true);
99 99
 
100
-		$this->assertEquals( 400, $status );
101
-		$this->assertEquals( 1, count( $header ) );
102
-		$this->assertEquals( 0, $result['meta']['total'] );
103
-		$this->assertArrayHasKey( 'errors', $result );
104
-		$this->assertArrayNotHasKey( 'included', $result );
105
-		$this->assertArrayNotHasKey( 'data', $result );
100
+		$this->assertEquals(400, $status);
101
+		$this->assertEquals(1, count($header));
102
+		$this->assertEquals(0, $result['meta']['total']);
103
+		$this->assertArrayHasKey('errors', $result);
104
+		$this->assertArrayNotHasKey('included', $result);
105
+		$this->assertArrayNotHasKey('data', $result);
106 106
 	}
107 107
 
108 108
 
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 		$header = array();
112 112
 		$status = 500;
113 113
 
114
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
115
-
116
-		$this->assertEquals( 200, $status );
117
-		$this->assertEquals( 1, count( $header ) );
118
-		$this->assertEquals( 28, $result['meta']['total'] );
119
-		$this->assertEquals( 25, count( $result['data'] ) );
120
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
121
-		$this->assertEquals( 0, count( $result['included'] ) );
122
-		$this->assertArrayHasKey( 'next', $result['links'] );
123
-		$this->assertArrayHasKey( 'last', $result['links'] );
124
-		$this->assertArrayHasKey( 'self', $result['links'] );
125
-		$this->assertArrayNotHasKey( 'errors', $result );
114
+		$result = json_decode($this->object->get('', $header, $status), true);
115
+
116
+		$this->assertEquals(200, $status);
117
+		$this->assertEquals(1, count($header));
118
+		$this->assertEquals(28, $result['meta']['total']);
119
+		$this->assertEquals(25, count($result['data']));
120
+		$this->assertEquals('product', $result['data'][0]['type']);
121
+		$this->assertEquals(0, count($result['included']));
122
+		$this->assertArrayHasKey('next', $result['links']);
123
+		$this->assertArrayHasKey('last', $result['links']);
124
+		$this->assertArrayHasKey('self', $result['links']);
125
+		$this->assertArrayNotHasKey('errors', $result);
126 126
 	}
127 127
 
128 128
 
@@ -132,17 +132,17 @@  discard block
 block discarded – undo
132 132
 		$status = 500;
133 133
 
134 134
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
135
-		$object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'product/stock/warehouse' );
135
+		$object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'product/stock/warehouse');
136 136
 
137
-		$result = json_decode( $object->get( '', $header, $status ), true );
137
+		$result = json_decode($object->get('', $header, $status), true);
138 138
 
139
-		$this->assertEquals( 200, $status );
140
-		$this->assertEquals( 1, count( $header ) );
141
-		$this->assertEquals( 6, $result['meta']['total'] );
142
-		$this->assertEquals( 6, count( $result['data'] ) );
143
-		$this->assertEquals( 'product/stock/warehouse', $result['data'][0]['type'] );
144
-		$this->assertEquals( 0, count( $result['included'] ) );
145
-		$this->assertArrayNotHasKey( 'errors', $result );
139
+		$this->assertEquals(200, $status);
140
+		$this->assertEquals(1, count($header));
141
+		$this->assertEquals(6, $result['meta']['total']);
142
+		$this->assertEquals(6, count($result['data']));
143
+		$this->assertEquals('product/stock/warehouse', $result['data'][0]['type']);
144
+		$this->assertEquals(0, count($result['included']));
145
+		$this->assertArrayNotHasKey('errors', $result);
146 146
 	}
147 147
 
148 148
 
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
 		$status = 500;
153 153
 
154 154
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
155
-		$object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, $this->view, $templatePaths, 'invalid' );
155
+		$object = new \Aimeos\Admin\JsonAdm\Standard($this->context, $this->view, $templatePaths, 'invalid');
156 156
 
157
-		$result = json_decode( $object->get( '', $header, $status ), true );
157
+		$result = json_decode($object->get('', $header, $status), true);
158 158
 
159
-		$this->assertEquals( 404, $status );
160
-		$this->assertEquals( 1, count( $header ) );
161
-		$this->assertEquals( 1, count( $result['errors'] ) );
162
-		$this->assertArrayHasKey( 'title', $result['errors'][0] );
163
-		$this->assertArrayHasKey( 'detail', $result['errors'][0] );
164
-		$this->assertArrayNotHasKey( 'data', $result );
165
-		$this->assertArrayNotHasKey( 'indluded', $result );
159
+		$this->assertEquals(404, $status);
160
+		$this->assertEquals(1, count($header));
161
+		$this->assertEquals(1, count($result['errors']));
162
+		$this->assertArrayHasKey('title', $result['errors'][0]);
163
+		$this->assertArrayHasKey('detail', $result['errors'][0]);
164
+		$this->assertArrayNotHasKey('data', $result);
165
+		$this->assertArrayNotHasKey('indluded', $result);
166 166
 	}
167 167
 
168 168
 
@@ -170,24 +170,24 @@  discard block
 block discarded – undo
170 170
 	{
171 171
 		$params = array(
172 172
 			'filter' => array(
173
-				'==' => array( 'product.type.code' => 'select' )
173
+				'==' => array('product.type.code' => 'select')
174 174
 			)
175 175
 		);
176
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
177
-		$this->view->addHelper( 'param', $helper );
176
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
177
+		$this->view->addHelper('param', $helper);
178 178
 
179 179
 		$header = array();
180 180
 		$status = 500;
181 181
 
182
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
182
+		$result = json_decode($this->object->get('', $header, $status), true);
183 183
 
184
-		$this->assertEquals( 200, $status );
185
-		$this->assertEquals( 1, count( $header ) );
186
-		$this->assertEquals( 3, $result['meta']['total'] );
187
-		$this->assertEquals( 3, count( $result['data'] ) );
188
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
189
-		$this->assertEquals( 0, count( $result['included'] ) );
190
-		$this->assertArrayNotHasKey( 'errors', $result );
184
+		$this->assertEquals(200, $status);
185
+		$this->assertEquals(1, count($header));
186
+		$this->assertEquals(3, $result['meta']['total']);
187
+		$this->assertEquals(3, count($result['data']));
188
+		$this->assertEquals('product', $result['data'][0]['type']);
189
+		$this->assertEquals(0, count($result['included']));
190
+		$this->assertArrayNotHasKey('errors', $result);
191 191
 	}
192 192
 
193 193
 
@@ -196,26 +196,26 @@  discard block
 block discarded – undo
196 196
 		$params = array(
197 197
 			'filter' => array(
198 198
 				'&&' => array(
199
-					array( '=~' => array( 'product.label' => 'Unittest: Test' ) ),
200
-					array( '==' => array( 'product.type.code' => 'select' ) ),
199
+					array('=~' => array('product.label' => 'Unittest: Test')),
200
+					array('==' => array('product.type.code' => 'select')),
201 201
 				)
202 202
 			)
203 203
 		);
204
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
205
-		$this->view->addHelper( 'param', $helper );
204
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
205
+		$this->view->addHelper('param', $helper);
206 206
 
207 207
 		$header = array();
208 208
 		$status = 500;
209 209
 
210
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
210
+		$result = json_decode($this->object->get('', $header, $status), true);
211 211
 
212
-		$this->assertEquals( 200, $status );
213
-		$this->assertEquals( 1, count( $header ) );
214
-		$this->assertEquals( 2, $result['meta']['total'] );
215
-		$this->assertEquals( 2, count( $result['data'] ) );
216
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
217
-		$this->assertEquals( 0, count( $result['included'] ) );
218
-		$this->assertArrayNotHasKey( 'errors', $result );
212
+		$this->assertEquals(200, $status);
213
+		$this->assertEquals(1, count($header));
214
+		$this->assertEquals(2, $result['meta']['total']);
215
+		$this->assertEquals(2, count($result['data']));
216
+		$this->assertEquals('product', $result['data'][0]['type']);
217
+		$this->assertEquals(0, count($result['included']));
218
+		$this->assertArrayNotHasKey('errors', $result);
219 219
 	}
220 220
 
221 221
 
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 				'limit' => 25
228 228
 			)
229 229
 		);
230
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
231
-		$this->view->addHelper( 'param', $helper );
230
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
231
+		$this->view->addHelper('param', $helper);
232 232
 
233 233
 		$header = array();
234 234
 		$status = 500;
235 235
 
236
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
237
-
238
-		$this->assertEquals( 200, $status );
239
-		$this->assertEquals( 1, count( $header ) );
240
-		$this->assertEquals( 28, $result['meta']['total'] );
241
-		$this->assertEquals( 3, count( $result['data'] ) );
242
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
243
-		$this->assertEquals( 0, count( $result['included'] ) );
244
-		$this->assertArrayHasKey( 'first', $result['links'] );
245
-		$this->assertArrayHasKey( 'prev', $result['links'] );
246
-		$this->assertArrayHasKey( 'self', $result['links'] );
247
-		$this->assertArrayNotHasKey( 'errors', $result );
236
+		$result = json_decode($this->object->get('', $header, $status), true);
237
+
238
+		$this->assertEquals(200, $status);
239
+		$this->assertEquals(1, count($header));
240
+		$this->assertEquals(28, $result['meta']['total']);
241
+		$this->assertEquals(3, count($result['data']));
242
+		$this->assertEquals('product', $result['data'][0]['type']);
243
+		$this->assertEquals(0, count($result['included']));
244
+		$this->assertArrayHasKey('first', $result['links']);
245
+		$this->assertArrayHasKey('prev', $result['links']);
246
+		$this->assertArrayHasKey('self', $result['links']);
247
+		$this->assertArrayNotHasKey('errors', $result);
248 248
 	}
249 249
 
250 250
 
@@ -253,23 +253,23 @@  discard block
 block discarded – undo
253 253
 		$params = array(
254 254
 			'sort' => 'product.label,-product.code'
255 255
 		);
256
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
257
-		$this->view->addHelper( 'param', $helper );
256
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
257
+		$this->view->addHelper('param', $helper);
258 258
 
259 259
 		$header = array();
260 260
 		$status = 500;
261 261
 
262
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
263
-
264
-		$this->assertEquals( 200, $status );
265
-		$this->assertEquals( 1, count( $header ) );
266
-		$this->assertEquals( 28, $result['meta']['total'] );
267
-		$this->assertEquals( 25, count( $result['data'] ) );
268
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
269
-		$this->assertEquals( 'ABCD', $result['data'][0]['attributes']['product.code'] );
270
-		$this->assertEquals( '16 discs', $result['data'][0]['attributes']['product.label'] );
271
-		$this->assertEquals( 0, count( $result['included'] ) );
272
-		$this->assertArrayNotHasKey( 'errors', $result );
262
+		$result = json_decode($this->object->get('', $header, $status), true);
263
+
264
+		$this->assertEquals(200, $status);
265
+		$this->assertEquals(1, count($header));
266
+		$this->assertEquals(28, $result['meta']['total']);
267
+		$this->assertEquals(25, count($result['data']));
268
+		$this->assertEquals('product', $result['data'][0]['type']);
269
+		$this->assertEquals('ABCD', $result['data'][0]['attributes']['product.code']);
270
+		$this->assertEquals('16 discs', $result['data'][0]['attributes']['product.label']);
271
+		$this->assertEquals(0, count($result['included']));
272
+		$this->assertArrayNotHasKey('errors', $result);
273 273
 	}
274 274
 
275 275
 
@@ -282,104 +282,104 @@  discard block
 block discarded – undo
282 282
 			'sort' => 'product.id',
283 283
 			'include' => 'product'
284 284
 		);
285
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
286
-		$this->view->addHelper( 'param', $helper );
285
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
286
+		$this->view->addHelper('param', $helper);
287 287
 
288 288
 		$header = array();
289 289
 		$status = 500;
290 290
 
291
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
291
+		$result = json_decode($this->object->get('', $header, $status), true);
292 292
 
293
-		$this->assertEquals( 200, $status );
294
-		$this->assertEquals( 1, count( $header ) );
295
-		$this->assertEquals( 28, $result['meta']['total'] );
296
-		$this->assertEquals( 25, count( $result['data'] ) );
297
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
298
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
299
-		$this->assertArrayNotHasKey( 'errors', $result );
293
+		$this->assertEquals(200, $status);
294
+		$this->assertEquals(1, count($header));
295
+		$this->assertEquals(28, $result['meta']['total']);
296
+		$this->assertEquals(25, count($result['data']));
297
+		$this->assertEquals('product', $result['data'][0]['type']);
298
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
299
+		$this->assertArrayNotHasKey('errors', $result);
300 300
 	}
301 301
 
302 302
 
303 303
 	public function testPatch()
304 304
 	{
305 305
 		$name = 'ClientJsonAdmStandard';
306
-		$this->context->getConfig()->set( 'mshop/product/manager/name', $name );
306
+		$this->context->getConfig()->set('mshop/product/manager/name', $name);
307 307
 
308
-		$productManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' )
309
-			->setMethods( array( 'getItem', 'saveItem' ) )
310
-			->setConstructorArgs( array( $this->context ) )
308
+		$productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')
309
+			->setMethods(array('getItem', 'saveItem'))
310
+			->setConstructorArgs(array($this->context))
311 311
 			->getMock();
312 312
 
313
-		\Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub );
313
+		\Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub);
314 314
 
315 315
 		$item = $productManagerStub->createItem();
316
-		$item->setLabel( 'test' );
317
-		$item->setId( '-1' );
316
+		$item->setLabel('test');
317
+		$item->setId('-1');
318 318
 
319
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' );
320
-		$productManagerStub->expects( $this->exactly( 3 ) )->method( 'getItem' ) // 3x due to decorator
321
-			->will( $this->returnValue( $item ) );
319
+		$productManagerStub->expects($this->once())->method('saveItem');
320
+		$productManagerStub->expects($this->exactly(3))->method('getItem') // 3x due to decorator
321
+			->will($this->returnValue($item));
322 322
 
323 323
 
324
-		$params = array( 'id' => '-1' );
325
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
326
-		$this->view->addHelper( 'param', $helper );
324
+		$params = array('id' => '-1');
325
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
326
+		$this->view->addHelper('param', $helper);
327 327
 
328 328
 		$body = '{"data": {"type": "product", "attributes": {"product.label": "test"}}}';
329 329
 		$header = array();
330 330
 		$status = 500;
331 331
 
332
-		$result = json_decode( $this->object->patch( $body, $header, $status ), true );
333
-
334
-		$this->assertEquals( 200, $status );
335
-		$this->assertEquals( 1, count( $header ) );
336
-		$this->assertEquals( 1, $result['meta']['total'] );
337
-		$this->assertArrayHasKey( 'data', $result );
338
-		$this->assertEquals( '-1', $result['data']['id'] );
339
-		$this->assertEquals( 'product', $result['data']['type'] );
340
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
341
-		$this->assertArrayNotHasKey( 'included', $result );
342
-		$this->assertArrayNotHasKey( 'errors', $result );
332
+		$result = json_decode($this->object->patch($body, $header, $status), true);
333
+
334
+		$this->assertEquals(200, $status);
335
+		$this->assertEquals(1, count($header));
336
+		$this->assertEquals(1, $result['meta']['total']);
337
+		$this->assertArrayHasKey('data', $result);
338
+		$this->assertEquals('-1', $result['data']['id']);
339
+		$this->assertEquals('product', $result['data']['type']);
340
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
341
+		$this->assertArrayNotHasKey('included', $result);
342
+		$this->assertArrayNotHasKey('errors', $result);
343 343
 	}
344 344
 
345 345
 
346 346
 	public function testPatchBulk()
347 347
 	{
348 348
 		$name = 'ClientJsonAdmStandard';
349
-		$this->context->getConfig()->set( 'mshop/product/manager/name', $name );
349
+		$this->context->getConfig()->set('mshop/product/manager/name', $name);
350 350
 
351
-		$productManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' )
352
-			->setMethods( array( 'getItem', 'saveItem' ) )
353
-			->setConstructorArgs( array( $this->context ) )
351
+		$productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')
352
+			->setMethods(array('getItem', 'saveItem'))
353
+			->setConstructorArgs(array($this->context))
354 354
 			->getMock();
355 355
 
356
-		\Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub );
356
+		\Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub);
357 357
 
358 358
 		$item = $productManagerStub->createItem();
359
-		$item->setLabel( 'test' );
360
-		$item->setId( '-1' );
359
+		$item->setLabel('test');
360
+		$item->setId('-1');
361 361
 
362
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' );
363
-		$productManagerStub->expects( $this->exactly( 6 ) )->method( 'getItem' ) // 6x due to decorator
364
-			->will( $this->returnValue( $item ) );
362
+		$productManagerStub->expects($this->exactly(2))->method('saveItem');
363
+		$productManagerStub->expects($this->exactly(6))->method('getItem') // 6x due to decorator
364
+			->will($this->returnValue($item));
365 365
 
366 366
 
367 367
 		$body = '{"data": [{"id": "-1", "type": "product", "attributes": {"product.label": "test"}}, {"id": "-1", "type": "product", "attributes": {"product.label": "test"}}]}';
368 368
 		$header = array();
369 369
 		$status = 500;
370 370
 
371
-		$result = json_decode( $this->object->patch( $body, $header, $status ), true );
372
-
373
-		$this->assertEquals( 200, $status );
374
-		$this->assertEquals( 1, count( $header ) );
375
-		$this->assertEquals( 2, $result['meta']['total'] );
376
-		$this->assertArrayHasKey( 'data', $result );
377
-		$this->assertEquals( 2, count( $result['data'] ) );
378
-		$this->assertEquals( '-1', $result['data'][0]['id'] );
379
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
380
-		$this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] );
381
-		$this->assertArrayNotHasKey( 'included', $result );
382
-		$this->assertArrayNotHasKey( 'errors', $result );
371
+		$result = json_decode($this->object->patch($body, $header, $status), true);
372
+
373
+		$this->assertEquals(200, $status);
374
+		$this->assertEquals(1, count($header));
375
+		$this->assertEquals(2, $result['meta']['total']);
376
+		$this->assertArrayHasKey('data', $result);
377
+		$this->assertEquals(2, count($result['data']));
378
+		$this->assertEquals('-1', $result['data'][0]['id']);
379
+		$this->assertEquals('product', $result['data'][0]['type']);
380
+		$this->assertEquals('test', $result['data'][0]['attributes']['product.label']);
381
+		$this->assertArrayNotHasKey('included', $result);
382
+		$this->assertArrayNotHasKey('errors', $result);
383 383
 	}
384 384
 
385 385
 
@@ -389,93 +389,93 @@  discard block
 block discarded – undo
389 389
 		$header = array();
390 390
 		$status = 500;
391 391
 
392
-		$result = json_decode( $this->object->patch( $body, $header, $status ), true );
392
+		$result = json_decode($this->object->patch($body, $header, $status), true);
393 393
 
394
-		$this->assertEquals( 400, $status );
395
-		$this->assertEquals( 1, count( $header ) );
396
-		$this->assertEquals( 0, $result['meta']['total'] );
397
-		$this->assertArrayHasKey( 'errors', $result );
398
-		$this->assertArrayNotHasKey( 'included', $result );
399
-		$this->assertArrayNotHasKey( 'data', $result );
394
+		$this->assertEquals(400, $status);
395
+		$this->assertEquals(1, count($header));
396
+		$this->assertEquals(0, $result['meta']['total']);
397
+		$this->assertArrayHasKey('errors', $result);
398
+		$this->assertArrayNotHasKey('included', $result);
399
+		$this->assertArrayNotHasKey('data', $result);
400 400
 	}
401 401
 
402 402
 
403 403
 	public function testPost()
404 404
 	{
405 405
 		$name = 'ClientJsonAdmStandard';
406
-		$this->context->getConfig()->set( 'mshop/product/manager/name', $name );
406
+		$this->context->getConfig()->set('mshop/product/manager/name', $name);
407 407
 
408
-		$productManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' )
409
-			->setMethods( array( 'getItem', 'saveItem' ) )
410
-			->setConstructorArgs( array( $this->context ) )
408
+		$productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')
409
+			->setMethods(array('getItem', 'saveItem'))
410
+			->setConstructorArgs(array($this->context))
411 411
 			->getMock();
412 412
 
413
-		\Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub );
413
+		\Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub);
414 414
 
415 415
 		$item = $productManagerStub->createItem();
416
-		$item->setLabel( 'test' );
417
-		$item->setId( '-1' );
416
+		$item->setLabel('test');
417
+		$item->setId('-1');
418 418
 
419
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' );
420
-		$productManagerStub->expects( $this->once() )->method( 'getItem' )
421
-			->will( $this->returnValue( $item ) );
419
+		$productManagerStub->expects($this->once())->method('saveItem');
420
+		$productManagerStub->expects($this->once())->method('getItem')
421
+			->will($this->returnValue($item));
422 422
 
423 423
 
424 424
 		$body = '{"data": {"type": "product", "attributes": {"product.label": "test"}}}';
425 425
 		$header = array();
426 426
 		$status = 500;
427 427
 
428
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
429
-
430
-		$this->assertEquals( 201, $status );
431
-		$this->assertEquals( 1, count( $header ) );
432
-		$this->assertEquals( 1, $result['meta']['total'] );
433
-		$this->assertArrayHasKey( 'data', $result );
434
-		$this->assertEquals( '-1', $result['data']['id'] );
435
-		$this->assertEquals( 'product', $result['data']['type'] );
436
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
437
-		$this->assertArrayNotHasKey( 'included', $result );
438
-		$this->assertArrayNotHasKey( 'errors', $result );
428
+		$result = json_decode($this->object->post($body, $header, $status), true);
429
+
430
+		$this->assertEquals(201, $status);
431
+		$this->assertEquals(1, count($header));
432
+		$this->assertEquals(1, $result['meta']['total']);
433
+		$this->assertArrayHasKey('data', $result);
434
+		$this->assertEquals('-1', $result['data']['id']);
435
+		$this->assertEquals('product', $result['data']['type']);
436
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
437
+		$this->assertArrayNotHasKey('included', $result);
438
+		$this->assertArrayNotHasKey('errors', $result);
439 439
 	}
440 440
 
441 441
 
442 442
 	public function testPostBulk()
443 443
 	{
444 444
 		$name = 'ClientJsonAdmStandard';
445
-		$this->context->getConfig()->set( 'mshop/product/manager/name', $name );
445
+		$this->context->getConfig()->set('mshop/product/manager/name', $name);
446 446
 
447
-		$productManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' )
448
-			->setMethods( array( 'getItem', 'saveItem' ) )
449
-			->setConstructorArgs( array( $this->context ) )
447
+		$productManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')
448
+			->setMethods(array('getItem', 'saveItem'))
449
+			->setConstructorArgs(array($this->context))
450 450
 			->getMock();
451 451
 
452
-		\Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub );
452
+		\Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $productManagerStub);
453 453
 
454 454
 		$item = $productManagerStub->createItem();
455
-		$item->setLabel( 'test' );
456
-		$item->setId( '-1' );
455
+		$item->setLabel('test');
456
+		$item->setId('-1');
457 457
 
458
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' );
459
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'getItem' )
460
-			->will( $this->returnValue( $item ) );
458
+		$productManagerStub->expects($this->exactly(2))->method('saveItem');
459
+		$productManagerStub->expects($this->exactly(2))->method('getItem')
460
+			->will($this->returnValue($item));
461 461
 
462 462
 
463 463
 		$body = '{"data": [{"type": "product", "attributes": {"product.label": "test"}}, {"type": "product", "attributes": {"product.label": "test"}}]}';
464 464
 		$header = array();
465 465
 		$status = 500;
466 466
 
467
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
468
-
469
-		$this->assertEquals( 201, $status );
470
-		$this->assertEquals( 1, count( $header ) );
471
-		$this->assertEquals( 2, $result['meta']['total'] );
472
-		$this->assertArrayHasKey( 'data', $result );
473
-		$this->assertEquals( 2, count( $result['data'] ) );
474
-		$this->assertEquals( '-1', $result['data'][0]['id'] );
475
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
476
-		$this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] );
477
-		$this->assertArrayNotHasKey( 'included', $result );
478
-		$this->assertArrayNotHasKey( 'errors', $result );
467
+		$result = json_decode($this->object->post($body, $header, $status), true);
468
+
469
+		$this->assertEquals(201, $status);
470
+		$this->assertEquals(1, count($header));
471
+		$this->assertEquals(2, $result['meta']['total']);
472
+		$this->assertArrayHasKey('data', $result);
473
+		$this->assertEquals(2, count($result['data']));
474
+		$this->assertEquals('-1', $result['data'][0]['id']);
475
+		$this->assertEquals('product', $result['data'][0]['type']);
476
+		$this->assertEquals('test', $result['data'][0]['attributes']['product.label']);
477
+		$this->assertArrayNotHasKey('included', $result);
478
+		$this->assertArrayNotHasKey('errors', $result);
479 479
 	}
480 480
 
481 481
 
@@ -485,14 +485,14 @@  discard block
 block discarded – undo
485 485
 		$header = array();
486 486
 		$status = 500;
487 487
 
488
-		$result = json_decode( $this->object->post( $body, $header, $status ), true );
488
+		$result = json_decode($this->object->post($body, $header, $status), true);
489 489
 
490
-		$this->assertEquals( 400, $status );
491
-		$this->assertEquals( 1, count( $header ) );
492
-		$this->assertEquals( 0, $result['meta']['total'] );
493
-		$this->assertArrayHasKey( 'errors', $result );
494
-		$this->assertArrayNotHasKey( 'included', $result );
495
-		$this->assertArrayNotHasKey( 'data', $result );
490
+		$this->assertEquals(400, $status);
491
+		$this->assertEquals(1, count($header));
492
+		$this->assertEquals(0, $result['meta']['total']);
493
+		$this->assertArrayHasKey('errors', $result);
494
+		$this->assertArrayNotHasKey('included', $result);
495
+		$this->assertArrayNotHasKey('data', $result);
496 496
 	}
497 497
 
498 498
 
@@ -502,11 +502,11 @@  discard block
 block discarded – undo
502 502
 		$header = array();
503 503
 		$status = 500;
504 504
 
505
-		$result = json_decode( $this->object->put( $body, $header, $status ), true );
505
+		$result = json_decode($this->object->put($body, $header, $status), true);
506 506
 
507
-		$this->assertEquals( 501, $status );
508
-		$this->assertEquals( 1, count( $header ) );
509
-		$this->assertArrayHasKey( 'errors', $result );
507
+		$this->assertEquals(501, $status);
508
+		$this->assertEquals(1, count($header));
509
+		$this->assertArrayHasKey('errors', $result);
510 510
 	}
511 511
 
512 512
 
@@ -515,25 +515,25 @@  discard block
 block discarded – undo
515 515
 		$header = array();
516 516
 		$status = 500;
517 517
 
518
-		$result = json_decode( $this->object->options( '', $header, $status ), true );
518
+		$result = json_decode($this->object->options('', $header, $status), true);
519 519
 
520
-		$this->assertEquals( 200, $status );
521
-		$this->assertEquals( 2, count( $header ) );
522
-		$this->assertEquals( 59, count( $result['meta']['resources'] ) );
523
-		$this->assertGreaterThan( 0, count( $result['meta']['attributes'] ) );
524
-		$this->assertArrayNotHasKey( 'errors', $result );
520
+		$this->assertEquals(200, $status);
521
+		$this->assertEquals(2, count($header));
522
+		$this->assertEquals(59, count($result['meta']['resources']));
523
+		$this->assertGreaterThan(0, count($result['meta']['attributes']));
524
+		$this->assertArrayNotHasKey('errors', $result);
525 525
 	}
526 526
 
527 527
 
528
-	protected function getProductItem( $code = 'CNC' )
528
+	protected function getProductItem($code = 'CNC')
529 529
 	{
530
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
530
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
531 531
 		$search = $manager->createSearch();
532
-		$search->setConditions( $search->compare( '==', 'product.code', $code ) );
533
-		$items = $manager->searchItems( $search );
532
+		$search->setConditions($search->compare('==', 'product.code', $code));
533
+		$items = $manager->searchItems($search);
534 534
 
535
-		if( ( $item = reset( $items ) ) === false ) {
536
-			throw new \Exception( sprintf( 'No product item with code "%1$s" found', $code ) );
535
+		if (($item = reset($items)) === false) {
536
+			throw new \Exception(sprintf('No product item with code "%1$s" found', $code));
537 537
 		}
538 538
 
539 539
 		return $item;
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/FactoryTest.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 		$context = \TestHelperJadm::getContext();
17 17
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
18 18
 
19
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
20
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
19
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
20
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
21 21
 	}
22 22
 
23 23
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 		$context = \TestHelperJadm::getContext();
27 27
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
28 28
 
29
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
30
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
29
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
30
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
31 31
 	}
32 32
 
33 33
 
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 		$context = \TestHelperJadm::getContext();
37 37
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
38 38
 
39
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, '' );
40
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
39
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, '');
40
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
41 41
 	}
42 42
 
43 43
 
@@ -46,68 +46,68 @@  discard block
 block discarded – undo
46 46
 		$context = \TestHelperJadm::getContext();
47 47
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
48 48
 
49
-		$this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' );
50
-		\Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, '%^' );
49
+		$this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception');
50
+		\Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, '%^');
51 51
 	}
52 52
 
53 53
 
54 54
 	public function testClear()
55 55
 	{
56
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
56
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
57 57
 
58 58
 		$context = \TestHelperJadm::getContext();
59 59
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
60 60
 
61
-		$client1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
61
+		$client1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
62 62
 		\Aimeos\Admin\JsonAdm\Factory::clear();
63
-		$client2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
63
+		$client2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
64 64
 
65
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
65
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
66 66
 
67
-		$this->assertNotSame( $client1, $client2 );
67
+		$this->assertNotSame($client1, $client2);
68 68
 	}
69 69
 
70 70
 
71 71
 	public function testClearSite()
72 72
 	{
73
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
73
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
74 74
 
75 75
 		$context = \TestHelperJadm::getContext();
76 76
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
77 77
 
78
-		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
79
-		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
80
-		\Aimeos\Admin\JsonAdm\Factory::clear( (string) $context );
78
+		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
79
+		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
80
+		\Aimeos\Admin\JsonAdm\Factory::clear((string) $context);
81 81
 
82
-		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
83
-		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
82
+		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
83
+		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
84 84
 
85
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
85
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
86 86
 
87
-		$this->assertNotSame( $cntlA1, $cntlA2 );
88
-		$this->assertNotSame( $cntlB1, $cntlB2 );
87
+		$this->assertNotSame($cntlA1, $cntlA2);
88
+		$this->assertNotSame($cntlB1, $cntlB2);
89 89
 	}
90 90
 
91 91
 
92 92
 	public function testClearSpecific()
93 93
 	{
94
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
94
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
95 95
 
96 96
 		$context = \TestHelperJadm::getContext();
97 97
 		$templatePaths = \TestHelperJadm::getJsonadmPaths();
98 98
 
99
-		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
100
-		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
99
+		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
100
+		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
101 101
 
102
-		\Aimeos\Admin\JsonAdm\Factory::clear( (string) $context, 'order' );
102
+		\Aimeos\Admin\JsonAdm\Factory::clear((string) $context, 'order');
103 103
 
104
-		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order' );
105
-		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $templatePaths, 'order/base' );
104
+		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order');
105
+		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base');
106 106
 
107
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
107
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
108 108
 
109
-		$this->assertNotSame( $cntlA1, $cntlA2 );
110
-		$this->assertSame( $cntlB1, $cntlB2 );
109
+		$this->assertNotSame($cntlA1, $cntlA2);
110
+		$this->assertSame($cntlB1, $cntlB2);
111 111
 	}
112 112
 
113 113
 }
114 114
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Coupon/StandardTest.php 1 patch
Spacing   +26 added lines, -26 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\Coupon\Standard( $this->context, $this->view, $templatePaths, 'coupon' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Coupon\Standard($this->context, $this->view, $templatePaths, 'coupon');
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( 'coupon.code.code' => '90AB' )
33
+				'==' => array('coupon.code.code' => '90AB')
34 34
 			),
35 35
 			'include' => 'coupon/code'
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 40
 		$header = array();
41 41
 		$status = 500;
42 42
 
43
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
43
+		$result = json_decode($this->object->get('', $header, $status), true);
44 44
 
45
-		$this->assertEquals( 200, $status );
46
-		$this->assertEquals( 1, count( $header ) );
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'coupon', $result['data'][0]['type'] );
50
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['coupon/code'] ) );
51
-		$this->assertEquals( 1, count( $result['included'] ) );
52
-		$this->assertArrayNotHasKey( 'errors', $result );
45
+		$this->assertEquals(200, $status);
46
+		$this->assertEquals(1, count($header));
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('coupon', $result['data'][0]['type']);
50
+		$this->assertEquals(1, count($result['data'][0]['relationships']['coupon/code']));
51
+		$this->assertEquals(1, count($result['included']));
52
+		$this->assertArrayNotHasKey('errors', $result);
53 53
 	}
54 54
 
55 55
 
@@ -62,22 +62,22 @@  discard block
 block discarded – undo
62 62
 			'sort' => 'coupon.id',
63 63
 			'include' => 'coupon/code'
64 64
 		);
65
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
66
-		$this->view->addHelper( 'param', $helper );
65
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
66
+		$this->view->addHelper('param', $helper);
67 67
 
68 68
 		$header = array();
69 69
 		$status = 500;
70 70
 
71
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
72
-
73
-		$this->assertEquals( 200, $status );
74
-		$this->assertEquals( 1, count( $header ) );
75
-		$this->assertEquals( 5, $result['meta']['total'] );
76
-		$this->assertEquals( 5, count( $result['data'] ) );
77
-		$this->assertEquals( 'coupon', $result['data'][0]['type'] );
78
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
79
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['coupon/code'] ) );
80
-		$this->assertEquals( 5, count( $result['included'] ) );
81
-		$this->assertArrayNotHasKey( 'errors', $result );
71
+		$result = json_decode($this->object->get('', $header, $status), true);
72
+
73
+		$this->assertEquals(200, $status);
74
+		$this->assertEquals(1, count($header));
75
+		$this->assertEquals(5, $result['meta']['total']);
76
+		$this->assertEquals(5, count($result['data']));
77
+		$this->assertEquals('coupon', $result['data'][0]['type']);
78
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
79
+		$this->assertEquals(1, count($result['data'][0]['relationships']['coupon/code']));
80
+		$this->assertEquals(5, count($result['included']));
81
+		$this->assertArrayNotHasKey('errors', $result);
82 82
 	}
83 83
 }
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Catalog/StandardTest.php 1 patch
Spacing   +13 added lines, -13 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\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,25 +30,25 @@  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 40
 		$header = array();
41 41
 		$status = 500;
42 42
 
43
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
43
+		$result = json_decode($this->object->get('', $header, $status), true);
44 44
 
45
-		$this->assertEquals( 200, $status );
46
-		$this->assertEquals( 1, count( $header ) );
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
-		$this->assertArrayNotHasKey( 'errors', $result );
45
+		$this->assertEquals(200, $status);
46
+		$this->assertEquals(1, count($header));
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
+		$this->assertArrayNotHasKey('errors', $result);
53 53
 	}
54 54
 }
55 55
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Customer/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\Customer\Standard( $this->context, $this->view, $templatePaths, 'customer' );
25
+		$this->object = new \Aimeos\Admin\JsonAdm\Customer\Standard($this->context, $this->view, $templatePaths, 'customer');
26 26
 	}
27 27
 
28 28
 
@@ -30,27 +30,27 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$params = array(
32 32
 			'filter' => array(
33
-				'==' => array( 'customer.code' => 'UTC001' )
33
+				'==' => array('customer.code' => 'UTC001')
34 34
 			),
35 35
 			'include' => 'text,customer/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 40
 		$header = array();
41 41
 		$status = 500;
42 42
 
43
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
44
-
45
-		$this->assertEquals( 200, $status );
46
-		$this->assertEquals( 1, count( $header ) );
47
-		$this->assertEquals( 1, $result['meta']['total'] );
48
-		$this->assertEquals( 1, count( $result['data'] ) );
49
-		$this->assertEquals( 'customer', $result['data'][0]['type'] );
50
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['text'] ) );
51
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['customer/address'] ) );
52
-		$this->assertEquals( 2, count( $result['included'] ) );
53
-		$this->assertArrayNotHasKey( 'errors', $result );
43
+		$result = json_decode($this->object->get('', $header, $status), true);
44
+
45
+		$this->assertEquals(200, $status);
46
+		$this->assertEquals(1, count($header));
47
+		$this->assertEquals(1, $result['meta']['total']);
48
+		$this->assertEquals(1, count($result['data']));
49
+		$this->assertEquals('customer', $result['data'][0]['type']);
50
+		$this->assertEquals(1, count($result['data'][0]['relationships']['text']));
51
+		$this->assertEquals(1, count($result['data'][0]['relationships']['customer/address']));
52
+		$this->assertEquals(2, count($result['included']));
53
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 
56 56
 
@@ -63,22 +63,22 @@  discard block
 block discarded – undo
63 63
 			'sort' => 'customer.id',
64 64
 			'include' => 'customer/address'
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 69
 		$header = array();
70 70
 		$status = 500;
71 71
 
72
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
73
-
74
-		$this->assertEquals( 200, $status );
75
-		$this->assertEquals( 1, count( $header ) );
76
-		$this->assertEquals( 3, $result['meta']['total'] );
77
-		$this->assertEquals( 3, count( $result['data'] ) );
78
-		$this->assertEquals( 'customer', $result['data'][0]['type'] );
79
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
80
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['customer/address'] ) );
81
-		$this->assertEquals( 4, count( $result['included'] ) );
82
-		$this->assertArrayNotHasKey( 'errors', $result );
72
+		$result = json_decode($this->object->get('', $header, $status), true);
73
+
74
+		$this->assertEquals(200, $status);
75
+		$this->assertEquals(1, count($header));
76
+		$this->assertEquals(3, $result['meta']['total']);
77
+		$this->assertEquals(3, count($result['data']));
78
+		$this->assertEquals('customer', $result['data'][0]['type']);
79
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
80
+		$this->assertEquals(1, count($result['data'][0]['relationships']['customer/address']));
81
+		$this->assertEquals(4, count($result['included']));
82
+		$this->assertArrayNotHasKey('errors', $result);
83 83
 	}
84 84
 }
85 85
\ No newline at end of file
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,27 +30,27 @@  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 40
 		$header = array();
41 41
 		$status = 500;
42 42
 
43
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
44
-
45
-		$this->assertEquals( 200, $status );
46
-		$this->assertEquals( 1, count( $header ) );
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
-		$this->assertArrayNotHasKey( 'errors', $result );
43
+		$result = json_decode($this->object->get('', $header, $status), true);
44
+
45
+		$this->assertEquals(200, $status);
46
+		$this->assertEquals(1, count($header));
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
+		$this->assertArrayNotHasKey('errors', $result);
54 54
 	}
55 55
 
56 56
 
@@ -63,22 +63,22 @@  discard block
 block discarded – undo
63 63
 			'sort' => 'supplier.id',
64 64
 			'include' => 'supplier/address'
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 69
 		$header = array();
70 70
 		$status = 500;
71 71
 
72
-		$result = json_decode( $this->object->get( '', $header, $status ), true );
73
-
74
-		$this->assertEquals( 200, $status );
75
-		$this->assertEquals( 1, count( $header ) );
76
-		$this->assertEquals( 3, $result['meta']['total'] );
77
-		$this->assertEquals( 3, count( $result['data'] ) );
78
-		$this->assertEquals( 'supplier', $result['data'][0]['type'] );
79
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
80
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['supplier/address'] ) );
81
-		$this->assertEquals( 3, count( $result['included'] ) );
82
-		$this->assertArrayNotHasKey( 'errors', $result );
72
+		$result = json_decode($this->object->get('', $header, $status), true);
73
+
74
+		$this->assertEquals(200, $status);
75
+		$this->assertEquals(1, count($header));
76
+		$this->assertEquals(3, $result['meta']['total']);
77
+		$this->assertEquals(3, count($result['data']));
78
+		$this->assertEquals('supplier', $result['data'][0]['type']);
79
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
80
+		$this->assertEquals(1, count($result['data'][0]['relationships']['supplier/address']));
81
+		$this->assertEquals(3, count($result['included']));
82
+		$this->assertArrayNotHasKey('errors', $result);
83 83
 	}
84 84
 }
85 85
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Common/Factory/BaseTest.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -19,77 +19,77 @@  discard block
 block discarded – undo
19 19
 		$this->context = \TestHelperJadm::getContext();
20 20
 		$config = $this->context->getConfig();
21 21
 
22
-		$config->set( 'admin/jsonadm/common/decorators/default', array() );
23
-		$config->set( 'admin/jsonadm/decorators/global', array() );
24
-		$config->set( 'admin/jsonadm/decorators/local', array() );
22
+		$config->set('admin/jsonadm/common/decorators/default', array());
23
+		$config->set('admin/jsonadm/decorators/global', array());
24
+		$config->set('admin/jsonadm/decorators/local', array());
25 25
 
26 26
 	}
27 27
 
28 28
 
29 29
 	public function testInjectClient()
30 30
 	{
31
-		$cntl = \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' );
32
-		\Aimeos\Admin\JsonAdm\Factory::injectClient( '\\Aimeos\\Admin\\JsonAdm\\Standard', $cntl );
31
+		$cntl = \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard');
32
+		\Aimeos\Admin\JsonAdm\Factory::injectClient('\\Aimeos\\Admin\\JsonAdm\\Standard', $cntl);
33 33
 
34
-		$iCntl = \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' );
34
+		$iCntl = \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard');
35 35
 
36
-		$this->assertSame( $cntl, $iCntl );
36
+		$this->assertSame($cntl, $iCntl);
37 37
 	}
38 38
 
39 39
 
40 40
 	public function testInjectClientReset()
41 41
 	{
42
-		$cntl = \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' );
43
-		\Aimeos\Admin\JsonAdm\Factory::injectClient( '\\Aimeos\\Admin\\JsonAdm\\Standard', $cntl );
44
-		\Aimeos\Admin\JsonAdm\Factory::injectClient( '\\Aimeos\\Admin\\JsonAdm\\Standard', null );
42
+		$cntl = \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard');
43
+		\Aimeos\Admin\JsonAdm\Factory::injectClient('\\Aimeos\\Admin\\JsonAdm\\Standard', $cntl);
44
+		\Aimeos\Admin\JsonAdm\Factory::injectClient('\\Aimeos\\Admin\\JsonAdm\\Standard', null);
45 45
 
46
-		$new = \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' );
46
+		$new = \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard');
47 47
 
48
-		$this->assertNotSame( $cntl, $new );
48
+		$this->assertNotSame($cntl, $new);
49 49
 	}
50 50
 
51 51
 
52 52
 	public function testAddDecoratorsInvalidName()
53 53
 	{
54
-		$decorators = array( '$' );
54
+		$decorators = array('$');
55 55
 		$view = $this->context->getView();
56
-		$cntl = \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' );
56
+		$cntl = \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard');
57 57
 
58
-		$this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' );
59
-		\Aimeos\Admin\JsonAdm\Common\Factory\TestAbstract::addDecoratorsPublic( $cntl, $decorators, 'Test', $this->context, $view, array(), 'attribute' );
58
+		$this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception');
59
+		\Aimeos\Admin\JsonAdm\Common\Factory\TestAbstract::addDecoratorsPublic($cntl, $decorators, 'Test', $this->context, $view, array(), 'attribute');
60 60
 	}
61 61
 
62 62
 
63 63
 	public function testAddDecoratorsInvalidClass()
64 64
 	{
65
-		$decorators = array( 'Test' );
65
+		$decorators = array('Test');
66 66
 		$view = $this->context->getView();
67
-		$cntl = \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' );
67
+		$cntl = \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard');
68 68
 
69
-		$this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' );
70
-		\Aimeos\Admin\JsonAdm\Common\Factory\TestAbstract::addDecoratorsPublic( $cntl, $decorators, 'TestDecorator', $this->context, $view, array(), 'attribute' );
69
+		$this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception');
70
+		\Aimeos\Admin\JsonAdm\Common\Factory\TestAbstract::addDecoratorsPublic($cntl, $decorators, 'TestDecorator', $this->context, $view, array(), 'attribute');
71 71
 	}
72 72
 
73 73
 
74 74
 	public function testAddDecoratorsInvalidInterface()
75 75
 	{
76
-		$decorators = array( 'Test' );
76
+		$decorators = array('Test');
77 77
 		$view = $this->context->getView();
78
-		$cntl = \Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' );
78
+		$cntl = \Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard');
79 79
 
80
-		$this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' );
81
-		\Aimeos\Admin\JsonAdm\Common\Factory\TestAbstract::addDecoratorsPublic( $cntl, $decorators,
82
-			'\\Aimeos\\Admin\\Jsonadm\\Common\\Decorator\\', $this->context, $view, array(), 'attribute' );
80
+		$this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception');
81
+		\Aimeos\Admin\JsonAdm\Common\Factory\TestAbstract::addDecoratorsPublic($cntl, $decorators,
82
+			'\\Aimeos\\Admin\\Jsonadm\\Common\\Decorator\\', $this->context, $view, array(), 'attribute');
83 83
 	}
84 84
 
85 85
 
86 86
 	public function testAddClientDecoratorsExcludes()
87 87
 	{
88
-		$this->context->getConfig()->set( 'admin/jsonadm/decorators/excludes', array( 'TestDecorator' ) );
89
-		$this->context->getConfig()->set( 'admin/jsonadm/common/decorators/default', array( 'TestDecorator' ) );
88
+		$this->context->getConfig()->set('admin/jsonadm/decorators/excludes', array('TestDecorator'));
89
+		$this->context->getConfig()->set('admin/jsonadm/common/decorators/default', array('TestDecorator'));
90 90
 
91
-		$this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' );
92
-		\Aimeos\Admin\JsonAdm\Factory::createClient( $this->context, array(), 'attribute', 'Standard' );
91
+		$this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception');
92
+		\Aimeos\Admin\JsonAdm\Factory::createClient($this->context, array(), 'attribute', 'Standard');
93 93
 	}
94 94
 }
95 95
 
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 class TestAbstract
98 98
 	extends \Aimeos\Admin\JsonAdm\Common\Factory\Base
99 99
 {
100
-	public static function addDecoratorsPublic( \Aimeos\Admin\JsonAdm\Iface $client, array $decorators, $classprefix,
101
-		\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, $templatePaths, $path )
100
+	public static function addDecoratorsPublic(\Aimeos\Admin\JsonAdm\Iface $client, array $decorators, $classprefix,
101
+		\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, $templatePaths, $path)
102 102
 	{
103
-		self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path );
103
+		self::addDecorators($client, $decorators, $classprefix, $context, $view, $templatePaths, $path);
104 104
 	}
105 105
 
106
-	public static function addClientDecoratorsPublic( \Aimeos\Admin\JsonAdm\Iface $client,
107
-		\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, $templatePaths, $path )
106
+	public static function addClientDecoratorsPublic(\Aimeos\Admin\JsonAdm\Iface $client,
107
+		\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MW\View\Iface $view, $templatePaths, $path)
108 108
 	{
109
-		self::addClientDecorators( $client, $view, $context, $templatePaths, $path );
109
+		self::addClientDecorators($client, $view, $context, $templatePaths, $path);
110 110
 	}
111 111
 }
112 112
 
Please login to merge, or discard this patch.