Completed
Push — master ( 026233...c7df97 )
by Aimeos
02:33
created
admin/jsonadm/src/Admin/JsonAdm/Base.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * Sets the Aimeos bootstrap object
71 71
 	 *
72 72
 	 * @param \Aimeos\Bootstrap $aimeos The Aimeos bootstrap object
73
-	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
73
+	 * @return Base Reference to this object for fluent calls
74 74
 	 */
75 75
 	public function setAimeos( \Aimeos\Bootstrap $aimeos )
76 76
 	{
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * Sets the view object that will generate the admin output.
99 99
 	 *
100 100
 	 * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output
101
-	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
101
+	 * @return Base Reference to this object for fluent calls
102 102
 	 */
103 103
 	public function setView( \Aimeos\MW\View\Iface $view )
104 104
 	{
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @param \Aimeos\MShop\Context\Item\Iface $context MShop context object
32 32
 	 * @param string $path Name of the client separated by slashes, e.g "product/property"
33 33
 	 */
34
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context, $path )
34
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context, $path)
35 35
 	{
36 36
 		$this->context = $context;
37 37
 		$this->path = $path;
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 * @param array $param List of method parameter
46 46
 	 * @throws \Aimeos\Admin\JsonAdm\Exception If method call failed
47 47
 	 */
48
-	public function __call( $name, array $param )
48
+	public function __call($name, array $param)
49 49
 	{
50
-		throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Unable to call method "%1$s"', $name ) );
50
+		throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Unable to call method "%1$s"', $name));
51 51
 	}
52 52
 
53 53
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function getAimeos()
60 60
 	{
61
-		if( !isset( $this->aimeos ) ) {
62
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Aimeos object not available' ) );
61
+		if (!isset($this->aimeos)) {
62
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Aimeos object not available'));
63 63
 		}
64 64
 
65 65
 		return $this->aimeos;
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @param \Aimeos\Bootstrap $aimeos The Aimeos bootstrap object
73 73
 	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
74 74
 	 */
75
-	public function setAimeos( \Aimeos\Bootstrap $aimeos )
75
+	public function setAimeos(\Aimeos\Bootstrap $aimeos)
76 76
 	{
77 77
 		$this->aimeos = $aimeos;
78 78
 		return $this;
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public function getView()
88 88
 	{
89
-		if( !isset( $this->view ) ) {
90
-			throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No view available' ) );
89
+		if (!isset($this->view)) {
90
+			throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('No view available'));
91 91
 		}
92 92
 
93 93
 		return $this->view;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output
101 101
 	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
102 102
 	 */
103
-	public function setView( \Aimeos\MW\View\Iface $view )
103
+	public function setView(\Aimeos\MW\View\Iface $view)
104 104
 	{
105 105
 		$this->view = $view;
106 106
 		return $this;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 * @param array $include List of resource types that should be fetched
115 115
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
116 116
 	 */
117
-	protected function getChildItems( array $items, array $include )
117
+	protected function getChildItems(array $items, array $include)
118 118
 	{
119 119
 		return [];
120 120
 	}
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
 	 * @param \Aimeos\MW\View\Iface $view View object with "resource" parameter
138 138
 	 * @return array List of domain names
139 139
 	 */
140
-	protected function getDomains( \Aimeos\MW\View\Iface $view )
140
+	protected function getDomains(\Aimeos\MW\View\Iface $view)
141 141
 	{
142
-		if( ( $domains = $view->param( 'resource' ) ) == '' )
142
+		if (($domains = $view->param('resource')) == '')
143 143
 		{
144 144
 			/** admin/jsonadm/domains
145 145
 			 * A list of domain names whose clients are available for the JSON API
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 				'attribute', 'catalog', 'coupon', 'customer', 'locale', 'media', 'order',
163 163
 				'plugin', 'price', 'product', 'service', 'supplier', 'stock', 'tag', 'text'
164 164
 			);
165
-			$domains = $this->getContext()->getConfig()->get( 'admin/jsonadm/domains', $default );
165
+			$domains = $this->getContext()->getConfig()->get('admin/jsonadm/domains', $default);
166 166
 		}
167 167
 
168 168
 		return (array) $domains;
@@ -175,15 +175,15 @@  discard block
 block discarded – undo
175 175
 	 * @param \stdClass $request Decoded request body
176 176
 	 * @return array List of item IDs
177 177
 	 */
178
-	protected function getIds( $request )
178
+	protected function getIds($request)
179 179
 	{
180 180
 		$ids = [];
181 181
 
182
-		if( isset( $request->data ) )
182
+		if (isset($request->data))
183 183
 		{
184
-			foreach( (array) $request->data as $entry )
184
+			foreach ((array) $request->data as $entry)
185 185
 			{
186
-				if( isset( $entry->id ) ) {
186
+				if (isset($entry->id)) {
187 187
 					$ids[] = $entry->id;
188 188
 				}
189 189
 			}
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @param array $include List of resource types that should be fetched
201 201
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
202 202
 	 */
203
-	protected function getListItems( array $items, array $include )
203
+	protected function getListItems(array $items, array $include)
204 204
 	{
205 205
 		return [];
206 206
 	}
@@ -223,23 +223,23 @@  discard block
 block discarded – undo
223 223
 	 * @param array $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface
224 224
 	 * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface
225 225
 	 */
226
-	protected function getRefItems( array $listItems )
226
+	protected function getRefItems(array $listItems)
227 227
 	{
228 228
 		$list = $map = [];
229 229
 		$context = $this->getContext();
230 230
 
231
-		foreach( $listItems as $listItem ) {
231
+		foreach ($listItems as $listItem) {
232 232
 			$map[$listItem->getDomain()][] = $listItem->getRefId();
233 233
 		}
234 234
 
235
-		foreach( $map as $domain => $ids )
235
+		foreach ($map as $domain => $ids)
236 236
 		{
237
-			$manager = \Aimeos\MShop\Factory::createManager( $context, $domain );
237
+			$manager = \Aimeos\MShop\Factory::createManager($context, $domain);
238 238
 
239 239
 			$search = $manager->createSearch();
240
-			$search->setConditions( $search->compare( '==', $domain . '.id', $ids ) );
240
+			$search->setConditions($search->compare('==', $domain . '.id', $ids));
241 241
 
242
-			$list = array_merge( $list, $manager->searchItems( $search ) );
242
+			$list = array_merge($list, $manager->searchItems($search));
243 243
 		}
244 244
 
245 245
 		return $list;
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @param \Aimeos\MW\View\Iface $view View object with "resource" parameter
253 253
 	 * @return array List of domain names
254 254
 	 */
255
-	protected function getResources( \Aimeos\MW\View\Iface $view )
255
+	protected function getResources(\Aimeos\MW\View\Iface $view)
256 256
 	{
257 257
 		/** admin/jsonadm/resources
258 258
 		 * A list of additional resources name whose clients are available for the JSON API
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 		 * @category Developer
271 271
 		 * @see admin/jsonadm/domains
272 272
 		 */
273
-		return (array) $view->config( 'admin/jsonadm/resources', ['coupon/config', 'plugin/config', 'service/config'] );
273
+		return (array) $view->config('admin/jsonadm/resources', ['coupon/config', 'plugin/config', 'service/config']);
274 274
 	}
275 275
 
276 276
 
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
 	 * @param array $params List of criteria data with condition, sorting and paging
282 282
 	 * @return \Aimeos\MW\Criteria\Iface Initialized criteria object
283 283
 	 */
284
-	protected function initCriteria( \Aimeos\MW\Criteria\Iface $criteria, array $params )
284
+	protected function initCriteria(\Aimeos\MW\Criteria\Iface $criteria, array $params)
285 285
 	{
286
-		$this->initCriteriaConditions( $criteria, $params );
287
-		$this->initCriteriaSortations( $criteria, $params );
288
-		$this->initCriteriaSlice( $criteria, $params );
286
+		$this->initCriteriaConditions($criteria, $params);
287
+		$this->initCriteriaSortations($criteria, $params);
288
+		$this->initCriteriaSlice($criteria, $params);
289 289
 
290 290
 		return $criteria;
291 291
 	}
@@ -297,17 +297,17 @@  discard block
 block discarded – undo
297 297
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
298 298
 	 * @param array $params List of criteria data with condition, sorting and paging
299 299
 	 */
300
-	protected function initCriteriaConditions( \Aimeos\MW\Criteria\Iface $criteria, array $params )
300
+	protected function initCriteriaConditions(\Aimeos\MW\Criteria\Iface $criteria, array $params)
301 301
 	{
302
-		if( !isset( $params['filter'] ) ) {
302
+		if (!isset($params['filter'])) {
303 303
 			return;
304 304
 		}
305 305
 
306 306
 		$existing = $criteria->getConditions();
307
-		$criteria->setConditions( $criteria->toConditions( (array) $params['filter'] ) );
307
+		$criteria->setConditions($criteria->toConditions((array) $params['filter']));
308 308
 
309
-		$expr = array( $criteria->getConditions(), $existing );
310
-		$criteria->setConditions( $criteria->combine( '&&', $expr ) );
309
+		$expr = array($criteria->getConditions(), $existing);
310
+		$criteria->setConditions($criteria->combine('&&', $expr));
311 311
 	}
312 312
 
313 313
 
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
318 318
 	 * @param array $params List of criteria data with condition, sorting and paging
319 319
 	 */
320
-	protected function initCriteriaSlice( \Aimeos\MW\Criteria\Iface $criteria, array $params )
320
+	protected function initCriteriaSlice(\Aimeos\MW\Criteria\Iface $criteria, array $params)
321 321
 	{
322
-		$start = ( isset( $params['page']['offset'] ) ? (int) $params['page']['offset'] : 0 );
323
-		$size = ( isset( $params['page']['limit'] ) ? (int) $params['page']['limit'] : 25 );
322
+		$start = (isset($params['page']['offset']) ? (int) $params['page']['offset'] : 0);
323
+		$size = (isset($params['page']['limit']) ? (int) $params['page']['limit'] : 25);
324 324
 
325
-		$criteria->setSlice( $start, $size );
325
+		$criteria->setSlice($start, $size);
326 326
 	}
327 327
 
328 328
 
@@ -332,24 +332,24 @@  discard block
 block discarded – undo
332 332
 	 * @param \Aimeos\MW\Criteria\Iface $criteria Criteria object
333 333
 	 * @param array $params List of criteria data with condition, sorting and paging
334 334
 	 */
335
-	protected function initCriteriaSortations( \Aimeos\MW\Criteria\Iface $criteria, array $params )
335
+	protected function initCriteriaSortations(\Aimeos\MW\Criteria\Iface $criteria, array $params)
336 336
 	{
337
-		if( !isset( $params['sort'] ) ) {
337
+		if (!isset($params['sort'])) {
338 338
 			return;
339 339
 		}
340 340
 
341 341
 		$sortation = [];
342 342
 
343
-		foreach( explode( ',', $params['sort'] ) as $sort )
343
+		foreach (explode(',', $params['sort']) as $sort)
344 344
 		{
345
-			if( $sort[0] === '-' ) {
346
-				$sortation[] = $criteria->sort( '-', substr( $sort, 1 ) );
345
+			if ($sort[0] === '-') {
346
+				$sortation[] = $criteria->sort('-', substr($sort, 1));
347 347
 			} else {
348
-				$sortation[] = $criteria->sort( '+', $sort );
348
+				$sortation[] = $criteria->sort('+', $sort);
349 349
 			}
350 350
 		}
351 351
 
352
-		$criteria->setSortations( $sortation );
352
+		$criteria->setSortations($sortation);
353 353
 	}
354 354
 
355 355
 
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
 	 * @param \stdClass $request Object with request body data
361 361
 	 * @return array List of items
362 362
 	 */
363
-	protected function saveData( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request )
363
+	protected function saveData(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request)
364 364
 	{
365 365
 		$data = [];
366 366
 
367
-		if( isset( $request->data ) )
367
+		if (isset($request->data))
368 368
 		{
369
-			foreach( (array) $request->data as $entry ) {
370
-				$data[] = $this->saveEntry( $manager, $entry );
369
+			foreach ((array) $request->data as $entry) {
370
+				$data[] = $this->saveEntry($manager, $entry);
371 371
 			}
372 372
 		}
373 373
 
@@ -382,22 +382,22 @@  discard block
 block discarded – undo
382 382
 	 * @param \stdClass $entry Object including "id" and "attributes" elements
383 383
 	 * @return \Aimeos\MShop\Common\Item\Iface New or updated item
384 384
 	 */
385
-	protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry )
385
+	protected function saveEntry(\Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry)
386 386
 	{
387
-		if( isset( $entry->id ) ) {
388
-			$item = $manager->getItem( $entry->id );
387
+		if (isset($entry->id)) {
388
+			$item = $manager->getItem($entry->id);
389 389
 		} else {
390 390
 			$item = $manager->createItem();
391 391
 		}
392 392
 
393
-		$item = $this->addItemData( $manager, $item, $entry, $item->getResourceType() );
394
-		$item = $manager->saveItem( $item );
393
+		$item = $this->addItemData($manager, $item, $entry, $item->getResourceType());
394
+		$item = $manager->saveItem($item);
395 395
 
396
-		if( isset( $entry->relationships ) ) {
397
-			$this->saveRelationships( $manager, $item, $entry->relationships );
396
+		if (isset($entry->relationships)) {
397
+			$this->saveRelationships($manager, $item, $entry->relationships);
398 398
 		}
399 399
 
400
-		return $manager->getItem( $item->getId() );
400
+		return $manager->getItem($item->getId());
401 401
 	}
402 402
 
403 403
 
@@ -408,28 +408,28 @@  discard block
 block discarded – undo
408 408
 	 * @param \Aimeos\MShop\Common\Item\Iface $item Domain item with an unique ID set
409 409
 	 * @param \stdClass $relationships Object including the <domain>/data/attributes structure
410 410
 	 */
411
-	protected function saveRelationships( \Aimeos\MShop\Common\Manager\Iface $manager,
412
-		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $relationships )
411
+	protected function saveRelationships(\Aimeos\MShop\Common\Manager\Iface $manager,
412
+		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $relationships)
413 413
 	{
414 414
 		$id = $item->getId();
415
-		$listManager = $manager->getSubManager( 'lists' );
415
+		$listManager = $manager->getSubManager('lists');
416 416
 
417
-		foreach( (array) $relationships as $domain => $list )
417
+		foreach ((array) $relationships as $domain => $list)
418 418
 		{
419
-			if( isset( $list->data ) )
419
+			if (isset($list->data))
420 420
 			{
421
-				foreach( (array) $list->data as $data )
421
+				foreach ((array) $list->data as $data)
422 422
 				{
423
-					$listItem = $this->addItemData( $listManager, $listManager->createItem(), $data, $domain );
423
+					$listItem = $this->addItemData($listManager, $listManager->createItem(), $data, $domain);
424 424
 
425
-					if( isset( $data->id ) ) {
426
-						$listItem->setRefId( $data->id );
425
+					if (isset($data->id)) {
426
+						$listItem->setRefId($data->id);
427 427
 					}
428 428
 
429
-					$listItem->setParentId( $id );
430
-					$listItem->setDomain( $domain );
429
+					$listItem->setParentId($id);
430
+					$listItem->setDomain($domain);
431 431
 
432
-					$listManager->saveItem( $listItem, false );
432
+					$listManager->saveItem($listItem, false);
433 433
 				}
434 434
 			}
435 435
 		}
@@ -446,20 +446,20 @@  discard block
 block discarded – undo
446 446
 	 * @return \Aimeos\MShop\Common\Item\Iface Item including the data
447 447
 	 */
448 448
 	protected function addItemData(\Aimeos\MShop\Common\Manager\Iface $manager,
449
-		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $data, $domain )
449
+		\Aimeos\MShop\Common\Item\Iface $item, \stdClass $data, $domain)
450 450
 	{
451
-		if( isset( $data->attributes ) )
451
+		if (isset($data->attributes))
452 452
 		{
453 453
 			$attr = (array) $data->attributes;
454
-			$key = str_replace( '/', '.', $item->getResourceType() );
454
+			$key = str_replace('/', '.', $item->getResourceType());
455 455
 
456
-			if( isset( $attr[$key.'.type'] ) )
456
+			if (isset($attr[$key . '.type']))
457 457
 			{
458
-				$typeItem = $manager->getSubManager( 'type' )->findItem( $attr[$key.'.type'], [], $domain );
459
-				$attr[$key.'.typeid'] = $typeItem->getId();
458
+				$typeItem = $manager->getSubManager('type')->findItem($attr[$key . '.type'], [], $domain);
459
+				$attr[$key . '.typeid'] = $typeItem->getId();
460 460
 			}
461 461
 
462
-			$item->fromArray( $attr );
462
+			$item->fromArray($attr);
463 463
 		}
464 464
 
465 465
 		return $item;
Please login to merge, or discard this patch.
admin/jsonadm/src/Admin/JsonAdm/Common/Decorator/Base.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * Sets the Aimeos bootstrap object
155 155
 	 *
156 156
 	 * @param \Aimeos\Bootstrap $aimeos The Aimeos bootstrap object
157
-	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
157
+	 * @return Base Reference to this object for fluent calls
158 158
 	 */
159 159
 	public function setAimeos( \Aimeos\Bootstrap $aimeos )
160 160
 	{
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 * Sets the view object that will generate the admin output.
181 181
 	 *
182 182
 	 * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output
183
-	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
183
+	 * @return Base Reference to this object for fluent calls
184 184
 	 */
185 185
 	public function setView( \Aimeos\MW\View\Iface $view )
186 186
 	{
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects
35 35
 	 * @param string $path Name of the client separated by slashes, e.g "product/property"
36 36
 	 */
37
-	public function __construct( \Aimeos\Admin\JsonAdm\Iface $client, \Aimeos\MShop\Context\Item\Iface $context, $path )
37
+	public function __construct(\Aimeos\Admin\JsonAdm\Iface $client, \Aimeos\MShop\Context\Item\Iface $context, $path)
38 38
 	{
39
-		parent::__construct( $context, $path );
39
+		parent::__construct($context, $path);
40 40
 
41 41
 		$this->client = $client;
42 42
 	}
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	 * @return mixed Returns the value of the called method
51 51
 	 * @throws \Aimeos\Admin\JsonAdm\Exception If method call failed
52 52
 	 */
53
-	public function __call( $name, array $param )
53
+	public function __call($name, array $param)
54 54
 	{
55
-		return @call_user_func_array( array( $this->client, $name ), $param );
55
+		return @call_user_func_array(array($this->client, $name), $param);
56 56
 	}
57 57
 
58 58
 
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
64 64
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
65 65
 	 */
66
-	public function delete( ServerRequestInterface $request, ResponseInterface $response )
66
+	public function delete(ServerRequestInterface $request, ResponseInterface $response)
67 67
 	{
68
-		return $this->client->delete( $request, $response );
68
+		return $this->client->delete($request, $response);
69 69
 	}
70 70
 
71 71
 
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
77 77
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
78 78
 	 */
79
-	public function get( ServerRequestInterface $request, ResponseInterface $response )
79
+	public function get(ServerRequestInterface $request, ResponseInterface $response)
80 80
 	{
81
-		return $this->client->get( $request, $response );
81
+		return $this->client->get($request, $response);
82 82
 	}
83 83
 
84 84
 
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
91 91
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
92 92
 	 */
93
-	public function patch( ServerRequestInterface $request, ResponseInterface $response )
93
+	public function patch(ServerRequestInterface $request, ResponseInterface $response)
94 94
 	{
95
-		return $this->client->patch( $request, $response );
95
+		return $this->client->patch($request, $response);
96 96
 	}
97 97
 
98 98
 
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
105 105
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
106 106
 	 */
107
-	public function post( ServerRequestInterface $request, ResponseInterface $response )
107
+	public function post(ServerRequestInterface $request, ResponseInterface $response)
108 108
 	{
109
-		return $this->client->post( $request, $response );
109
+		return $this->client->post($request, $response);
110 110
 	}
111 111
 
112 112
 
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 	 * @param \Psr\Http\Message\ResponseInterface $response Response object
119 119
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
120 120
 	 */
121
-	public function put( ServerRequestInterface $request, ResponseInterface $response )
121
+	public function put(ServerRequestInterface $request, ResponseInterface $response)
122 122
 	{
123
-		return $this->client->put( $request, $response );
123
+		return $this->client->put($request, $response);
124 124
 	}
125 125
 
126 126
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 	 * @param string|null $prefix Form parameter prefix when nesting parameters is required
134 134
 	 * @return \Psr\Http\Message\ResponseInterface Modified response object
135 135
 	 */
136
-	public function options( ServerRequestInterface $request, ResponseInterface $response, $prefix = null )
136
+	public function options(ServerRequestInterface $request, ResponseInterface $response, $prefix = null)
137 137
 	{
138
-		return $this->client->options( $request, $response, $prefix );
138
+		return $this->client->options($request, $response, $prefix);
139 139
 	}
140 140
 
141 141
 
@@ -156,11 +156,11 @@  discard block
 block discarded – undo
156 156
 	 * @param \Aimeos\Bootstrap $aimeos The Aimeos bootstrap object
157 157
 	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
158 158
 	 */
159
-	public function setAimeos( \Aimeos\Bootstrap $aimeos )
159
+	public function setAimeos(\Aimeos\Bootstrap $aimeos)
160 160
 	{
161
-		parent::setAimeos( $aimeos );
161
+		parent::setAimeos($aimeos);
162 162
 
163
-		$this->client->setAimeos( $aimeos );
163
+		$this->client->setAimeos($aimeos);
164 164
 		return $this;
165 165
 	}
166 166
 
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 	 * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output
183 183
 	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
184 184
 	 */
185
-	public function setView( \Aimeos\MW\View\Iface $view )
185
+	public function setView(\Aimeos\MW\View\Iface $view)
186 186
 	{
187
-		parent::setView( $view );
187
+		parent::setView($view);
188 188
 
189
-		$this->client->setView( $view );
189
+		$this->client->setView($view);
190 190
 		return $this;
191 191
 	}
192 192
 
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Media/StandardTest.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JsonAdm\Media\Standard( $this->context, 'media' );
25
-		$this->object->setAimeos( \TestHelperJadm::getAimeos() );
26
-		$this->object->setView( $this->view );
24
+		$this->object = new \Aimeos\Admin\JsonAdm\Media\Standard($this->context, 'media');
25
+		$this->object->setAimeos(\TestHelperJadm::getAimeos());
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
@@ -31,26 +31,26 @@  discard block
 block discarded – undo
31 31
 	{
32 32
 		$params = array(
33 33
 			'filter' => array(
34
-				'==' => array( 'media.label' => 'cn_colombie_179x178' )
34
+				'==' => array('media.label' => 'cn_colombie_179x178')
35 35
 			),
36 36
 			'include' => 'attribute'
37 37
 		);
38
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
39
-		$this->view->addHelper( 'param', $helper );
38
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
39
+		$this->view->addHelper('param', $helper);
40 40
 
41
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
42
-		$result = json_decode( (string) $response->getBody(), true );
41
+		$response = $this->object->get($this->view->request(), $this->view->response());
42
+		$result = json_decode((string) $response->getBody(), true);
43 43
 
44 44
 
45
-		$this->assertEquals( 200, $response->getStatusCode() );
46
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
45
+		$this->assertEquals(200, $response->getStatusCode());
46
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
47 47
 
48
-		$this->assertEquals( 1, $result['meta']['total'] );
49
-		$this->assertEquals( 1, count( $result['data'] ) );
50
-		$this->assertEquals( 'media', $result['data'][0]['type'] );
51
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['attribute'] ) );
52
-		$this->assertEquals( 1, count( $result['included'] ) );
48
+		$this->assertEquals(1, $result['meta']['total']);
49
+		$this->assertEquals(1, count($result['data']));
50
+		$this->assertEquals('media', $result['data'][0]['type']);
51
+		$this->assertEquals(1, count($result['data'][0]['relationships']['attribute']));
52
+		$this->assertEquals(1, count($result['included']));
53 53
 
54
-		$this->assertArrayNotHasKey( 'errors', $result );
54
+		$this->assertArrayNotHasKey('errors', $result);
55 55
 	}
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/StandardTest.php 1 patch
Spacing   +391 added lines, -391 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, 'product' );
25
-		$this->object->setAimeos( \TestHelperJadm::getAimeos() );
26
-		$this->object->setView( $this->view );
24
+		$this->object = new \Aimeos\Admin\JsonAdm\Standard($this->context, 'product');
25
+		$this->object->setAimeos(\TestHelperJadm::getAimeos());
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
@@ -35,193 +35,193 @@  discard block
 block discarded – undo
35 35
 
36 36
 	public function testDelete()
37 37
 	{
38
-		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' );
38
+		$this->getProductMock(array('deleteItem'))->expects($this->once())->method('deleteItem');
39 39
 
40
-		$params = array( 'id' => $this->getProductItem()->getId() );
41
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
42
-		$this->view->addHelper( 'param', $helper );
40
+		$params = array('id' => $this->getProductItem()->getId());
41
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
42
+		$this->view->addHelper('param', $helper);
43 43
 
44
-		$response = $this->object->delete( $this->view->request(), $this->view->response() );
45
-		$result = json_decode( (string) $response->getBody(), true );
44
+		$response = $this->object->delete($this->view->request(), $this->view->response());
45
+		$result = json_decode((string) $response->getBody(), true);
46 46
 
47 47
 
48
-		$this->assertEquals( 200, $response->getStatusCode() );
49
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
48
+		$this->assertEquals(200, $response->getStatusCode());
49
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
50 50
 
51
-		$this->assertEquals( 1, $result['meta']['total'] );
51
+		$this->assertEquals(1, $result['meta']['total']);
52 52
 
53
-		$this->assertArrayNotHasKey( 'included', $result );
54
-		$this->assertArrayNotHasKey( 'data', $result );
55
-		$this->assertArrayNotHasKey( 'errors', $result );
53
+		$this->assertArrayNotHasKey('included', $result);
54
+		$this->assertArrayNotHasKey('data', $result);
55
+		$this->assertArrayNotHasKey('errors', $result);
56 56
 	}
57 57
 
58 58
 
59 59
 	public function testDeleteBulk()
60 60
 	{
61
-		$this->getProductMock( array( 'deleteItems' ) )->expects( $this->once() )->method( 'deleteItems' );
61
+		$this->getProductMock(array('deleteItems'))->expects($this->once())->method('deleteItems');
62 62
 
63 63
 		$body = '{"data":[{"type": "product", "id": "-1"},{"type": "product", "id": "-2"}]}';
64
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
64
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
65 65
 
66
-		$response = $this->object->delete( $request, $this->view->response() );
67
-		$result = json_decode( (string) $response->getBody(), true );
66
+		$response = $this->object->delete($request, $this->view->response());
67
+		$result = json_decode((string) $response->getBody(), true);
68 68
 
69 69
 
70
-		$this->assertEquals( 200, $response->getStatusCode() );
71
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
70
+		$this->assertEquals(200, $response->getStatusCode());
71
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
72 72
 
73
-		$this->assertEquals( 2, $result['meta']['total'] );
74
-		$this->assertArrayNotHasKey( 'included', $result );
75
-		$this->assertArrayNotHasKey( 'data', $result );
76
-		$this->assertArrayNotHasKey( 'errors', $result );
73
+		$this->assertEquals(2, $result['meta']['total']);
74
+		$this->assertArrayNotHasKey('included', $result);
75
+		$this->assertArrayNotHasKey('data', $result);
76
+		$this->assertArrayNotHasKey('errors', $result);
77 77
 	}
78 78
 
79 79
 
80 80
 	public function testDeleteInvalid()
81 81
 	{
82 82
 		$body = '{"data":null}';
83
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
83
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
84 84
 
85
-		$response = $this->object->delete( $request, $this->view->response() );
86
-		$result = json_decode( (string) $response->getBody(), true );
85
+		$response = $this->object->delete($request, $this->view->response());
86
+		$result = json_decode((string) $response->getBody(), true);
87 87
 
88 88
 
89
-		$this->assertEquals( 400, $response->getStatusCode() );
90
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
89
+		$this->assertEquals(400, $response->getStatusCode());
90
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
91 91
 
92
-		$this->assertEquals( 0, $result['meta']['total'] );
93
-		$this->assertArrayHasKey( 'errors', $result );
94
-		$this->assertArrayNotHasKey( 'included', $result );
95
-		$this->assertArrayNotHasKey( 'data', $result );
92
+		$this->assertEquals(0, $result['meta']['total']);
93
+		$this->assertArrayHasKey('errors', $result);
94
+		$this->assertArrayNotHasKey('included', $result);
95
+		$this->assertArrayNotHasKey('data', $result);
96 96
 	}
97 97
 
98 98
 
99 99
 	public function testDeleteException()
100 100
 	{
101
-		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' )
102
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
101
+		$this->getProductMock(array('deleteItem'))->expects($this->once())->method('deleteItem')
102
+			->will($this->throwException(new \RuntimeException('test exception')));
103 103
 
104
-		$params = array( 'id' => $this->getProductItem()->getId() );
105
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
106
-		$this->view->addHelper( 'param', $helper );
104
+		$params = array('id' => $this->getProductItem()->getId());
105
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
106
+		$this->view->addHelper('param', $helper);
107 107
 
108
-		$response = $this->object->delete( $this->view->request(), $this->view->response() );
109
-		$result = json_decode( (string) $response->getBody(), true );
108
+		$response = $this->object->delete($this->view->request(), $this->view->response());
109
+		$result = json_decode((string) $response->getBody(), true);
110 110
 
111
-		$this->assertEquals( 500, $response->getStatusCode() );
112
-		$this->assertArrayHasKey( 'errors', $result );
111
+		$this->assertEquals(500, $response->getStatusCode());
112
+		$this->assertArrayHasKey('errors', $result);
113 113
 	}
114 114
 
115 115
 
116 116
 	public function testDeleteMShopException()
117 117
 	{
118
-		$this->getProductMock( array( 'deleteItem' ) )->expects( $this->once() )->method( 'deleteItem' )
119
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
118
+		$this->getProductMock(array('deleteItem'))->expects($this->once())->method('deleteItem')
119
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
120 120
 
121
-		$params = array( 'id' => $this->getProductItem()->getId() );
122
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
123
-		$this->view->addHelper( 'param', $helper );
121
+		$params = array('id' => $this->getProductItem()->getId());
122
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
123
+		$this->view->addHelper('param', $helper);
124 124
 
125
-		$response = $this->object->delete( $this->view->request(), $this->view->response() );
126
-		$result = json_decode( (string) $response->getBody(), true );
125
+		$response = $this->object->delete($this->view->request(), $this->view->response());
126
+		$result = json_decode((string) $response->getBody(), true);
127 127
 
128
-		$this->assertEquals( 404, $response->getStatusCode() );
129
-		$this->assertArrayHasKey( 'errors', $result );
128
+		$this->assertEquals(404, $response->getStatusCode());
129
+		$this->assertArrayHasKey('errors', $result);
130 130
 	}
131 131
 
132 132
 
133 133
 	public function testGet()
134 134
 	{
135
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
136
-		$result = json_decode( (string) $response->getBody(), true );
135
+		$response = $this->object->get($this->view->request(), $this->view->response());
136
+		$result = json_decode((string) $response->getBody(), true);
137 137
 
138 138
 
139
-		$this->assertEquals( 200, $response->getStatusCode() );
140
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
139
+		$this->assertEquals(200, $response->getStatusCode());
140
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
141 141
 
142
-		$this->assertEquals( 28, $result['meta']['total'] );
143
-		$this->assertEquals( 25, count( $result['data'] ) );
144
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
145
-		$this->assertEquals( 0, count( $result['included'] ) );
146
-		$this->assertArrayHasKey( 'next', $result['links'] );
147
-		$this->assertArrayHasKey( 'last', $result['links'] );
148
-		$this->assertArrayHasKey( 'self', $result['links'] );
149
-		$this->assertArrayNotHasKey( 'errors', $result );
142
+		$this->assertEquals(28, $result['meta']['total']);
143
+		$this->assertEquals(25, count($result['data']));
144
+		$this->assertEquals('product', $result['data'][0]['type']);
145
+		$this->assertEquals(0, count($result['included']));
146
+		$this->assertArrayHasKey('next', $result['links']);
147
+		$this->assertArrayHasKey('last', $result['links']);
148
+		$this->assertArrayHasKey('self', $result['links']);
149
+		$this->assertArrayNotHasKey('errors', $result);
150 150
 	}
151 151
 
152 152
 
153 153
 	public function testGetType()
154 154
 	{
155
-		$object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, 'product/property/type' );
156
-		$object->setView( $this->view );
155
+		$object = new \Aimeos\Admin\JsonAdm\Standard($this->context, 'product/property/type');
156
+		$object->setView($this->view);
157 157
 
158
-		$response = $object->get( $this->view->request(), $this->view->response() );
159
-		$result = json_decode( (string) $response->getBody(), true );
158
+		$response = $object->get($this->view->request(), $this->view->response());
159
+		$result = json_decode((string) $response->getBody(), true);
160 160
 
161 161
 
162
-		$this->assertEquals( 200, $response->getStatusCode() );
163
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
162
+		$this->assertEquals(200, $response->getStatusCode());
163
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
164 164
 
165
-		$this->assertEquals( 4, $result['meta']['total'] );
166
-		$this->assertEquals( 4, count( $result['data'] ) );
167
-		$this->assertEquals( 'product/property/type', $result['data'][0]['type'] );
168
-		$this->assertEquals( 0, count( $result['included'] ) );
165
+		$this->assertEquals(4, $result['meta']['total']);
166
+		$this->assertEquals(4, count($result['data']));
167
+		$this->assertEquals('product/property/type', $result['data'][0]['type']);
168
+		$this->assertEquals(0, count($result['included']));
169 169
 
170
-		$this->assertArrayNotHasKey( 'errors', $result );
170
+		$this->assertArrayNotHasKey('errors', $result);
171 171
 	}
172 172
 
173 173
 
174 174
 	public function testGetInvalid()
175 175
 	{
176
-		$object = new \Aimeos\Admin\JsonAdm\Standard( $this->context, 'invalid' );
177
-		$object->setView( $this->view );
176
+		$object = new \Aimeos\Admin\JsonAdm\Standard($this->context, 'invalid');
177
+		$object->setView($this->view);
178 178
 
179
-		$response = $object->get( $this->view->request(), $this->view->response() );
180
-		$result = json_decode( (string) $response->getBody(), true );
179
+		$response = $object->get($this->view->request(), $this->view->response());
180
+		$result = json_decode((string) $response->getBody(), true);
181 181
 
182 182
 
183
-		$this->assertEquals( 404, $response->getStatusCode() );
184
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
183
+		$this->assertEquals(404, $response->getStatusCode());
184
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
185 185
 
186
-		$this->assertEquals( 1, count( $result['errors'] ) );
187
-		$this->assertArrayHasKey( 'title', $result['errors'][0] );
188
-		$this->assertArrayHasKey( 'detail', $result['errors'][0] );
189
-		$this->assertArrayNotHasKey( 'data', $result );
190
-		$this->assertArrayNotHasKey( 'indluded', $result );
186
+		$this->assertEquals(1, count($result['errors']));
187
+		$this->assertArrayHasKey('title', $result['errors'][0]);
188
+		$this->assertArrayHasKey('detail', $result['errors'][0]);
189
+		$this->assertArrayNotHasKey('data', $result);
190
+		$this->assertArrayNotHasKey('indluded', $result);
191 191
 	}
192 192
 
193 193
 
194 194
 	public function testGetException()
195 195
 	{
196
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
197
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
196
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
197
+			->will($this->throwException(new \RuntimeException('test exception')));
198 198
 
199
-		$params = array( 'id' => -1 );
200
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
201
-		$this->view->addHelper( 'param', $helper );
199
+		$params = array('id' => -1);
200
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
201
+		$this->view->addHelper('param', $helper);
202 202
 
203
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
204
-		$result = json_decode( (string) $response->getBody(), true );
203
+		$response = $this->object->get($this->view->request(), $this->view->response());
204
+		$result = json_decode((string) $response->getBody(), true);
205 205
 
206
-		$this->assertEquals( 500, $response->getStatusCode() );
207
-		$this->assertArrayHasKey( 'errors', $result );
206
+		$this->assertEquals(500, $response->getStatusCode());
207
+		$this->assertArrayHasKey('errors', $result);
208 208
 	}
209 209
 
210 210
 
211 211
 	public function testGetMShopException()
212 212
 	{
213
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
214
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
213
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
214
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
215 215
 
216
-		$params = array( 'id' => -1 );
217
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
218
-		$this->view->addHelper( 'param', $helper );
216
+		$params = array('id' => -1);
217
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
218
+		$this->view->addHelper('param', $helper);
219 219
 
220
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
221
-		$result = json_decode( (string) $response->getBody(), true );
220
+		$response = $this->object->get($this->view->request(), $this->view->response());
221
+		$result = json_decode((string) $response->getBody(), true);
222 222
 
223
-		$this->assertEquals( 404, $response->getStatusCode() );
224
-		$this->assertArrayHasKey( 'errors', $result );
223
+		$this->assertEquals(404, $response->getStatusCode());
224
+		$this->assertArrayHasKey('errors', $result);
225 225
 	}
226 226
 
227 227
 
@@ -229,25 +229,25 @@  discard block
 block discarded – undo
229 229
 	{
230 230
 		$params = array(
231 231
 			'filter' => array(
232
-				'==' => array( 'product.type.code' => 'select' )
232
+				'==' => array('product.type.code' => 'select')
233 233
 			)
234 234
 		);
235
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
236
-		$this->view->addHelper( 'param', $helper );
235
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
236
+		$this->view->addHelper('param', $helper);
237 237
 
238
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
239
-		$result = json_decode( (string) $response->getBody(), true );
238
+		$response = $this->object->get($this->view->request(), $this->view->response());
239
+		$result = json_decode((string) $response->getBody(), true);
240 240
 
241 241
 
242
-		$this->assertEquals( 200, $response->getStatusCode() );
243
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
242
+		$this->assertEquals(200, $response->getStatusCode());
243
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
244 244
 
245
-		$this->assertEquals( 3, $result['meta']['total'] );
246
-		$this->assertEquals( 3, count( $result['data'] ) );
247
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
248
-		$this->assertEquals( 0, count( $result['included'] ) );
245
+		$this->assertEquals(3, $result['meta']['total']);
246
+		$this->assertEquals(3, count($result['data']));
247
+		$this->assertEquals('product', $result['data'][0]['type']);
248
+		$this->assertEquals(0, count($result['included']));
249 249
 
250
-		$this->assertArrayNotHasKey( 'errors', $result );
250
+		$this->assertArrayNotHasKey('errors', $result);
251 251
 	}
252 252
 
253 253
 
@@ -256,27 +256,27 @@  discard block
 block discarded – undo
256 256
 		$params = array(
257 257
 			'filter' => array(
258 258
 				'&&' => array(
259
-					array( '=~' => array( 'product.label' => 'Unittest: Test' ) ),
260
-					array( '==' => array( 'product.type.code' => 'select' ) ),
259
+					array('=~' => array('product.label' => 'Unittest: Test')),
260
+					array('==' => array('product.type.code' => 'select')),
261 261
 				)
262 262
 			)
263 263
 		);
264
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
265
-		$this->view->addHelper( 'param', $helper );
264
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
265
+		$this->view->addHelper('param', $helper);
266 266
 
267
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
268
-		$result = json_decode( (string) $response->getBody(), true );
267
+		$response = $this->object->get($this->view->request(), $this->view->response());
268
+		$result = json_decode((string) $response->getBody(), true);
269 269
 
270 270
 
271
-		$this->assertEquals( 200, $response->getStatusCode() );
272
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
271
+		$this->assertEquals(200, $response->getStatusCode());
272
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
273 273
 
274
-		$this->assertEquals( 2, $result['meta']['total'] );
275
-		$this->assertEquals( 2, count( $result['data'] ) );
276
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
277
-		$this->assertEquals( 0, count( $result['included'] ) );
274
+		$this->assertEquals(2, $result['meta']['total']);
275
+		$this->assertEquals(2, count($result['data']));
276
+		$this->assertEquals('product', $result['data'][0]['type']);
277
+		$this->assertEquals(0, count($result['included']));
278 278
 
279
-		$this->assertArrayNotHasKey( 'errors', $result );
279
+		$this->assertArrayNotHasKey('errors', $result);
280 280
 	}
281 281
 
282 282
 
@@ -288,25 +288,25 @@  discard block
 block discarded – undo
288 288
 				'limit' => 25
289 289
 			)
290 290
 		);
291
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
292
-		$this->view->addHelper( 'param', $helper );
291
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
292
+		$this->view->addHelper('param', $helper);
293 293
 
294
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
295
-		$result = json_decode( (string) $response->getBody(), true );
294
+		$response = $this->object->get($this->view->request(), $this->view->response());
295
+		$result = json_decode((string) $response->getBody(), true);
296 296
 
297 297
 
298
-		$this->assertEquals( 200, $response->getStatusCode() );
299
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
298
+		$this->assertEquals(200, $response->getStatusCode());
299
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
300 300
 
301
-		$this->assertEquals( 28, $result['meta']['total'] );
302
-		$this->assertEquals( 3, count( $result['data'] ) );
303
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
304
-		$this->assertEquals( 0, count( $result['included'] ) );
305
-		$this->assertArrayHasKey( 'first', $result['links'] );
306
-		$this->assertArrayHasKey( 'prev', $result['links'] );
307
-		$this->assertArrayHasKey( 'self', $result['links'] );
301
+		$this->assertEquals(28, $result['meta']['total']);
302
+		$this->assertEquals(3, count($result['data']));
303
+		$this->assertEquals('product', $result['data'][0]['type']);
304
+		$this->assertEquals(0, count($result['included']));
305
+		$this->assertArrayHasKey('first', $result['links']);
306
+		$this->assertArrayHasKey('prev', $result['links']);
307
+		$this->assertArrayHasKey('self', $result['links']);
308 308
 
309
-		$this->assertArrayNotHasKey( 'errors', $result );
309
+		$this->assertArrayNotHasKey('errors', $result);
310 310
 	}
311 311
 
312 312
 
@@ -315,24 +315,24 @@  discard block
 block discarded – undo
315 315
 		$params = array(
316 316
 			'sort' => 'product.label,-product.code'
317 317
 		);
318
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
319
-		$this->view->addHelper( 'param', $helper );
318
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
319
+		$this->view->addHelper('param', $helper);
320 320
 
321
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
322
-		$result = json_decode( (string) $response->getBody(), true );
321
+		$response = $this->object->get($this->view->request(), $this->view->response());
322
+		$result = json_decode((string) $response->getBody(), true);
323 323
 
324 324
 
325
-		$this->assertEquals( 200, $response->getStatusCode() );
326
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
325
+		$this->assertEquals(200, $response->getStatusCode());
326
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
327 327
 
328
-		$this->assertEquals( 28, $result['meta']['total'] );
329
-		$this->assertEquals( 25, count( $result['data'] ) );
330
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
331
-		$this->assertEquals( 'QRST', $result['data'][0]['attributes']['product.code'] );
332
-		$this->assertEquals( '16 discs', $result['data'][0]['attributes']['product.label'] );
333
-		$this->assertEquals( 0, count( $result['included'] ) );
328
+		$this->assertEquals(28, $result['meta']['total']);
329
+		$this->assertEquals(25, count($result['data']));
330
+		$this->assertEquals('product', $result['data'][0]['type']);
331
+		$this->assertEquals('QRST', $result['data'][0]['attributes']['product.code']);
332
+		$this->assertEquals('16 discs', $result['data'][0]['attributes']['product.label']);
333
+		$this->assertEquals(0, count($result['included']));
334 334
 
335
-		$this->assertArrayNotHasKey( 'errors', $result );
335
+		$this->assertArrayNotHasKey('errors', $result);
336 336
 	}
337 337
 
338 338
 
@@ -345,262 +345,262 @@  discard block
 block discarded – undo
345 345
 			'sort' => 'product.id',
346 346
 			'include' => 'product'
347 347
 		);
348
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
349
-		$this->view->addHelper( 'param', $helper );
348
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
349
+		$this->view->addHelper('param', $helper);
350 350
 
351
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
352
-		$result = json_decode( (string) $response->getBody(), true );
351
+		$response = $this->object->get($this->view->request(), $this->view->response());
352
+		$result = json_decode((string) $response->getBody(), true);
353 353
 
354 354
 
355
-		$this->assertEquals( 200, $response->getStatusCode() );
356
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
355
+		$this->assertEquals(200, $response->getStatusCode());
356
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
357 357
 
358
-		$this->assertEquals( 28, $result['meta']['total'] );
359
-		$this->assertEquals( 25, count( $result['data'] ) );
360
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
361
-		$this->assertEquals( 2, count( $result['data'][0]['attributes'] ) );
358
+		$this->assertEquals(28, $result['meta']['total']);
359
+		$this->assertEquals(25, count($result['data']));
360
+		$this->assertEquals('product', $result['data'][0]['type']);
361
+		$this->assertEquals(2, count($result['data'][0]['attributes']));
362 362
 
363
-		$this->assertArrayNotHasKey( 'errors', $result );
363
+		$this->assertArrayNotHasKey('errors', $result);
364 364
 	}
365 365
 
366 366
 
367 367
 	public function testPatch()
368 368
 	{
369
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
369
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
370 370
 
371 371
 		$item = $productManagerStub->createItem();
372
-		$item->setLabel( 'test' );
373
-		$item->setId( '-1' );
372
+		$item->setLabel('test');
373
+		$item->setId('-1');
374 374
 
375
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' )
376
-			->will( $this->returnValue( $productManagerStub->createItem() ) );
377
-		$productManagerStub->expects( $this->atLeastOnce() )->method( 'getItem' )
378
-			->will( $this->returnValue( $item ) );
375
+		$productManagerStub->expects($this->once())->method('saveItem')
376
+			->will($this->returnValue($productManagerStub->createItem()));
377
+		$productManagerStub->expects($this->atLeastOnce())->method('getItem')
378
+			->will($this->returnValue($item));
379 379
 
380 380
 
381
-		$params = array( 'id' => '-1' );
382
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
383
-		$this->view->addHelper( 'param', $helper );
381
+		$params = array('id' => '-1');
382
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
383
+		$this->view->addHelper('param', $helper);
384 384
 
385 385
 		$body = '{"data": {"type": "product", "attributes": {"product.label": "test"}}}';
386
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
386
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
387 387
 
388
-		$response = $this->object->patch( $request, $this->view->response() );
389
-		$result = json_decode( (string) $response->getBody(), true );
388
+		$response = $this->object->patch($request, $this->view->response());
389
+		$result = json_decode((string) $response->getBody(), true);
390 390
 
391 391
 
392
-		$this->assertEquals( 200, $response->getStatusCode() );
393
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
392
+		$this->assertEquals(200, $response->getStatusCode());
393
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
394 394
 
395
-		$this->assertEquals( 1, $result['meta']['total'] );
396
-		$this->assertArrayHasKey( 'data', $result );
397
-		$this->assertEquals( '-1', $result['data']['id'] );
398
-		$this->assertEquals( 'product', $result['data']['type'] );
399
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
395
+		$this->assertEquals(1, $result['meta']['total']);
396
+		$this->assertArrayHasKey('data', $result);
397
+		$this->assertEquals('-1', $result['data']['id']);
398
+		$this->assertEquals('product', $result['data']['type']);
399
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
400 400
 
401
-		$this->assertArrayNotHasKey( 'included', $result );
402
-		$this->assertArrayNotHasKey( 'errors', $result );
401
+		$this->assertArrayNotHasKey('included', $result);
402
+		$this->assertArrayNotHasKey('errors', $result);
403 403
 	}
404 404
 
405 405
 
406 406
 	public function testPatchBulk()
407 407
 	{
408
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
408
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
409 409
 
410 410
 		$item = $productManagerStub->createItem();
411
-		$item->setLabel( 'test' );
412
-		$item->setId( '-1' );
411
+		$item->setLabel('test');
412
+		$item->setId('-1');
413 413
 
414
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' )
415
-			->will( $this->returnValue( $productManagerStub->createItem() ) );
416
-		$productManagerStub->expects( $this->atLeastOnce() )->method( 'getItem' )
417
-			->will( $this->returnValue( $item ) );
414
+		$productManagerStub->expects($this->exactly(2))->method('saveItem')
415
+			->will($this->returnValue($productManagerStub->createItem()));
416
+		$productManagerStub->expects($this->atLeastOnce())->method('getItem')
417
+			->will($this->returnValue($item));
418 418
 
419 419
 
420 420
 		$body = '{"data": [{"id": "-1", "type": "product", "attributes": {"product.label": "test"}}, {"id": "-1", "type": "product", "attributes": {"product.label": "test"}}]}';
421
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
421
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
422 422
 
423
-		$response = $this->object->patch( $request, $this->view->response() );
424
-		$result = json_decode( (string) $response->getBody(), true );
423
+		$response = $this->object->patch($request, $this->view->response());
424
+		$result = json_decode((string) $response->getBody(), true);
425 425
 
426 426
 
427
-		$this->assertEquals( 200, $response->getStatusCode() );
428
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
427
+		$this->assertEquals(200, $response->getStatusCode());
428
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
429 429
 
430
-		$this->assertEquals( 2, $result['meta']['total'] );
431
-		$this->assertArrayHasKey( 'data', $result );
432
-		$this->assertEquals( 2, count( $result['data'] ) );
433
-		$this->assertEquals( '-1', $result['data'][0]['id'] );
434
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
435
-		$this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] );
430
+		$this->assertEquals(2, $result['meta']['total']);
431
+		$this->assertArrayHasKey('data', $result);
432
+		$this->assertEquals(2, count($result['data']));
433
+		$this->assertEquals('-1', $result['data'][0]['id']);
434
+		$this->assertEquals('product', $result['data'][0]['type']);
435
+		$this->assertEquals('test', $result['data'][0]['attributes']['product.label']);
436 436
 
437
-		$this->assertArrayNotHasKey( 'included', $result );
438
-		$this->assertArrayNotHasKey( 'errors', $result );
437
+		$this->assertArrayNotHasKey('included', $result);
438
+		$this->assertArrayNotHasKey('errors', $result);
439 439
 	}
440 440
 
441 441
 
442 442
 	public function testPatchInvalid()
443 443
 	{
444 444
 		$body = '{"data":null}';
445
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
445
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
446 446
 
447
-		$response = $this->object->patch( $request, $this->view->response() );
448
-		$result = json_decode( (string) $response->getBody(), true );
447
+		$response = $this->object->patch($request, $this->view->response());
448
+		$result = json_decode((string) $response->getBody(), true);
449 449
 
450 450
 
451
-		$this->assertEquals( 400, $response->getStatusCode() );
452
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
451
+		$this->assertEquals(400, $response->getStatusCode());
452
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
453 453
 
454
-		$this->assertEquals( 0, $result['meta']['total'] );
455
-		$this->assertArrayHasKey( 'errors', $result );
456
-		$this->assertArrayNotHasKey( 'included', $result );
457
-		$this->assertArrayNotHasKey( 'data', $result );
454
+		$this->assertEquals(0, $result['meta']['total']);
455
+		$this->assertArrayHasKey('errors', $result);
456
+		$this->assertArrayNotHasKey('included', $result);
457
+		$this->assertArrayNotHasKey('data', $result);
458 458
 	}
459 459
 
460 460
 
461 461
 	public function testPatchInvalidId()
462 462
 	{
463 463
 		$body = '{"data":{"id":-1}}';
464
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
464
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
465 465
 
466
-		$response = $this->object->patch( $request, $this->view->response() );
467
-		$result = json_decode( (string) $response->getBody(), true );
466
+		$response = $this->object->patch($request, $this->view->response());
467
+		$result = json_decode((string) $response->getBody(), true);
468 468
 
469 469
 
470
-		$this->assertEquals( 400, $response->getStatusCode() );
471
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
470
+		$this->assertEquals(400, $response->getStatusCode());
471
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
472 472
 
473
-		$this->assertEquals( 0, $result['meta']['total'] );
474
-		$this->assertArrayHasKey( 'errors', $result );
473
+		$this->assertEquals(0, $result['meta']['total']);
474
+		$this->assertArrayHasKey('errors', $result);
475 475
 	}
476 476
 
477 477
 
478 478
 	public function testPatchException()
479 479
 	{
480
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
481
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
480
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
481
+			->will($this->throwException(new \RuntimeException('test exception')));
482 482
 
483 483
 		$body = '{"data":[{"id":-1}]}';
484
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
484
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
485 485
 
486
-		$response = $this->object->patch( $request, $this->view->response() );
487
-		$result = json_decode( (string) $response->getBody(), true );
486
+		$response = $this->object->patch($request, $this->view->response());
487
+		$result = json_decode((string) $response->getBody(), true);
488 488
 
489 489
 
490
-		$this->assertEquals( 500, $response->getStatusCode() );
491
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
492
-		$this->assertArrayHasKey( 'errors', $result );
490
+		$this->assertEquals(500, $response->getStatusCode());
491
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
492
+		$this->assertArrayHasKey('errors', $result);
493 493
 	}
494 494
 
495 495
 
496 496
 	public function testPatchMShopException()
497 497
 	{
498
-		$this->getProductMock( array( 'getItem' ) )->expects( $this->once() )->method( 'getItem' )
499
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
498
+		$this->getProductMock(array('getItem'))->expects($this->once())->method('getItem')
499
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
500 500
 
501 501
 		$body = '{"data":[{"id":-1}]}';
502
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
502
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
503 503
 
504
-		$response = $this->object->patch( $request, $this->view->response() );
505
-		$result = json_decode( (string) $response->getBody(), true );
504
+		$response = $this->object->patch($request, $this->view->response());
505
+		$result = json_decode((string) $response->getBody(), true);
506 506
 
507 507
 
508
-		$this->assertEquals( 404, $response->getStatusCode() );
509
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
510
-		$this->assertArrayHasKey( 'errors', $result );
508
+		$this->assertEquals(404, $response->getStatusCode());
509
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
510
+		$this->assertArrayHasKey('errors', $result);
511 511
 	}
512 512
 
513 513
 
514 514
 	public function testPost()
515 515
 	{
516
-		$productManagerStub = $this->getProductMock( array( 'createItem', 'getItem', 'saveItem' ) );
516
+		$productManagerStub = $this->getProductMock(array('createItem', 'getItem', 'saveItem'));
517 517
 
518 518
 		$item = new \Aimeos\MShop\Product\Item\Standard();
519
-		$item->setId( '-1' );
519
+		$item->setId('-1');
520 520
 
521
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'createItem' )
522
-			->will( $this->returnValue( $item ) );
523
-		$productManagerStub->expects( $this->any() )->method( 'getItem' )
524
-			->will( $this->returnValue( $item ) );
525
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' )
526
-			->will( $this->returnValue( $productManagerStub->createItem() ) );
521
+		$productManagerStub->expects($this->exactly(2))->method('createItem')
522
+			->will($this->returnValue($item));
523
+		$productManagerStub->expects($this->any())->method('getItem')
524
+			->will($this->returnValue($item));
525
+		$productManagerStub->expects($this->once())->method('saveItem')
526
+			->will($this->returnValue($productManagerStub->createItem()));
527 527
 
528 528
 
529 529
 		$body = '{"data": {"type": "product", "attributes": {"product.type": "default", "product.label": "test"}}}';
530
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
530
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
531 531
 
532
-		$response = $this->object->post( $request, $this->view->response() );
533
-		$result = json_decode( (string) $response->getBody(), true );
532
+		$response = $this->object->post($request, $this->view->response());
533
+		$result = json_decode((string) $response->getBody(), true);
534 534
 
535
-		$this->assertEquals( 201, $response->getStatusCode() );
536
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
535
+		$this->assertEquals(201, $response->getStatusCode());
536
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
537 537
 
538
-		$this->assertEquals( 1, $result['meta']['total'] );
539
-		$this->assertArrayHasKey( 'data', $result );
540
-		$this->assertEquals( '-1', $result['data']['id'] );
541
-		$this->assertEquals( 'product', $result['data']['type'] );
542
-		$this->assertGreaterThan( 0, $result['data']['attributes']['product.typeid'] );
543
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
538
+		$this->assertEquals(1, $result['meta']['total']);
539
+		$this->assertArrayHasKey('data', $result);
540
+		$this->assertEquals('-1', $result['data']['id']);
541
+		$this->assertEquals('product', $result['data']['type']);
542
+		$this->assertGreaterThan(0, $result['data']['attributes']['product.typeid']);
543
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
544 544
 
545
-		$this->assertArrayNotHasKey( 'included', $result );
546
-		$this->assertArrayNotHasKey( 'errors', $result );
545
+		$this->assertArrayNotHasKey('included', $result);
546
+		$this->assertArrayNotHasKey('errors', $result);
547 547
 	}
548 548
 
549 549
 
550 550
 	public function testPostBulk()
551 551
 	{
552
-		$productManagerStub = $this->getProductMock( array( 'getItem', 'saveItem' ) );
552
+		$productManagerStub = $this->getProductMock(array('getItem', 'saveItem'));
553 553
 
554 554
 		$item = $productManagerStub->createItem();
555
-		$item->setLabel( 'test' );
556
-		$item->setId( '-1' );
555
+		$item->setLabel('test');
556
+		$item->setId('-1');
557 557
 
558
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'saveItem' )
559
-			->will( $this->returnValue( $productManagerStub->createItem() ) );
560
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'getItem' )
561
-			->will( $this->returnValue( $item ) );
558
+		$productManagerStub->expects($this->exactly(2))->method('saveItem')
559
+			->will($this->returnValue($productManagerStub->createItem()));
560
+		$productManagerStub->expects($this->exactly(2))->method('getItem')
561
+			->will($this->returnValue($item));
562 562
 
563 563
 
564 564
 		$body = '{"data": [{"type": "product", "attributes": {"product.label": "test"}}, {"type": "product", "attributes": {"product.label": "test"}}]}';
565
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
565
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
566 566
 
567
-		$response = $this->object->post( $request, $this->view->response() );
568
-		$result = json_decode( (string) $response->getBody(), true );
567
+		$response = $this->object->post($request, $this->view->response());
568
+		$result = json_decode((string) $response->getBody(), true);
569 569
 
570 570
 
571
-		$this->assertEquals( 201, $response->getStatusCode() );
572
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
571
+		$this->assertEquals(201, $response->getStatusCode());
572
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
573 573
 
574
-		$this->assertEquals( 2, $result['meta']['total'] );
575
-		$this->assertArrayHasKey( 'data', $result );
576
-		$this->assertEquals( 2, count( $result['data'] ) );
577
-		$this->assertEquals( '-1', $result['data'][0]['id'] );
578
-		$this->assertEquals( 'product', $result['data'][0]['type'] );
579
-		$this->assertEquals( 'test', $result['data'][0]['attributes']['product.label'] );
574
+		$this->assertEquals(2, $result['meta']['total']);
575
+		$this->assertArrayHasKey('data', $result);
576
+		$this->assertEquals(2, count($result['data']));
577
+		$this->assertEquals('-1', $result['data'][0]['id']);
578
+		$this->assertEquals('product', $result['data'][0]['type']);
579
+		$this->assertEquals('test', $result['data'][0]['attributes']['product.label']);
580 580
 
581
-		$this->assertArrayNotHasKey( 'included', $result );
582
-		$this->assertArrayNotHasKey( 'errors', $result );
581
+		$this->assertArrayNotHasKey('included', $result);
582
+		$this->assertArrayNotHasKey('errors', $result);
583 583
 	}
584 584
 
585 585
 
586 586
 	public function testPostRelationships()
587 587
 	{
588
-		$productManagerStub = $this->getProductMock( array( 'getSubManager', 'createItem', 'getItem', 'saveItem' ) );
589
-		$productManagerListsStub = $this->getProductListsMock( array( 'saveItem' ) );
588
+		$productManagerStub = $this->getProductMock(array('getSubManager', 'createItem', 'getItem', 'saveItem'));
589
+		$productManagerListsStub = $this->getProductListsMock(array('saveItem'));
590 590
 
591 591
 		$item = new \Aimeos\MShop\Product\Item\Standard();
592
-		$item->setId( '-1' );
592
+		$item->setId('-1');
593 593
 
594
-		$productManagerStub->expects( $this->exactly( 2 ) )->method( 'createItem' )
595
-			->will( $this->returnValue( $item ) );
596
-		$productManagerStub->expects( $this->any() )->method( 'getItem' )
597
-			->will( $this->returnValue( $item ) );
598
-		$productManagerStub->expects( $this->once() )->method( 'getSubManager' )
599
-			->will( $this->returnValue( $productManagerListsStub ) );
600
-		$productManagerStub->expects( $this->once() )->method( 'saveItem' )
601
-			->will( $this->returnValue( $productManagerStub->createItem() ) );
594
+		$productManagerStub->expects($this->exactly(2))->method('createItem')
595
+			->will($this->returnValue($item));
596
+		$productManagerStub->expects($this->any())->method('getItem')
597
+			->will($this->returnValue($item));
598
+		$productManagerStub->expects($this->once())->method('getSubManager')
599
+			->will($this->returnValue($productManagerListsStub));
600
+		$productManagerStub->expects($this->once())->method('saveItem')
601
+			->will($this->returnValue($productManagerStub->createItem()));
602 602
 
603
-		$productManagerListsStub->expects( $this->once() )->method( 'saveItem' );
603
+		$productManagerListsStub->expects($this->once())->method('saveItem');
604 604
 
605 605
 		$body = '{"data": {"type": "product",
606 606
 			"attributes": {"product.label": "test"},
@@ -608,213 +608,213 @@  discard block
 block discarded – undo
608 608
 				{"type": "text", "id": "-2", "attributes": {"product.lists.type": "default"}}
609 609
 			]}}
610 610
 		}}';
611
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
611
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
612 612
 
613
-		$response = $this->object->post( $request, $this->view->response() );
614
-		$result = json_decode( (string) $response->getBody(), true );
613
+		$response = $this->object->post($request, $this->view->response());
614
+		$result = json_decode((string) $response->getBody(), true);
615 615
 
616 616
 
617
-		$this->assertEquals( 201, $response->getStatusCode() );
618
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
617
+		$this->assertEquals(201, $response->getStatusCode());
618
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
619 619
 
620
-		$this->assertEquals( 1, $result['meta']['total'] );
621
-		$this->assertArrayHasKey( 'data', $result );
622
-		$this->assertEquals( '-1', $result['data']['id'] );
623
-		$this->assertEquals( 'product', $result['data']['type'] );
624
-		$this->assertEquals( 'test', $result['data']['attributes']['product.label'] );
620
+		$this->assertEquals(1, $result['meta']['total']);
621
+		$this->assertArrayHasKey('data', $result);
622
+		$this->assertEquals('-1', $result['data']['id']);
623
+		$this->assertEquals('product', $result['data']['type']);
624
+		$this->assertEquals('test', $result['data']['attributes']['product.label']);
625 625
 
626
-		$this->assertArrayNotHasKey( 'included', $result );
627
-		$this->assertArrayNotHasKey( 'errors', $result );
626
+		$this->assertArrayNotHasKey('included', $result);
627
+		$this->assertArrayNotHasKey('errors', $result);
628 628
 	}
629 629
 
630 630
 
631 631
 	public function testPostInvalid()
632 632
 	{
633 633
 		$body = '{"data":null}';
634
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
634
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
635 635
 
636
-		$response = $this->object->post( $request, $this->view->response() );
637
-		$result = json_decode( (string) $response->getBody(), true );
636
+		$response = $this->object->post($request, $this->view->response());
637
+		$result = json_decode((string) $response->getBody(), true);
638 638
 
639 639
 
640
-		$this->assertEquals( 400, $response->getStatusCode() );
641
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
640
+		$this->assertEquals(400, $response->getStatusCode());
641
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
642 642
 
643
-		$this->assertEquals( 0, $result['meta']['total'] );
644
-		$this->assertArrayHasKey( 'errors', $result );
645
-		$this->assertArrayNotHasKey( 'included', $result );
646
-		$this->assertArrayNotHasKey( 'data', $result );
643
+		$this->assertEquals(0, $result['meta']['total']);
644
+		$this->assertArrayHasKey('errors', $result);
645
+		$this->assertArrayNotHasKey('included', $result);
646
+		$this->assertArrayNotHasKey('data', $result);
647 647
 	}
648 648
 
649 649
 
650 650
 	public function testPostInvalidId()
651 651
 	{
652 652
 		$body = '{"data":{"id":-1}}';
653
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
653
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
654 654
 
655
-		$response = $this->object->post( $request, $this->view->response() );
656
-		$result = json_decode( (string) $response->getBody(), true );
655
+		$response = $this->object->post($request, $this->view->response());
656
+		$result = json_decode((string) $response->getBody(), true);
657 657
 
658 658
 
659
-		$this->assertEquals( 403, $response->getStatusCode() );
660
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
659
+		$this->assertEquals(403, $response->getStatusCode());
660
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
661 661
 
662
-		$this->assertEquals( 0, $result['meta']['total'] );
663
-		$this->assertArrayHasKey( 'errors', $result );
662
+		$this->assertEquals(0, $result['meta']['total']);
663
+		$this->assertArrayHasKey('errors', $result);
664 664
 	}
665 665
 
666 666
 
667 667
 	public function testPostException()
668 668
 	{
669
-		$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' )
670
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
669
+		$this->getProductMock(array('saveItem'))->expects($this->once())->method('saveItem')
670
+			->will($this->throwException(new \RuntimeException('test exception')));
671 671
 
672 672
 		$body = '{"data":{}}';
673
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
673
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
674 674
 
675
-		$response = $this->object->post( $request, $this->view->response() );
676
-		$result = json_decode( (string) $response->getBody(), true );
675
+		$response = $this->object->post($request, $this->view->response());
676
+		$result = json_decode((string) $response->getBody(), true);
677 677
 
678 678
 
679
-		$this->assertEquals( 500, $response->getStatusCode() );
680
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
681
-		$this->assertArrayHasKey( 'errors', $result );
679
+		$this->assertEquals(500, $response->getStatusCode());
680
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
681
+		$this->assertArrayHasKey('errors', $result);
682 682
 	}
683 683
 
684 684
 
685 685
 	public function testPostMShopException()
686 686
 	{
687
-		$this->getProductMock( array( 'saveItem' ) )->expects( $this->once() )->method( 'saveItem' )
688
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
687
+		$this->getProductMock(array('saveItem'))->expects($this->once())->method('saveItem')
688
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
689 689
 
690 690
 		$body = '{"data":{}}';
691
-		$request = $this->view->request()->withBody( $this->view->response()->createStreamFromString( $body ) );
691
+		$request = $this->view->request()->withBody($this->view->response()->createStreamFromString($body));
692 692
 
693
-		$response = $this->object->post( $request, $this->view->response() );
694
-		$result = json_decode( (string) $response->getBody(), true );
693
+		$response = $this->object->post($request, $this->view->response());
694
+		$result = json_decode((string) $response->getBody(), true);
695 695
 
696 696
 
697
-		$this->assertEquals( 404, $response->getStatusCode() );
698
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
699
-		$this->assertArrayHasKey( 'errors', $result );
697
+		$this->assertEquals(404, $response->getStatusCode());
698
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
699
+		$this->assertArrayHasKey('errors', $result);
700 700
 	}
701 701
 
702 702
 
703 703
 	public function testPut()
704 704
 	{
705
-		$response = $this->object->put( $this->view->request(), $this->view->response() );
706
-		$result = json_decode( (string) $response->getBody(), true );
705
+		$response = $this->object->put($this->view->request(), $this->view->response());
706
+		$result = json_decode((string) $response->getBody(), true);
707 707
 
708
-		$this->assertEquals( 501, $response->getStatusCode() );
709
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
710
-		$this->assertArrayHasKey( 'errors', $result );
708
+		$this->assertEquals(501, $response->getStatusCode());
709
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
710
+		$this->assertArrayHasKey('errors', $result);
711 711
 	}
712 712
 
713 713
 
714 714
 	public function testOptions()
715 715
 	{
716
-		$response = $this->object->options( $this->view->request(), $this->view->response() );
717
-		$result = json_decode( (string) $response->getBody(), true );
716
+		$response = $this->object->options($this->view->request(), $this->view->response());
717
+		$result = json_decode((string) $response->getBody(), true);
718 718
 
719 719
 
720
-		$this->assertEquals( 200, $response->getStatusCode() );
721
-		$this->assertEquals( 1, count( $response->getHeader( 'Allow' ) ) );
722
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
720
+		$this->assertEquals(200, $response->getStatusCode());
721
+		$this->assertEquals(1, count($response->getHeader('Allow')));
722
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
723 723
 
724
-		$this->assertNull( $result['meta']['prefix'] );
725
-		$this->assertGreaterThan( 59, count( $result['meta']['resources'] ) );
726
-		$this->assertGreaterThan( 0, count( $result['meta']['attributes'] ) );
724
+		$this->assertNull($result['meta']['prefix']);
725
+		$this->assertGreaterThan(59, count($result['meta']['resources']));
726
+		$this->assertGreaterThan(0, count($result['meta']['attributes']));
727 727
 
728
-		$this->assertArrayNotHasKey( 'errors', $result );
728
+		$this->assertArrayNotHasKey('errors', $result);
729 729
 	}
730 730
 
731 731
 
732 732
 	public function testOptionsWithPrefix()
733 733
 	{
734 734
 		$this->view->prefix = 'prefix';
735
-		$response = $this->object->options( $this->view->request(), $this->view->response() );
736
-		$result = json_decode( (string) $response->getBody(), true );
735
+		$response = $this->object->options($this->view->request(), $this->view->response());
736
+		$result = json_decode((string) $response->getBody(), true);
737 737
 
738 738
 
739
-		$this->assertEquals( 200, $response->getStatusCode() );
740
-		$this->assertEquals( 1, count( $response->getHeader( 'Allow' ) ) );
741
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
739
+		$this->assertEquals(200, $response->getStatusCode());
740
+		$this->assertEquals(1, count($response->getHeader('Allow')));
741
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
742 742
 
743
-		$this->assertEquals( 'prefix', $result['meta']['prefix'] );
744
-		$this->assertGreaterThan( 59, count( $result['meta']['resources'] ) );
745
-		$this->assertGreaterThan( 0, count( $result['meta']['attributes'] ) );
743
+		$this->assertEquals('prefix', $result['meta']['prefix']);
744
+		$this->assertGreaterThan(59, count($result['meta']['resources']));
745
+		$this->assertGreaterThan(0, count($result['meta']['attributes']));
746 746
 
747
-		$this->assertArrayNotHasKey( 'errors', $result );
747
+		$this->assertArrayNotHasKey('errors', $result);
748 748
 	}
749 749
 
750 750
 
751 751
 	public function testOptionsException()
752 752
 	{
753
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
754
-			->will( $this->throwException( new \RuntimeException( 'test exception' ) ) );
753
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
754
+			->will($this->throwException(new \RuntimeException('test exception')));
755 755
 
756
-		$response = $this->object->options( $this->view->request(), $this->view->response() );
757
-		$result = json_decode( (string) $response->getBody(), true );
756
+		$response = $this->object->options($this->view->request(), $this->view->response());
757
+		$result = json_decode((string) $response->getBody(), true);
758 758
 
759
-		$this->assertEquals( 500, $response->getStatusCode() );
760
-		$this->assertArrayHasKey( 'errors', $result );
759
+		$this->assertEquals(500, $response->getStatusCode());
760
+		$this->assertArrayHasKey('errors', $result);
761 761
 	}
762 762
 
763 763
 
764 764
 	public function testOptionsMShopException()
765 765
 	{
766
-		$this->getProductMock( array( 'getResourceType' ) )->expects( $this->once() )->method( 'getResourceType' )
767
-			->will( $this->throwException( new \Aimeos\MShop\Exception( 'test exception' ) ) );
766
+		$this->getProductMock(array('getResourceType'))->expects($this->once())->method('getResourceType')
767
+			->will($this->throwException(new \Aimeos\MShop\Exception('test exception')));
768 768
 
769
-		$response = $this->object->options( $this->view->request(), $this->view->response() );
770
-		$result = json_decode( (string) $response->getBody(), true );
769
+		$response = $this->object->options($this->view->request(), $this->view->response());
770
+		$result = json_decode((string) $response->getBody(), true);
771 771
 
772
-		$this->assertEquals( 404, $response->getStatusCode() );
773
-		$this->assertArrayHasKey( 'errors', $result );
772
+		$this->assertEquals(404, $response->getStatusCode());
773
+		$this->assertArrayHasKey('errors', $result);
774 774
 	}
775 775
 
776 776
 
777
-	protected function getProductMock( array $methods )
777
+	protected function getProductMock(array $methods)
778 778
 	{
779 779
 		$name = 'ClientJsonAdmStandard';
780
-		$this->context->getConfig()->set( 'mshop/product/manager/name', $name );
780
+		$this->context->getConfig()->set('mshop/product/manager/name', $name);
781 781
 
782
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Standard' )
783
-			->setConstructorArgs( array( $this->context ) )
784
-			->setMethods( $methods )
782
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Standard')
783
+			->setConstructorArgs(array($this->context))
784
+			->setMethods($methods)
785 785
 			->getMock();
786 786
 
787
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\' . $name, $stub );
787
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\' . $name, $stub);
788 788
 
789 789
 		return $stub;
790 790
 	}
791 791
 
792 792
 
793
-	protected function getProductListsMock( array $methods )
793
+	protected function getProductListsMock(array $methods)
794 794
 	{
795 795
 		$name = 'ClientJsonAdmStandard';
796
-		$this->context->getConfig()->set( 'mshop/product/manager/lists/name', $name );
796
+		$this->context->getConfig()->set('mshop/product/manager/lists/name', $name);
797 797
 
798
-		$stub = $this->getMockBuilder( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard' )
799
-			->setConstructorArgs( array( $this->context ) )
800
-			->setMethods( $methods )
798
+		$stub = $this->getMockBuilder('\\Aimeos\\MShop\\Product\\Manager\\Lists\\Standard')
799
+			->setConstructorArgs(array($this->context))
800
+			->setMethods($methods)
801 801
 			->getMock();
802 802
 
803
-		\Aimeos\MShop\Product\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Product\\Manager\\Lists\\' . $name, $stub );
803
+		\Aimeos\MShop\Product\Manager\Factory::injectManager('\\Aimeos\\MShop\\Product\\Manager\\Lists\\' . $name, $stub);
804 804
 
805 805
 		return $stub;
806 806
 	}
807 807
 
808 808
 
809
-	protected function getProductItem( $code = 'CNC' )
809
+	protected function getProductItem($code = 'CNC')
810 810
 	{
811
-		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager( $this->context );
811
+		$manager = \Aimeos\MShop\Product\Manager\Factory::createManager($this->context);
812 812
 		$search = $manager->createSearch();
813
-		$search->setConditions( $search->compare( '==', 'product.code', $code ) );
814
-		$items = $manager->searchItems( $search );
813
+		$search->setConditions($search->compare('==', 'product.code', $code));
814
+		$items = $manager->searchItems($search);
815 815
 
816
-		if( ( $item = reset( $items ) ) === false ) {
817
-			throw new \RuntimeException( sprintf( 'No product item with code "%1$s" found', $code ) );
816
+		if (($item = reset($items)) === false) {
817
+			throw new \RuntimeException(sprintf('No product item with code "%1$s" found', $code));
818 818
 		}
819 819
 
820 820
 		return $item;
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Plugin/Config/StandardTest.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JsonAdm\Plugin\Config\Standard( $this->context, 'plugin/config' );
25
-		$this->object->setAimeos( \TestHelperJadm::getAimeos() );
26
-		$this->object->setView( $this->view );
24
+		$this->object = new \Aimeos\Admin\JsonAdm\Plugin\Config\Standard($this->context, 'plugin/config');
25
+		$this->object->setAimeos(\TestHelperJadm::getAimeos());
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
@@ -32,26 +32,26 @@  discard block
 block discarded – undo
32 32
 		$params = array(
33 33
 			'id' => 'Autofill,Log',
34 34
 		);
35
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
36
-		$this->view->addHelper( 'param', $helper );
37
-
38
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
39
-		$result = json_decode( (string) $response->getBody(), true );
40
-
41
-		$this->assertEquals( 200, $response->getStatusCode() );
42
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
43
-
44
-		$this->assertEquals( 8, $result['meta']['total'] );
45
-		$this->assertInternalType( 'array', $result['data'] );
46
-		$this->assertEquals( 'autofill.address', $result['data'][0]['id'] );
47
-		$this->assertEquals( 'autofill.delivery', $result['data'][1]['id'] );
48
-		$this->assertEquals( 'autofill.deliverycode', $result['data'][2]['id'] );
49
-		$this->assertEquals( 'autofill.payment', $result['data'][3]['id'] );
50
-		$this->assertEquals( 'autofill.paymentcode', $result['data'][4]['id'] );
51
-		$this->assertEquals( 'autofill.useorder', $result['data'][5]['id'] );
52
-		$this->assertEquals( 'autofill.orderaddress', $result['data'][6]['id'] );
53
-		$this->assertEquals( 'autofill.orderservice', $result['data'][7]['id'] );
54
-
55
-		$this->assertArrayNotHasKey( 'errors', $result );
35
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
36
+		$this->view->addHelper('param', $helper);
37
+
38
+		$response = $this->object->get($this->view->request(), $this->view->response());
39
+		$result = json_decode((string) $response->getBody(), true);
40
+
41
+		$this->assertEquals(200, $response->getStatusCode());
42
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
43
+
44
+		$this->assertEquals(8, $result['meta']['total']);
45
+		$this->assertInternalType('array', $result['data']);
46
+		$this->assertEquals('autofill.address', $result['data'][0]['id']);
47
+		$this->assertEquals('autofill.delivery', $result['data'][1]['id']);
48
+		$this->assertEquals('autofill.deliverycode', $result['data'][2]['id']);
49
+		$this->assertEquals('autofill.payment', $result['data'][3]['id']);
50
+		$this->assertEquals('autofill.paymentcode', $result['data'][4]['id']);
51
+		$this->assertEquals('autofill.useorder', $result['data'][5]['id']);
52
+		$this->assertEquals('autofill.orderaddress', $result['data'][6]['id']);
53
+		$this->assertEquals('autofill.orderservice', $result['data'][7]['id']);
54
+
55
+		$this->assertArrayNotHasKey('errors', $result);
56 56
 	}
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/FactoryTest.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 		$context = \TestHelperJadm::getContext();
17 17
 		$aimeos = \TestHelperJadm::getAimeos();
18 18
 
19
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order' );
20
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
21
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Order\\Standard', $client );
19
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order');
20
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
21
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Order\\Standard', $client);
22 22
 	}
23 23
 
24 24
 
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 		$context = \TestHelperJadm::getContext();
28 28
 		$aimeos = \TestHelperJadm::getAimeos();
29 29
 
30
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order/base' );
31
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
32
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Order\\Base\\Standard', $client );
30
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order/base');
31
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
32
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Order\\Base\\Standard', $client);
33 33
 	}
34 34
 
35 35
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 		$context = \TestHelperJadm::getContext();
39 39
 		$aimeos = \TestHelperJadm::getAimeos();
40 40
 
41
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'stock/type' );
42
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
43
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Standard', $client );
41
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'stock/type');
42
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
43
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Standard', $client);
44 44
 	}
