Completed
Push — master ( 94b58b...843436 )
by Aimeos
02:17
created
lib/custom/src/MShop/Customer/Manager/Laravel.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 	 *
242 242
 	 * @param array $siteids List of IDs for sites whose entries should be deleted
243 243
 	 */
244
-	public function cleanup( array $siteids )
244
+	public function cleanup(array $siteids)
245 245
 	{
246 246
 		$path = 'mshop/customer/manager/submanagers';
247
-		foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) {
248
-			$this->getObject()->getSubManager( $domain )->cleanup( $siteids );
247
+		foreach ($this->getContext()->getConfig()->get($path, array('address', 'lists')) as $domain) {
248
+			$this->getObject()->getSubManager($domain)->cleanup($siteids);
249 249
 		}
250 250
 	}
251 251
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	public function createItem()
259 259
 	{
260
-		return $this->createItemBase( ['customer.siteid' => $this->getContext()->getLocale()->getSiteId()] );
260
+		return $this->createItemBase(['customer.siteid' => $this->getContext()->getLocale()->getSiteId()]);
261 261
 	}
262 262
 
263 263
 
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 	 *
267 267
 	 * @param array $ids List of IDs
268 268
 	 */
269
-	public function deleteItems( array $ids )
269
+	public function deleteItems(array $ids)
270 270
 	{
271 271
 		$path = 'mshop/customer/manager/laravel/delete';
272
-		$this->deleteItemsBase( $ids, $path, false );
272
+		$this->deleteItemsBase($ids, $path, false);
273 273
 	}
274 274
 
275 275
 
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
 	 * @param boolean $withsub Return also attributes of sub-managers if true
280 280
 	 * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface
281 281
 	 */
282
-	public function getSearchAttributes( $withsub = true )
282
+	public function getSearchAttributes($withsub = true)
283 283
 	{
284 284
 		$path = 'mshop/customer/manager/submanagers';
285 285
 
286
-		return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub );
286
+		return $this->getSearchAttributesBase($this->searchConfig, $path, array('address', 'lists'), $withsub);
287 287
 	}
288 288
 
289 289
 
@@ -294,32 +294,32 @@  discard block
 block discarded – undo
294 294
 	 * @param boolean $fetch True if the new ID should be returned in the item
295 295
 	 * @return \Aimeos\MShop\Common\Item\Iface $item Updated item including the generated ID
296 296
 	 */