45 45
 
46 46
 
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 		$context = \TestHelperJadm::getContext();
50 50
 		$aimeos = \TestHelperJadm::getAimeos();
51 51
 
52
-		$client = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, '' );
53
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client );
54
-		$this->assertInstanceOf( '\\Aimeos\\Admin\\JsonAdm\\Standard', $client );
52
+		$client = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, '');
53
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Common\\Iface', $client);
54
+		$this->assertInstanceOf('\\Aimeos\\Admin\\JsonAdm\\Standard', $client);
55 55
 	}
56 56
 
57 57
 
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 		$context = \TestHelperJadm::getContext();
61 61
 		$aimeos = \TestHelperJadm::getAimeos();
62 62
 
63
-		$this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' );
64
-		\Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, '%^' );
63
+		$this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception');
64
+		\Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, '%^');
65 65
 	}
66 66
 
67 67
 
@@ -70,68 +70,68 @@  discard block
 block discarded – undo
70 70
 		$context = \TestHelperJadm::getContext();
71 71
 		$aimeos = \TestHelperJadm::getAimeos();
72 72
 
73
-		$this->setExpectedException( '\\Aimeos\\Admin\\JsonAdm\\Exception' );
74
-		\Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, '', '%^' );
73
+		$this->setExpectedException('\\Aimeos\\Admin\\JsonAdm\\Exception');
74
+		\Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, '', '%^');
75 75
 	}
76 76
 
77 77
 
78 78
 	public function testClear()
79 79
 	{
80
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
80
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
81 81
 
82 82
 		$context = \TestHelperJadm::getContext();
83 83
 		$aimeos = \TestHelperJadm::getAimeos();
84 84
 
85
-		$client1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order' );
85
+		$client1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order');
86 86
 		\Aimeos\Admin\JsonAdm\Factory::clear();
87
-		$client2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order' );
87
+		$client2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order');
88 88
 
89
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
89
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
90 90
 
91
-		$this->assertNotSame( $client1, $client2 );
91
+		$this->assertNotSame($client1, $client2);
92 92
 	}
93 93
 
94 94
 
95 95
 	public function testClearSite()
96 96
 	{
97
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
97
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
98 98
 
99 99
 		$context = \TestHelperJadm::getContext();
100 100
 		$aimeos = \TestHelperJadm::getAimeos();
101 101
 
102
-		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order' );
103
-		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order/base' );
104
-		\Aimeos\Admin\JsonAdm\Factory::clear( (string) $context );
102
+		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order');
103
+		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order/base');
104
+		\Aimeos\Admin\JsonAdm\Factory::clear((string) $context);
105 105
 
106
-		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order' );
107
-		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order/base' );
106
+		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order');
107
+		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order/base');
108 108
 
109
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
109
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
110 110
 
111
-		$this->assertNotSame( $cntlA1, $cntlA2 );
112
-		$this->assertNotSame( $cntlB1, $cntlB2 );
111
+		$this->assertNotSame($cntlA1, $cntlA2);
112
+		$this->assertNotSame($cntlB1, $cntlB2);
113 113
 	}