297
-	public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true )
297
+	public function saveItem(\Aimeos\MShop\Common\Item\Iface $item, $fetch = true)
298 298
 	{
299 299
 		$iface = '\\Aimeos\\MShop\\Customer\\Item\\Iface';
300
-		if( !( $item instanceof $iface ) ) {
301
-			throw new \Aimeos\MShop\Customer\Exception( sprintf( 'Object is not of required type "%1$s"', $iface ) );
300
+		if (!($item instanceof $iface)) {
301
+			throw new \Aimeos\MShop\Customer\Exception(sprintf('Object is not of required type "%1$s"', $iface));
302 302
 		}
303 303
 
304
-		if( !$item->isModified() )
304
+		if (!$item->isModified())
305 305
 		{
306
-			$item = $this->savePropertyItems( $item, 'customer' );
307
-			$item = $this->saveAddressItems( $item, 'customer' );
308
-			return $this->saveRefItems( $item, 'customer' );
306
+			$item = $this->savePropertyItems($item, 'customer');
307
+			$item = $this->saveAddressItems($item, 'customer');
308
+			return $this->saveRefItems($item, 'customer');
309 309
 		}
310 310
 
311 311
 		$context = $this->getContext();
312 312
 		$dbm = $context->getDatabaseManager();
313 313
 		$dbname = $this->getResourceName();
314
-		$conn = $dbm->acquire( $dbname );
314
+		$conn = $dbm->acquire($dbname);
315 315
 
316 316
 		try
317 317
 		{
318 318
 			$id = $item->getId();
319
-			$date = date( 'Y-m-d H:i:s' );
319
+			$date = date('Y-m-d H:i:s');
320 320
 			$billingAddress = $item->getPaymentAddress();
321 321
 
322
-			if( $id === null )
322
+			if ($id === null)
323 323
 			{
324 324
 				/** mshop/customer/manager/laravel/insert
325 325
 				 * Inserts a new customer record into the database table
@@ -383,48 +383,48 @@  discard block
 block discarded – undo
383 383
 				$path = 'mshop/customer/manager/laravel/update';
384 384
 			}
385 385
 
386
-			$stmt = $this->getCachedStatement( $conn, $path );
387
-
388
-			$stmt->bind( 1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
389
-			$stmt->bind( 2, $item->getCode() );
390
-			$stmt->bind( 3, $billingAddress->getCompany() );
391
-			$stmt->bind( 4, $billingAddress->getVatID() );
392
-			$stmt->bind( 5, $billingAddress->getSalutation() );
393
-			$stmt->bind( 6, $billingAddress->getTitle() );
394
-			$stmt->bind( 7, $billingAddress->getFirstname() );
395
-			$stmt->bind( 8, $billingAddress->getLastname() );
396
-			$stmt->bind( 9, $billingAddress->getAddress1() );
397
-			$stmt->bind( 10, $billingAddress->getAddress2() );
398
-			$stmt->bind( 11, $billingAddress->getAddress3() );
399
-			$stmt->bind( 12, $billingAddress->getPostal() );
400
-			$stmt->bind( 13, $billingAddress->getCity() );
401
-			$stmt->bind( 14, $billingAddress->getState() );
402
-			$stmt->bind( 15, $billingAddress->getCountryId() );
403
-			$stmt->bind( 16, $billingAddress->getLanguageId() );
404
-			$stmt->bind( 17, $billingAddress->getTelephone() );
405
-			$stmt->bind( 18, $billingAddress->getTelefax() );
406
-			$stmt->bind( 19, $billingAddress->getWebsite() );
407
-			$stmt->bind( 20, $billingAddress->getEmail() );
408
-			$stmt->bind( 21, $billingAddress->getLongitude() );
409
-			$stmt->bind( 22, $billingAddress->getLatitude() );
410
-			$stmt->bind( 23, $item->getLabel() );
411
-			$stmt->bind( 24, $item->getBirthday() );
412
-			$stmt->bind( 25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
413
-			$stmt->bind( 26, $item->getDateVerified() );
414
-			$stmt->bind( 27, $item->getPassword() );
415
-			$stmt->bind( 28, $date ); // Modification time
416
-			$stmt->bind( 29, $context->getEditor() );
417
-
418
-			if( $id !== null ) {
419
-				$stmt->bind( 30, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
420
-				$item->setId( $id );
386
+			$stmt = $this->getCachedStatement($conn, $path);
387
+
388
+			$stmt->bind(1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT);
389
+			$stmt->bind(2, $item->getCode());
390
+			$stmt->bind(3, $billingAddress->getCompany());
391
+			$stmt->bind(4, $billingAddress->getVatID());
392
+			$stmt->bind(5, $billingAddress->getSalutation());
393
+			$stmt->bind(6, $billingAddress->getTitle());
394
+			$stmt->bind(7, $billingAddress->getFirstname());
395
+			$stmt->bind(8, $billingAddress->getLastname());
396
+			$stmt->bind(9, $billingAddress->getAddress1());
397
+			$stmt->bind(10, $billingAddress->getAddress2());
398
+			$stmt->bind(11, $billingAddress->getAddress3());
399
+			$stmt->bind(12, $billingAddress->getPostal());
400
+			$stmt->bind(13, $billingAddress->getCity());
401
+			$stmt->bind(14, $billingAddress->getState());
402
+			$stmt->bind(15, $billingAddress->getCountryId());
403
+			$stmt->bind(16, $billingAddress->getLanguageId());
404
+			$stmt->bind(17, $billingAddress->getTelephone());
405
+			$stmt->bind(18, $billingAddress->getTelefax());
406
+			$stmt->bind(19, $billingAddress->getWebsite());
407
+			$stmt->bind(20, $billingAddress->getEmail());
408
+			$stmt->bind(21, $billingAddress->getLongitude());
409
+			$stmt->bind(22, $billingAddress->getLatitude());
410
+			$stmt->bind(23, $item->getLabel());
411
+			$stmt->bind(24, $item->getBirthday());
412
+			$stmt->bind(25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT);
413
+			$stmt->bind(26, $item->getDateVerified());
414
+			$stmt->bind(27, $item->getPassword());
415
+			$stmt->bind(28, $date); // Modification time
416
+			$stmt->bind(29, $context->getEditor());
417
+
418
+			if ($id !== null) {
419
+				$stmt->bind(30, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
420
+				$item->setId($id);
421 421
 			} else {
422
-				$stmt->bind( 30, $date ); // Creation time
422
+				$stmt->bind(30, $date); // Creation time
423 423
 			}
424 424
 
425 425
 			$stmt->execute()->finish();
426 426
 
427
-			if( $id === null && $fetch === true )
427
+			if ($id === null && $fetch === true)
428 428
 			{
429 429
 				/** mshop/customer/manager/laravel/newid
430 430
 				 * Retrieves the ID generated by the database when inserting a new record
@@ -457,22 +457,22 @@  discard block
 block discarded – undo
457 457
 				 * @see mshop/customer/manager/laravel/count
458 458
 				 */
459 459
 				$path = 'mshop/customer/manager/laravel/newid';
460
-				$item->setId( $this->newId( $conn, $path ) );
460
+				$item->setId($this->newId($conn, $path));
461 461
 			}
462 462
 
463
-			$dbm->release( $conn, $dbname );
463
+			$dbm->release($conn, $dbname);
464 464
 		}
465
-		catch( \Exception $e )
465
+		catch (\Exception $e)
466 466
 		{
467
-			$dbm->release( $conn, $dbname );
467
+			$dbm->release($conn, $dbname);
468 468
 			throw $e;
469 469
 		}
470 470
 
471
-		$this->addGroups( $item );
471
+		$this->addGroups($item);
472 472
 
473
-		$item = $this->savePropertyItems( $item, 'customer' );
474
-		$item = $this->saveAddressItems( $item, 'customer' );
475
-		return $this->saveRefItems( $item, 'customer' );
473
+		$item = $this->savePropertyItems($item, 'customer');
474
+		$item = $this->saveAddressItems($item, 'customer');
475
+		return $this->saveRefItems($item, 'customer');
476 476
 	}
477 477
 
478 478
 
@@ -484,11 +484,11 @@  discard block
 block discarded – undo
484 484
 	 * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface
485 485
 	 * @throws \Aimeos\MShop\Customer\Exception If creating items failed
486 486
 	 */
487
-	public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null )
487
+	public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null)
488 488
 	{
489 489
 		$dbm = $this->getContext()->getDatabaseManager();
490 490
 		$dbname = $this->getResourceName();
491
-		$conn = $dbm->acquire( $dbname );
491
+		$conn = $dbm->acquire($dbname);
492 492
 		$map = [];
493 493
 
494 494
 		try
@@ -496,32 +496,32 @@  discard block
 block discarded – undo
496 496
 			$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
497 497
 			$cfgPathSearch = 'mshop/customer/manager/laravel/search';
498 498
 			$cfgPathCount = 'mshop/customer/manager/laravel/count';
499
-			$required = array( 'customer' );
499
+			$required = array('customer');
500 500
 
501
-			$results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );
502
-			while( ( $row = $results->fetch() ) !== false ) {
503
-				$map[ $row['customer.id'] ] = $row;
501
+			$results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level);
502
+			while (($row = $results->fetch()) !== false) {
503
+				$map[$row['customer.id']] = $row;
504 504
 			}