114 114
 
115 115
 
116 116
 	public function testClearSpecific()
117 117
 	{
118
-		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache( true );
118
+		$cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true);
119 119
 
120 120
 		$context = \TestHelperJadm::getContext();
121 121
 		$aimeos = \TestHelperJadm::getAimeos();
122 122
 
123
-		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order' );
124
-		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order/base' );
123
+		$cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order');
124
+		$cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order/base');
125 125
 
126
-		\Aimeos\Admin\JsonAdm\Factory::clear( (string) $context, 'order' );
126
+		\Aimeos\Admin\JsonAdm\Factory::clear((string) $context, 'order');
127 127
 
128
-		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order' );
129
-		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient( $context, $aimeos, 'order/base' );
128
+		$cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order');
129
+		$cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $aimeos, 'order/base');
130 130
 
131
-		\Aimeos\Admin\JsonAdm\Factory::setCache( $cache );
131
+		\Aimeos\Admin\JsonAdm\Factory::setCache($cache);
132 132
 
133
-		$this->assertNotSame( $cntlA1, $cntlA2 );
134
-		$this->assertSame( $cntlB1, $cntlB2 );
133
+		$this->assertNotSame($cntlA1, $cntlA2);
134
+		$this->assertSame($cntlB1, $cntlB2);
135 135
 	}
136 136
 
137 137
 }
138 138
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Attribute/StandardTest.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JsonAdm\Attribute\Standard( $this->context, 'attribute' );
25
-		$this->object->setAimeos( \TestHelperJadm::getAimeos() );
26
-		$this->object->setView( $this->view );
24
+		$this->object = new \Aimeos\Admin\JsonAdm\Attribute\Standard($this->context, 'attribute');
25
+		$this->object->setAimeos(\TestHelperJadm::getAimeos());
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
@@ -31,26 +31,26 @@  discard block
 block discarded – undo
31 31
 	{
32 32
 		$params = array(
33 33
 			'filter' => array(
34
-				'==' => array( 'attribute.code' => 's' )
34
+				'==' => array('attribute.code' => 's')
35 35
 			),
36 36
 			'include' => 'text'
37 37
 		);
38
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
39
-		$this->view->addHelper( 'param', $helper );
38
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
39
+		$this->view->addHelper('param', $helper);
40 40
 
41
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
42
-		$result = json_decode( (string) $response->getBody(), true );
41
+		$response = $this->object->get($this->view->request(), $this->view->response());
42
+		$result = json_decode((string) $response->getBody(), true);
43 43
 
44 44
 
45
-		$this->assertEquals( 200, $response->getStatusCode() );
46
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
45
+		$this->assertEquals(200, $response->getStatusCode());
46
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
47 47
 
48
-		$this->assertEquals( 1, $result['meta']['total'] );
49
-		$this->assertEquals( 1, count( $result['data'] ) );
50
-		$this->assertEquals( 'attribute', $result['data'][0]['type'] );
51
-		$this->assertEquals( 1, count( $result['data'][0]['relationships']['text'] ) );
52
-		$this->assertEquals( 1, count( $result['included'] ) );
48
+		$this->assertEquals(1, $result['meta']['total']);
49
+		$this->assertEquals(1, count($result['data']));
50
+		$this->assertEquals('attribute', $result['data'][0]['type']);
51
+		$this->assertEquals(1, count($result['data'][0]['relationships']['text']));
52
+		$this->assertEquals(1, count($result['included']));
53 53
 
54
-		$this->assertArrayNotHasKey( 'errors', $result );
54
+		$this->assertArrayNotHasKey('errors', $result);
55 55
 	}
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Text/StandardTest.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JsonAdm\Text\Standard( $this->context, 'text' );
25
-		$this->object->setAimeos( \TestHelperJadm::getAimeos() );
26
-		$this->object->setView( $this->view );
24
+		$this->object = new \Aimeos\Admin\JsonAdm\Text\Standard($this->context, 'text');
25
+		$this->object->setAimeos(\TestHelperJadm::getAimeos());
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
@@ -31,26 +31,26 @@  discard block
 block discarded – undo