505 505
 
506
-			$dbm->release( $conn, $dbname );
506
+			$dbm->release($conn, $dbname);
507 507
 		}
508
-		catch( \Exception $e )
508
+		catch (\Exception $e)
509 509
 		{
510
-			$dbm->release( $conn, $dbname  );
510
+			$dbm->release($conn, $dbname);
511 511
 			throw $e;
512 512
 		}
513 513
 
514 514
 		$addrItems = [];
515
-		if( in_array( 'customer/address', $ref, true ) ) {
516
-			$addrItems = $this->getAddressItems( array_keys( $map ), 'customer' );
515
+		if (in_array('customer/address', $ref, true)) {
516
+			$addrItems = $this->getAddressItems(array_keys($map), 'customer');
517 517
 		}
518 518
 
519 519
 		$propItems = [];
520
-		if( in_array( 'customer/property', $ref, true ) ) {
521
-			$propItems = $this->getPropertyItems( array_keys( $map ), 'customer' );
520
+		if (in_array('customer/property', $ref, true)) {
521
+			$propItems = $this->getPropertyItems(array_keys($map), 'customer');
522 522
 		}
523 523
 
524
-		return $this->buildItems( $map, $ref, 'customer', $addrItems, $propItems );
524
+		return $this->buildItems($map, $ref, 'customer', $addrItems, $propItems);
525 525
 	}
526 526
 
527 527
 
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
533 533
 	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
534 534
 	 */
535
-	public function getSubManager( $manager, $name = null )
535
+	public function getSubManager($manager, $name = null)
536 536
 	{
537
-		return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Laravel' : $name ) );
537
+		return $this->getSubManagerBase('customer', $manager, ($name === null ? 'Laravel' : $name));
538 538
 	}
539 539
 }
Please login to merge, or discard this patch.
lib/custom/tests/MShop/Customer/Manager/LaravelTest.php 1 patch
Spacing   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -21,41 +21,41 @@  discard block
 block discarded – undo
21 21
 	{
22 22
 		$context = \TestHelper::getContext();
23 23
 		$this->editor = $context->getEditor();
24
-		$this->object = new \Aimeos\MShop\Customer\Manager\Laravel( $context );
24
+		$this->object = new \Aimeos\MShop\Customer\Manager\Laravel($context);
25 25
 
26 26
 		$this->fixture = array(
27 27
 			'label' => 'unitTest',
28 28
 			'status' => 2,
29 29
 		);
30 30
 
31
-		$this->address = new \Aimeos\MShop\Common\Item\Address\Standard( 'common.address.' );
31
+		$this->address = new \Aimeos\MShop\Common\Item\Address\Standard('common.address.');
32 32
 	}
33 33
 
34 34
 
35 35
 	protected function tearDown()
36 36
 	{
37
-		unset( $this->object, $this->fixture, $this->address );
37
+		unset($this->object, $this->fixture, $this->address);
38 38
 	}
39 39
 
40 40
 
41 41
 	public function testCleanup()
42 42
 	{
43
-		$this->object->cleanup( array( -1 ) );
43
+		$this->object->cleanup(array( -1 ));
44 44
 	}
45 45
 
46 46
 
47 47
 	public function testGetSearchAttributes()
48 48
 	{
49
-		foreach( $this->object->getSearchAttributes() as $attribute )
49
+		foreach ($this->object->getSearchAttributes() as $attribute)
50 50
 		{
51
-			$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute );
51
+			$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Attribute\\Iface', $attribute);
52 52
 		}
53 53
 	}
54 54
 
55 55
 
56 56
 	public function testCreateItem()
57 57
 	{
58
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Customer\\Item\\Iface', $this->object->createItem() );
58
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Customer\\Item\\Iface', $this->object->createItem());
59 59
 	}
60 60
 
61 61
 
@@ -63,21 +63,21 @@  discard block
 block discarded – undo
63 63
 	{
64 64
 		$search = $this->object->createSearch();
65 65
 		$conditions = array(
66
-			$search->compare( '==', 'customer.code', 'UTC003' ),
67
-			$search->compare( '==', 'customer.editor', $this->editor )
66
+			$search->compare('==', 'customer.code', 'UTC003'),
67
+			$search->compare('==', 'customer.editor', $this->editor)
68 68
 		);
69
-		$search->setConditions( $search->combine( '&&', $conditions ) );
70
-		$items = $this->object->searchItems( $search, array( 'text' ) );
69
+		$search->setConditions($search->combine('&&', $conditions));
70
+		$items = $this->object->searchItems($search, array('text'));
71 71
 
72
-		if( ( $expected = reset( $items ) ) === false ) {
73
-			throw new \RuntimeException( 'No customer item with code "UTC003" found' );
72
+		if (($expected = reset($items)) === false) {
73
+			throw new \RuntimeException('No customer item with code "UTC003" found');
74 74
 		}
75 75
 
76
-		$actual = $this->object->getItem( $expected->getId(), array( 'text' ) );
76
+		$actual = $this->object->getItem($expected->getId(), array('text'));
77 77
 
78
-		$this->assertEquals( $expected, $actual );
79
-		$this->assertEquals( 3, count( $actual->getListItems( 'text' ) ) );
80
-		$this->assertEquals( 3, count( $actual->getRefItems( 'text' ) ) );
78
+		$this->assertEquals($expected, $actual);
79
+		$this->assertEquals(3, count($actual->getListItems('text')));
80
+		$this->assertEquals(3, count($actual->getRefItems('text')));
81 81
 	}
82 82
 
83 83
 
@@ -85,92 +85,92 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		$item = $this->object->createItem();
87 87
 
88
-		$item->setCode( 'unitTest' );
89
-		$item->setLabel( 'unitTest' );
90
-		$resultSaved = $this->object->saveItem( $item );
91
-		$itemSaved = $this->object->getItem( $item->getId() );
88
+		$item->setCode('unitTest');
89
+		$item->setLabel('unitTest');
90
+		$resultSaved = $this->object->saveItem($item);
91
+		$itemSaved = $this->object->getItem($item->getId());
92 92
 
93 93
 		$itemExp = clone $itemSaved;
94
-		$itemExp->setCode( 'unitTest2' );
95
-		$itemExp->setLabel( 'unitTest2' );
96
-		$resultUpd = $this->object->saveItem( $itemExp );
97
-		$itemUpd = $this->object->getItem( $itemExp->getId() );
98
-
99
-		$this->object->deleteItem( $item->getId() );
100
-
101
-		$this->assertTrue( $item->getId() !== null );
102
-		$this->assertEquals( $item->getId(), $itemSaved->getId() );
103
-		$this->assertEquals( $item->getSiteId(), $itemSaved->getSiteId() );
104
-		$this->assertEquals( $item->getStatus(), $itemSaved->getStatus() );
105
-		$this->assertEquals( $item->getCode(), $itemSaved->getCode() );
106
-		$this->assertEquals( $item->getLabel(), $itemSaved->getLabel() );
107
-		$this->assertEquals( $item->getPaymentAddress(), $itemSaved->getPaymentAddress() );
108
-		$this->assertEquals( $item->getBirthday(), $itemSaved->getBirthday() );
109
-		$this->assertEquals( $item->getPassword(), $itemSaved->getPassword() );
110
-
111
-		$this->assertEquals( $this->editor, $itemSaved->getEditor() );
112
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() );
113
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() );
114
-
115
-		$this->assertEquals( $itemExp->getId(), $itemUpd->getId() );
116
-		$this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() );
117
-		$this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() );
118
-		$this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() );
119
-		$this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() );
120
-		$this->assertEquals( $itemExp->getPaymentAddress(), $itemUpd->getPaymentAddress() );
121
-		$this->assertEquals( $itemExp->getBirthday(), $itemUpd->getBirthday() );
122
-		$this->assertEquals( $itemExp->getPassword(), $itemUpd->getPassword() );
123
-
124
-		$this->assertEquals( $this->editor, $itemUpd->getEditor() );
125
-		$this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() );
126
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() );
127
-
128
-		$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultSaved );
129
-		$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Iface', $resultUpd );
130
-
131
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
132
-		$this->object->getItem( $item->getId() );
94
+		$itemExp->setCode('unitTest2');
95
+		$itemExp->setLabel('unitTest2');
96
+		$resultUpd = $this->object->saveItem($itemExp);
97
+		$itemUpd = $this->object->getItem($itemExp->getId());
98
+
99
+		$this->object->deleteItem($item->getId());
100
+
101
+		$this->assertTrue($item->getId() !== null);
102
+		$this->assertEquals($item->getId(), $itemSaved->getId());
103
+		$this->assertEquals($item->getSiteId(), $itemSaved->getSiteId());
104
+		$this->assertEquals($item->getStatus(), $itemSaved->getStatus());
105
+		$this->assertEquals($item->getCode(), $itemSaved->getCode());
106
+		$this->assertEquals($item->getLabel(), $itemSaved->getLabel());
107
+		$this->assertEquals($item->getPaymentAddress(), $itemSaved->getPaymentAddress());
108
+		$this->assertEquals($item->getBirthday(), $itemSaved->getBirthday());
109
+		$this->assertEquals($item->getPassword(), $itemSaved->getPassword());
110
+
111
+		$this->assertEquals($this->editor, $itemSaved->getEditor());
112
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated());
113
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified());
114
+
115
+		$this->assertEquals($itemExp->getId(), $itemUpd->getId());
116
+		$this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId());
117
+		$this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus());
118
+		$this->assertEquals($itemExp->getCode(), $itemUpd->getCode());
119
+		$this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel());
120
+		$this->assertEquals($itemExp->getPaymentAddress(), $itemUpd->getPaymentAddress());
121
+		$this->assertEquals($itemExp->getBirthday(), $itemUpd->getBirthday());
122
+		$this->assertEquals($itemExp->getPassword(), $itemUpd->getPassword());
123
+
124
+		$this->assertEquals($this->editor, $itemUpd->getEditor());
125
+		$this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated());
126
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified());
127
+
128
+		$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Iface', $resultSaved);
129
+		$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Iface', $resultUpd);
130
+
131
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
132
+		$this->object->getItem($item->getId());
133 133
 	}