31 31
 	{
32 32
 		$params = array(
33 33
 			'filter' => array(
34
-				'==' => array( 'text.label' => 'misc_long_desc' )
34
+				'==' => array('text.label' => 'misc_long_desc')
35 35
 			),
36 36
 			'include' => 'media'
37 37
 		);
38
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
39
-		$this->view->addHelper( 'param', $helper );
38
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
39
+		$this->view->addHelper('param', $helper);
40 40
 
41
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
42
-		$result = json_decode( (string) $response->getBody(), true );
41
+		$response = $this->object->get($this->view->request(), $this->view->response());
42
+		$result = json_decode((string) $response->getBody(), true);
43 43
 
44 44
 
45
-		$this->assertEquals( 200, $response->getStatusCode() );
46
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
45
+		$this->assertEquals(200, $response->getStatusCode());
46
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
47 47
 
48
-		$this->assertEquals( 1, $result['meta']['total'] );
49
-		$this->assertEquals( 1, count( $result['data'] ) );
50
-		$this->assertEquals( 'text', $result['data'][0]['type'] );
51
-		$this->assertEquals( 4, count( $result['data'][0]['relationships']['media'] ) );
52
-		$this->assertEquals( 4, count( $result['included'] ) );
48
+		$this->assertEquals(1, $result['meta']['total']);
49
+		$this->assertEquals(1, count($result['data']));
50
+		$this->assertEquals('text', $result['data'][0]['type']);
51
+		$this->assertEquals(4, count($result['data'][0]['relationships']['media']));
52
+		$this->assertEquals(4, count($result['included']));
53 53
 
54
-		$this->assertArrayNotHasKey( 'errors', $result );
54
+		$this->assertArrayNotHasKey('errors', $result);
55 55
 	}
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jsonadm/tests/Admin/JsonAdm/Price/StandardTest.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->context = \TestHelperJadm::getContext();
22 22
 		$this->view = $this->context->getView();