134 134
 
135 135
 
136 136
 	public function testGetSaveAddressItems()
137 137
 	{
138
-		$item = $this->object->findItem( 'UTC001', ['customer/address'] );
138
+		$item = $this->object->findItem('UTC001', ['customer/address']);
139 139
 
140
-		$item->setId( null )->setCode( 'xyz' );
141
-		$item->getPaymentAddress()->setEmail( '[email protected]' );
142
-		$item->addAddressItem( new \Aimeos\MShop\Common\Item\Address\Standard( 'customer.address.' ) );
143
-		$this->object->saveItem( $item );
140
+		$item->setId(null)->setCode('xyz');
141
+		$item->getPaymentAddress()->setEmail('[email protected]');
142
+		$item->addAddressItem(new \Aimeos\MShop\Common\Item\Address\Standard('customer.address.'));
143
+		$this->object->saveItem($item);
144 144
 
145
-		$item2 = $this->object->findItem( 'xyz', ['customer/address'] );
145
+		$item2 = $this->object->findItem('xyz', ['customer/address']);
146 146
 
147
-		$this->object->deleteItem( $item->getId() );
147
+		$this->object->deleteItem($item->getId());
148 148
 
149
-		$this->assertEquals( 2, count( $item->getAddressItems() ) );
150
-		$this->assertEquals( 2, count( $item2->getAddressItems() ) );
149
+		$this->assertEquals(2, count($item->getAddressItems()));
150
+		$this->assertEquals(2, count($item2->getAddressItems()));
151 151
 	}
152 152
 
153 153
 
154 154
 	public function testGetSavePropertyItems()
155 155
 	{
156
-		$item = $this->object->findItem( 'UTC001', ['customer/property'] );
156
+		$item = $this->object->findItem('UTC001', ['customer/property']);
157 157
 
158
-		$item->setId( null )->setCode( 'xyz' );
159
-		$item->getPaymentAddress()->setEmail( '[email protected]' );
160
-		$this->object->saveItem( $item );
158
+		$item->setId(null)->setCode('xyz');
159
+		$item->getPaymentAddress()->setEmail('[email protected]');
160
+		$this->object->saveItem($item);
161 161
 
162
-		$item2 = $this->object->findItem( 'xyz', ['customer/property'] );
162
+		$item2 = $this->object->findItem('xyz', ['customer/property']);
163 163
 
164
-		$this->object->deleteItem( $item->getId() );
164
+		$this->object->deleteItem($item->getId());
165 165
 
166
-		$this->assertEquals( 1, count( $item->getPropertyItems() ) );
167
-		$this->assertEquals( 1, count( $item2->getPropertyItems() ) );
166
+		$this->assertEquals(1, count($item->getPropertyItems()));
167
+		$this->assertEquals(1, count($item2->getPropertyItems()));
168 168
 	}