23 23
 
24
-		$this->object = new \Aimeos\Admin\JsonAdm\Price\Standard( $this->context, 'price' );
25
-		$this->object->setAimeos( \TestHelperJadm::getAimeos() );
26
-		$this->object->setView( $this->view );
24
+		$this->object = new \Aimeos\Admin\JsonAdm\Price\Standard($this->context, 'price');
25
+		$this->object->setAimeos(\TestHelperJadm::getAimeos());
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
@@ -31,26 +31,26 @@  discard block
 block discarded – undo
31 31
 	{
32 32
 		$params = array(
33 33
 			'filter' => array(
34
-				'==' => array( 'price.value' => '12.95' )
34
+				'==' => array('price.value' => '12.95')
35 35
 			),
36 36
 			'include' => 'attribute'
37 37
 		);
38
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $params );
39
-		$this->view->addHelper( 'param', $helper );
38
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $params);
39
+		$this->view->addHelper('param', $helper);
40 40
 
41
-		$response = $this->object->get( $this->view->request(), $this->view->response() );
42
-		$result = json_decode( (string) $response->getBody(), true );
41
+		$response = $this->object->get($this->view->request(), $this->view->response());
42
+		$result = json_decode((string) $response->getBody(), true);
43 43
 
44 44
 
45
-		$this->assertEquals( 200, $response->getStatusCode() );
46
-		$this->assertEquals( 1, count( $response->getHeader( 'Content-Type' ) ) );
45
+		$this->assertEquals(200, $response->getStatusCode());
46
+		$this->assertEquals(1, count($response->getHeader('Content-Type')));
47 47
 
48
-		$this->assertEquals( 2, $result['meta']['total'] );
49
-		$this->assertEquals( 2, count( $result['data'] ) );
50
-		$this->assertEquals( 'price', $result['data'][0]['type'] );
51
-		$this->assertEquals( 0, count( $result['data'][0]['relationships'] ) );
52
-		$this->assertEquals( 0, count( $result['included'] ) );
48
+		$this->assertEquals(2, $result['meta']['total']);
49
+		$this->assertEquals(2, count($result['data']));
50
+		$this->assertEquals('price', $result['data'][0]['type']);
51
+		$this->assertEquals(0, count($result['data'][0]['relationships']));
52
+		$this->assertEquals(0, count($result['included']));
53 53
 
54
-		$this->assertArrayNotHasKey( 'errors', $result );
54
+		$this->assertArrayNotHasKey('errors', $result);
55 55
 	}
56 56
 }
57 57
\ No newline at end of file
Please login to merge, or discard this patch.