169 169
 
170 170
 
171 171
 	public function testCreateSearch()
172 172
 	{
173
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch() );
173
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch());
174 174
 	}
175 175
 
176 176
 
@@ -180,69 +180,69 @@  discard block
 block discarded – undo
180 180
 		$search = $this->object->createSearch();
181 181
 
182 182
 		$expr = [];
183
-		$expr[] = $search->compare( '!=', 'customer.id', null );
184
-		$expr[] = $search->compare( '==', 'customer.label', 'unitCustomer2' );
185
-		$expr[] = $search->compare( '==', 'customer.code', 'UTC002' );
186
-
187
-		$expr[] = $search->compare( '>=', 'customer.salutation', '' );
188
-		$expr[] = $search->compare( '>=', 'customer.company', '' );
189
-		$expr[] = $search->compare( '>=', 'customer.vatid', '' );
190
-		$expr[] = $search->compare( '>=', 'customer.title', '' );
191
-		$expr[] = $search->compare( '>=', 'customer.firstname', '' );
192
-		$expr[] = $search->compare( '>=', 'customer.lastname', '' );
193
-		$expr[] = $search->compare( '>=', 'customer.address1', '' );
194
-		$expr[] = $search->compare( '>=', 'customer.address2', '' );
195
-		$expr[] = $search->compare( '>=', 'customer.address3', '' );
196
-		$expr[] = $search->compare( '>=', 'customer.postal', '' );
197
-		$expr[] = $search->compare( '>=', 'customer.city', '' );
198
-		$expr[] = $search->compare( '>=', 'customer.state', '' );
199
-		$expr[] = $search->compare( '!=', 'customer.languageid', null );
200
-		$expr[] = $search->compare( '>=', 'customer.countryid', '' );
201
-		$expr[] = $search->compare( '>=', 'customer.telephone', '' );
202
-		$expr[] = $search->compare( '>=', 'customer.email', '' );
203
-		$expr[] = $search->compare( '>=', 'customer.telefax', '' );
204
-		$expr[] = $search->compare( '>=', 'customer.website', '' );
205
-		$expr[] = $search->compare( '>=', 'customer.longitude', '10.0' );
206
-		$expr[] = $search->compare( '>=', 'customer.latitude', '50.0' );
207
-
208
-		$expr[] = $search->compare( '==', 'customer.birthday', '1970-01-01' );
209
-		$expr[] = $search->compare( '>=', 'customer.password', '' );
210
-		$expr[] = $search->compare( '==', 'customer.status', 0 );
211
-		$expr[] = $search->compare( '!=', 'customer.mtime', '1970-01-01 00:00:00' );
212
-		$expr[] = $search->compare( '!=', 'customer.ctime', '1970-01-01 00:00:00' );
213
-		$expr[] = $search->compare( '==', 'customer.editor', $this->editor );
214
-
215
-		$expr[] = $search->compare( '!=', 'customer.address.id', null );
216
-		$expr[] = $search->compare( '!=', 'customer.address.parentid', null );
217
-		$expr[] = $search->compare( '==', 'customer.address.company', 'ABC GmbH' );
218
-		$expr[] = $search->compare( '==', 'customer.address.vatid', 'DE999999999' );
219
-		$expr[] = $search->compare( '==', 'customer.address.salutation', 'mr' );
220
-		$expr[] = $search->compare( '==', 'customer.address.title', 'Dr.' );
221
-		$expr[] = $search->compare( '==', 'customer.address.firstname', 'Good' );
222
-		$expr[] = $search->compare( '==', 'customer.address.lastname', 'Unittest' );
223
-		$expr[] = $search->compare( '==', 'customer.address.address1', 'Pickhuben' );
224
-		$expr[] = $search->compare( '==', 'customer.address.address2', '2-4' );
225
-		$expr[] = $search->compare( '==', 'customer.address.address3', '' );
226
-		$expr[] = $search->compare( '==', 'customer.address.postal', '11099' );
227
-		$expr[] = $search->compare( '==', 'customer.address.city', 'Berlin' );
228
-		$expr[] = $search->compare( '==', 'customer.address.state', 'Berlin' );
229
-		$expr[] = $search->compare( '==', 'customer.address.languageid', 'de' );
230
-		$expr[] = $search->compare( '==', 'customer.address.countryid', 'DE' );
231
-		$expr[] = $search->compare( '==', 'customer.address.telephone', '055544332221' );
232
-		$expr[] = $search->compare( '==', 'customer.address.email', '[email protected]' );
233
-		$expr[] = $search->compare( '==', 'customer.address.telefax', '055544333212' );
234
-		$expr[] = $search->compare( '==', 'customer.address.website', 'unittest.aimeos.org' );
235
-		$expr[] = $search->compare( '>=', 'customer.address.longitude', '10.0' );
236
-		$expr[] = $search->compare( '>=', 'customer.address.latitude', '50.0' );
237
-		$expr[] = $search->compare( '==', 'customer.address.flag', 0 );
238
-		$expr[] = $search->compare( '==', 'customer.address.position', 1 );
239
-		$expr[] = $search->compare( '!=', 'customer.address.mtime', '1970-01-01 00:00:00' );
240
-		$expr[] = $search->compare( '!=', 'customer.address.ctime', '1970-01-01 00:00:00' );
241
-		$expr[] = $search->compare( '==', 'customer.address.editor', $this->editor );
242
-
243
-		$search->setConditions( $search->combine( '&&', $expr ) );
244
-		$result = $this->object->searchItems( $search, [], $total );
245
-		$this->assertEquals( 1, count( $result ) );
183
+		$expr[] = $search->compare('!=', 'customer.id', null);
184
+		$expr[] = $search->compare('==', 'customer.label', 'unitCustomer2');
185
+		$expr[] = $search->compare('==', 'customer.code', 'UTC002');
186
+
187
+		$expr[] = $search->compare('>=', 'customer.salutation', '');
188
+		$expr[] = $search->compare('>=', 'customer.company', '');
189
+		$expr[] = $search->compare('>=', 'customer.vatid', '');
190
+		$expr[] = $search->compare('>=', 'customer.title', '');
191
+		$expr[] = $search->compare('>=', 'customer.firstname', '');
192
+		$expr[] = $search->compare('>=', 'customer.lastname', '');
193
+		$expr[] = $search->compare('>=', 'customer.address1', '');
194
+		$expr[] = $search->compare('>=', 'customer.address2', '');
195
+		$expr[] = $search->compare('>=', 'customer.address3', '');
196
+		$expr[] = $search->compare('>=', 'customer.postal', '');
197
+		$expr[] = $search->compare('>=', 'customer.city', '');
198
+		$expr[] = $search->compare('>=', 'customer.state', '');
199
+		$expr[] = $search->compare('!=', 'customer.languageid', null);
200
+		$expr[] = $search->compare('>=', 'customer.countryid', '');
201
+		$expr[] = $search->compare('>=', 'customer.telephone', '');
202
+		$expr[] = $search->compare('>=', 'customer.email', '');
203
+		$expr[] = $search->compare('>=', 'customer.telefax', '');
204
+		$expr[] = $search->compare('>=', 'customer.website', '');
205
+		$expr[] = $search->compare('>=', 'customer.longitude', '10.0');
206
+		$expr[] = $search->compare('>=', 'customer.latitude', '50.0');
207
+
208
+		$expr[] = $search->compare('==', 'customer.birthday', '1970-01-01');
209
+		$expr[] = $search->compare('>=', 'customer.password', '');
210
+		$expr[] = $search->compare('==', 'customer.status', 0);
211
+		$expr[] = $search->compare('!=', 'customer.mtime', '1970-01-01 00:00:00');
212
+		$expr[] = $search->compare('!=', 'customer.ctime', '1970-01-01 00:00:00');
213
+		$expr[] = $search->compare('==', 'customer.editor', $this->editor);
214
+
215
+		$expr[] = $search->compare('!=', 'customer.address.id', null);
216
+		$expr[] = $search->compare('!=', 'customer.address.parentid', null);
217
+		$expr[] = $search->compare('==', 'customer.address.company', 'ABC GmbH');
218
+		$expr[] = $search->compare('==', 'customer.address.vatid', 'DE999999999');
219
+		$expr[] = $search->compare('==', 'customer.address.salutation', 'mr');
220
+		$expr[] = $search->compare('==', 'customer.address.title', 'Dr.');
221
+		$expr[] = $search->compare('==', 'customer.address.firstname', 'Good');
222
+		$expr[] = $search->compare('==', 'customer.address.lastname', 'Unittest');
223
+		$expr[] = $search->compare('==', 'customer.address.address1', 'Pickhuben');
224
+		$expr[] = $search->compare('==', 'customer.address.address2', '2-4');
225
+		$expr[] = $search->compare('==', 'customer.address.address3', '');
226
+		$expr[] = $search->compare('==', 'customer.address.postal', '11099');
227
+		$expr[] = $search->compare('==', 'customer.address.city', 'Berlin');
228
+		$expr[] = $search->compare('==', 'customer.address.state', 'Berlin');
229
+		$expr[] = $search->compare('==', 'customer.address.languageid', 'de');
230
+		$expr[] = $search->compare('==', 'customer.address.countryid', 'DE');
231
+		$expr[] = $search->compare('==', 'customer.address.telephone', '055544332221');
232
+		$expr[] = $search->compare('==', 'customer.address.email', '[email protected]');
233
+		$expr[] = $search->compare('==', 'customer.address.telefax', '055544333212');
234
+		$expr[] = $search->compare('==', 'customer.address.website', 'unittest.aimeos.org');
235
+		$expr[] = $search->compare('>=', 'customer.address.longitude', '10.0');
236
+		$expr[] = $search->compare('>=', 'customer.address.latitude', '50.0');
237
+		$expr[] = $search->compare('==', 'customer.address.flag', 0);
238
+		$expr[] = $search->compare('==', 'customer.address.position', 1);
239
+		$expr[] = $search->compare('!=', 'customer.address.mtime', '1970-01-01 00:00:00');
240
+		$expr[] = $search->compare('!=', 'customer.address.ctime', '1970-01-01 00:00:00');
241
+		$expr[] = $search->compare('==', 'customer.address.editor', $this->editor);
242
+
243
+		$search->setConditions($search->combine('&&', $expr));
244
+		$result = $this->object->searchItems($search, [], $total);
245
+		$this->assertEquals(1, count($result));
246 246
 	}
247 247
 
248 248
 
@@ -251,60 +251,60 @@  discard block
 block discarded – undo
251 251
 		$total = 0;
252 252
 
253 253
 		$search = $this->object->createSearch();
254
-		$search->setConditions( $search->compare( '==', 'customer.address.editor', $this->editor ) );
255
-		$search->setSlice( 0, 2 );
254
+		$search->setConditions($search->compare('==', 'customer.address.editor', $this->editor));
255
+		$search->setSlice(0, 2);
256 256
 
257
-		$results = $this->object->searchItems( $search, [], $total );
258
-		$this->assertEquals( 2, count( $results ) );
259
-		$this->assertEquals( 3, $total );
257
+		$results = $this->object->searchItems($search, [], $total);
258
+		$this->assertEquals(2, count($results));
259
+		$this->assertEquals(3, $total);
260 260
 
261
-		foreach($results as $itemId => $item) {
262
-			$this->assertEquals( $itemId, $item->getId() );
261
+		foreach ($results as $itemId => $item) {
262
+			$this->assertEquals($itemId, $item->getId());
263 263
 		}
264 264
 	}
265 265
 
266 266
 
267 267
 	public function testSearchItemsCriteria()
268 268
 	{
269
-		$search = $this->object->createSearch( true );
269
+		$search = $this->object->createSearch(true);
270 270
 		$conditions = array(
271
-			$search->compare( '==', 'customer.address.editor', $this->editor ),
271
+			$search->compare('==', 'customer.address.editor', $this->editor),
272 272
 			$search->getConditions()
273 273
 		);
274
-		$search->setConditions( $search->combine( '&&', $conditions ) );
275
-		$this->assertEquals( 2, count( $this->object->searchItems( $search, [], $total ) ) );
274
+		$search->setConditions($search->combine('&&', $conditions));
275
+		$this->assertEquals(2, count($this->object->searchItems($search, [], $total)));
276 276
 	}
277 277
 
278 278
 
279 279
 	public function testSearchItemsRef()
280 280
 	{
281 281
 		$search = $this->object->createSearch();
282
-		$search->setConditions( $search->compare( '==', 'customer.code', 'UTC001' ) );
282
+		$search->setConditions($search->compare('==', 'customer.code', 'UTC001'));
283 283
 
284
-		$results = $this->object->searchItems( $search, ['customer/address', 'text'] );
284
+		$results = $this->object->searchItems($search, ['customer/address', 'text']);
285 285
 
286
-		if( ( $item = reset( $results ) ) === false ) {
287
-			throw new \Exception( 'No customer item for "UTC001" available' );
286
+		if (($item = reset($results)) === false) {
287
+			throw new \Exception('No customer item for "UTC001" available');
288 288
 		}
289 289
 
290
-		$this->assertEquals( 1, count( $item->getRefItems( 'text' ) ) );
291
-		$this->assertEquals( 1, count( $item->getAddressItems() ) );
290
+		$this->assertEquals(1, count($item->getRefItems('text')));
291
+		$this->assertEquals(1, count($item->getAddressItems()));
292 292
 	}
293 293
 
294 294
 
295 295
 	public function testGetSubManager()
296 296
 	{
297
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address' ) );
298
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address', 'Standard' ) );
297
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('address'));
298
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('address', 'Standard'));
299 299
 
300
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
301
-		$this->object->getSubManager( 'unknown' );
300
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
301
+		$this->object->getSubManager('unknown');
302 302
 	}
303 303
 
304 304
 
305 305
 	public function testGetSubManagerInvalidName()
306 306
 	{
307
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
308
-		$this->object->getSubManager( 'address', 'unknown' );
307
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
308
+		$this->object->getSubManager('address', 'unknown');
309 309
 	}
310 310
 }
Please login to merge, or discard this patch.