Completed
Push — master ( 65beba...94b58b )
by Aimeos
02:04
created
lib/custom/src/MShop/Customer/Manager/Laravel.php 1 patch
Spacing   +77 added lines, -77 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,31 +294,31 @@  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
-			return $this->saveRefItems( $item, 'customer' );
306
+			$item = $this->savePropertyItems($item, 'customer');
307
+			return $this->saveRefItems($item, 'customer');
308 308
 		}
309 309
 
310 310
 		$context = $this->getContext();
311 311
 		$dbm = $context->getDatabaseManager();
312 312
 		$dbname = $this->getResourceName();
313
-		$conn = $dbm->acquire( $dbname );
313
+		$conn = $dbm->acquire($dbname);
314 314
 
315 315
 		try
316 316
 		{
317 317
 			$id = $item->getId();
318
-			$date = date( 'Y-m-d H:i:s' );
318
+			$date = date('Y-m-d H:i:s');
319 319
 			$billingAddress = $item->getPaymentAddress();
320 320
 
321
-			if( $id === null )
321
+			if ($id === null)
322 322
 			{
323 323
 				/** mshop/customer/manager/laravel/insert
324 324
 				 * Inserts a new customer record into the database table
@@ -382,48 +382,48 @@  discard block
 block discarded – undo
382 382
 				$path = 'mshop/customer/manager/laravel/update';
383 383
 			}
384 384
 
385
-			$stmt = $this->getCachedStatement( $conn, $path );
386
-
387
-			$stmt->bind( 1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
388
-			$stmt->bind( 2, $item->getCode() );
389
-			$stmt->bind( 3, $billingAddress->getCompany() );
390
-			$stmt->bind( 4, $billingAddress->getVatID() );
391
-			$stmt->bind( 5, $billingAddress->getSalutation() );
392
-			$stmt->bind( 6, $billingAddress->getTitle() );
393
-			$stmt->bind( 7, $billingAddress->getFirstname() );
394
-			$stmt->bind( 8, $billingAddress->getLastname() );
395
-			$stmt->bind( 9, $billingAddress->getAddress1() );
396
-			$stmt->bind( 10, $billingAddress->getAddress2() );
397
-			$stmt->bind( 11, $billingAddress->getAddress3() );
398
-			$stmt->bind( 12, $billingAddress->getPostal() );
399
-			$stmt->bind( 13, $billingAddress->getCity() );
400
-			$stmt->bind( 14, $billingAddress->getState() );
401
-			$stmt->bind( 15, $billingAddress->getCountryId() );
402
-			$stmt->bind( 16, $billingAddress->getLanguageId() );
403
-			$stmt->bind( 17, $billingAddress->getTelephone() );
404
-			$stmt->bind( 18, $billingAddress->getTelefax() );
405
-			$stmt->bind( 19, $billingAddress->getWebsite() );
406
-			$stmt->bind( 20, $billingAddress->getEmail() );
407
-			$stmt->bind( 21, $billingAddress->getLongitude() );
408
-			$stmt->bind( 22, $billingAddress->getLatitude() );
409
-			$stmt->bind( 23, $item->getLabel() );
410
-			$stmt->bind( 24, $item->getBirthday() );
411
-			$stmt->bind( 25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
412
-			$stmt->bind( 26, $item->getDateVerified() );
413
-			$stmt->bind( 27, $item->getPassword() );
414
-			$stmt->bind( 28, $date ); // Modification time
415
-			$stmt->bind( 29, $context->getEditor() );
416
-
417
-			if( $id !== null ) {
418
-				$stmt->bind( 30, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
419
-				$item->setId( $id );
385
+			$stmt = $this->getCachedStatement($conn, $path);
386
+
387
+			$stmt->bind(1, $context->getLocale()->getSiteId(), \Aimeos\MW\DB\Statement\Base::PARAM_INT);
388
+			$stmt->bind(2, $item->getCode());
389
+			$stmt->bind(3, $billingAddress->getCompany());
390
+			$stmt->bind(4, $billingAddress->getVatID());
391
+			$stmt->bind(5, $billingAddress->getSalutation());
392
+			$stmt->bind(6, $billingAddress->getTitle());
393
+			$stmt->bind(7, $billingAddress->getFirstname());
394
+			$stmt->bind(8, $billingAddress->getLastname());
395
+			$stmt->bind(9, $billingAddress->getAddress1());
396
+			$stmt->bind(10, $billingAddress->getAddress2());
397
+			$stmt->bind(11, $billingAddress->getAddress3());
398
+			$stmt->bind(12, $billingAddress->getPostal());
399
+			$stmt->bind(13, $billingAddress->getCity());
400
+			$stmt->bind(14, $billingAddress->getState());
401
+			$stmt->bind(15, $billingAddress->getCountryId());
402
+			$stmt->bind(16, $billingAddress->getLanguageId());
403
+			$stmt->bind(17, $billingAddress->getTelephone());
404
+			$stmt->bind(18, $billingAddress->getTelefax());
405
+			$stmt->bind(19, $billingAddress->getWebsite());
406
+			$stmt->bind(20, $billingAddress->getEmail());
407
+			$stmt->bind(21, $billingAddress->getLongitude());
408
+			$stmt->bind(22, $billingAddress->getLatitude());
409
+			$stmt->bind(23, $item->getLabel());
410
+			$stmt->bind(24, $item->getBirthday());
411
+			$stmt->bind(25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT);
412
+			$stmt->bind(26, $item->getDateVerified());
413
+			$stmt->bind(27, $item->getPassword());
414
+			$stmt->bind(28, $date); // Modification time
415
+			$stmt->bind(29, $context->getEditor());
416
+
417
+			if ($id !== null) {
418
+				$stmt->bind(30, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
419
+				$item->setId($id);
420 420
 			} else {
421
-				$stmt->bind( 30, $date ); // Creation time
421
+				$stmt->bind(30, $date); // Creation time
422 422
 			}
423 423
 
424 424
 			$stmt->execute()->finish();
425 425
 
426
-			if( $id === null && $fetch === true )
426
+			if ($id === null && $fetch === true)
427 427
 			{
428 428
 				/** mshop/customer/manager/laravel/newid
429 429
 				 * Retrieves the ID generated by the database when inserting a new record
@@ -456,21 +456,21 @@  discard block
 block discarded – undo
456 456
 				 * @see mshop/customer/manager/laravel/count
457 457
 				 */
458 458
 				$path = 'mshop/customer/manager/laravel/newid';
459
-				$item->setId( $this->newId( $conn, $path ) );
459
+				$item->setId($this->newId($conn, $path));
460 460
 			}
461 461
 
462
-			$dbm->release( $conn, $dbname );
462
+			$dbm->release($conn, $dbname);
463 463
 		}
464
-		catch( \Exception $e )
464
+		catch (\Exception $e)
465 465
 		{
466
-			$dbm->release( $conn, $dbname );
466
+			$dbm->release($conn, $dbname);
467 467
 			throw $e;
468 468
 		}
469 469
 
470
-		$this->addGroups( $item );
470
+		$this->addGroups($item);
471 471
 
472
-		$item = $this->savePropertyItems( $item, 'customer' );
473
-		return $this->saveRefItems( $item, 'customer' );
472
+		$item = $this->savePropertyItems($item, 'customer');
473
+		return $this->saveRefItems($item, 'customer');
474 474
 	}
475 475
 
476 476
 
@@ -482,11 +482,11 @@  discard block
 block discarded – undo
482 482
 	 * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface
483 483
 	 * @throws \Aimeos\MShop\Customer\Exception If creating items failed
484 484
 	 */
485
-	public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null )
485
+	public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = [], &$total = null)
486 486
 	{
487 487
 		$dbm = $this->getContext()->getDatabaseManager();
488 488
 		$dbname = $this->getResourceName();
489
-		$conn = $dbm->acquire( $dbname );
489
+		$conn = $dbm->acquire($dbname);
490 490
 		$map = [];
491 491
 
492 492
 		try
@@ -494,32 +494,32 @@  discard block
 block discarded – undo
494 494
 			$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
495 495
 			$cfgPathSearch = 'mshop/customer/manager/laravel/search';
496 496
 			$cfgPathCount = 'mshop/customer/manager/laravel/count';
497
-			$required = array( 'customer' );
497
+			$required = array('customer');
498 498
 
499
-			$results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );
500
-			while( ( $row = $results->fetch() ) !== false ) {
501
-				$map[ $row['customer.id'] ] = $row;
499
+			$results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level);
500
+			while (($row = $results->fetch()) !== false) {
501
+				$map[$row['customer.id']] = $row;
502 502
 			}
503 503
 
504
-			$dbm->release( $conn, $dbname );
504
+			$dbm->release($conn, $dbname);
505 505
 		}
506
-		catch( \Exception $e )
506
+		catch (\Exception $e)
507 507
 		{
508
-			$dbm->release( $conn, $dbname  );
508
+			$dbm->release($conn, $dbname);
509 509
 			throw $e;
510 510
 		}
511 511
 
512 512
 		$addrItems = [];
513
-		if( in_array( 'customer/address', $ref, true ) ) {
514
-			$addrItems = $this->getAddressItems( array_keys( $map ) );
513
+		if (in_array('customer/address', $ref, true)) {
514
+			$addrItems = $this->getAddressItems(array_keys($map));
515 515
 		}
516 516
 
517 517
 		$propItems = [];
518
-		if( in_array( 'customer/property', $ref, true ) ) {
519
-			$propItems = $this->getPropertyItems( array_keys( $map ), 'customer' );
518
+		if (in_array('customer/property', $ref, true)) {
519
+			$propItems = $this->getPropertyItems(array_keys($map), 'customer');
520 520
 		}
521 521
 
522
-		return $this->buildItems( $map, $ref, 'customer', $addrItems, $propItems );
522
+		return $this->buildItems($map, $ref, 'customer', $addrItems, $propItems);
523 523
 	}
524 524
 
525 525
 
@@ -530,8 +530,8 @@  discard block
 block discarded – undo
530 530
 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
531 531
 	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
532 532
 	 */
533
-	public function getSubManager( $manager, $name = null )
533
+	public function getSubManager($manager, $name = null)
534 534
 	{
535
-		return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'Laravel' : $name ) );
535
+		return $this->getSubManagerBase('customer', $manager, ($name === null ? 'Laravel' : $name));
536 536
 	}
537 537
 }
Please login to merge, or discard this patch.
lib/custom/tests/MShop/Customer/Manager/LaravelTest.php 1 patch
Spacing   +155 added lines, -155 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,74 +85,74 @@  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 testGetSavePropertyItems()
137 137
 	{
138
-		$item = $this->object->findItem( 'UTC001', ['customer/property'] );
138
+		$item = $this->object->findItem('UTC001', ['customer/property']);
139 139
 
140
-		$item->setId( null )->setCode( 'xyz' );
141
-		$item->getPaymentAddress()->setEmail( '[email protected]' );
142
-		$this->object->saveItem( $item );
140
+		$item->setId(null)->setCode('xyz');
141
+		$item->getPaymentAddress()->setEmail('[email protected]');
142
+		$this->object->saveItem($item);
143 143
 
144
-		$item2 = $this->object->findItem( 'UTC001', ['customer/property'] );
144
+		$item2 = $this->object->findItem('UTC001', ['customer/property']);
145 145
 
146
-		$this->object->deleteItem( $item->getId() );
146
+		$this->object->deleteItem($item->getId());
147 147
 
148
-		$this->assertEquals( 1, count( $item->getPropertyItems() ) );
149
-		$this->assertEquals( 1, count( $item2->getPropertyItems() ) );
148
+		$this->assertEquals(1, count($item->getPropertyItems()));
149
+		$this->assertEquals(1, count($item2->getPropertyItems()));
150 150
 	}
151 151
 
152 152
 
153 153
 	public function testCreateSearch()
154 154
 	{
155
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch() );
155
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch());
156 156
 	}
157 157
 
158 158
 
@@ -162,69 +162,69 @@  discard block
 block discarded – undo
162 162
 		$search = $this->object->createSearch();
163 163
 
164 164
 		$expr = [];
165
-		$expr[] = $search->compare( '!=', 'customer.id', null );
166
-		$expr[] = $search->compare( '==', 'customer.label', 'unitCustomer2' );
167
-		$expr[] = $search->compare( '==', 'customer.code', 'UTC002' );
168
-
169
-		$expr[] = $search->compare( '>=', 'customer.salutation', '' );
170
-		$expr[] = $search->compare( '>=', 'customer.company', '' );
171
-		$expr[] = $search->compare( '>=', 'customer.vatid', '' );
172
-		$expr[] = $search->compare( '>=', 'customer.title', '' );
173
-		$expr[] = $search->compare( '>=', 'customer.firstname', '' );
174
-		$expr[] = $search->compare( '>=', 'customer.lastname', '' );
175
-		$expr[] = $search->compare( '>=', 'customer.address1', '' );
176
-		$expr[] = $search->compare( '>=', 'customer.address2', '' );
177
-		$expr[] = $search->compare( '>=', 'customer.address3', '' );
178
-		$expr[] = $search->compare( '>=', 'customer.postal', '' );
179
-		$expr[] = $search->compare( '>=', 'customer.city', '' );
180
-		$expr[] = $search->compare( '>=', 'customer.state', '' );
181
-		$expr[] = $search->compare( '!=', 'customer.languageid', null );
182
-		$expr[] = $search->compare( '>=', 'customer.countryid', '' );
183
-		$expr[] = $search->compare( '>=', 'customer.telephone', '' );
184
-		$expr[] = $search->compare( '>=', 'customer.email', '' );
185
-		$expr[] = $search->compare( '>=', 'customer.telefax', '' );
186
-		$expr[] = $search->compare( '>=', 'customer.website', '' );
187
-		$expr[] = $search->compare( '>=', 'customer.longitude', '10.0' );
188
-		$expr[] = $search->compare( '>=', 'customer.latitude', '50.0' );
189
-
190
-		$expr[] = $search->compare( '==', 'customer.birthday', '1970-01-01' );
191
-		$expr[] = $search->compare( '>=', 'customer.password', '' );
192
-		$expr[] = $search->compare( '==', 'customer.status', 0 );
193
-		$expr[] = $search->compare( '!=', 'customer.mtime', '1970-01-01 00:00:00' );
194
-		$expr[] = $search->compare( '!=', 'customer.ctime', '1970-01-01 00:00:00' );
195
-		$expr[] = $search->compare( '==', 'customer.editor', $this->editor );
196
-
197
-		$expr[] = $search->compare( '!=', 'customer.address.id', null );
198
-		$expr[] = $search->compare( '!=', 'customer.address.parentid', null );
199
-		$expr[] = $search->compare( '==', 'customer.address.company', 'ABC GmbH' );
200
-		$expr[] = $search->compare( '==', 'customer.address.vatid', 'DE999999999' );
201
-		$expr[] = $search->compare( '==', 'customer.address.salutation', 'mr' );
202
-		$expr[] = $search->compare( '==', 'customer.address.title', 'Dr.' );
203
-		$expr[] = $search->compare( '==', 'customer.address.firstname', 'Good' );
204
-		$expr[] = $search->compare( '==', 'customer.address.lastname', 'Unittest' );
205
-		$expr[] = $search->compare( '==', 'customer.address.address1', 'Pickhuben' );
206
-		$expr[] = $search->compare( '==', 'customer.address.address2', '2-4' );
207
-		$expr[] = $search->compare( '==', 'customer.address.address3', '' );
208
-		$expr[] = $search->compare( '==', 'customer.address.postal', '11099' );
209
-		$expr[] = $search->compare( '==', 'customer.address.city', 'Berlin' );
210
-		$expr[] = $search->compare( '==', 'customer.address.state', 'Berlin' );
211
-		$expr[] = $search->compare( '==', 'customer.address.languageid', 'de' );
212
-		$expr[] = $search->compare( '==', 'customer.address.countryid', 'DE' );
213
-		$expr[] = $search->compare( '==', 'customer.address.telephone', '055544332221' );
214
-		$expr[] = $search->compare( '==', 'customer.address.email', '[email protected]' );
215
-		$expr[] = $search->compare( '==', 'customer.address.telefax', '055544333212' );
216
-		$expr[] = $search->compare( '==', 'customer.address.website', 'unittest.aimeos.org' );
217
-		$expr[] = $search->compare( '>=', 'customer.address.longitude', '10.0' );
218
-		$expr[] = $search->compare( '>=', 'customer.address.latitude', '50.0' );
219
-		$expr[] = $search->compare( '==', 'customer.address.flag', 0 );
220
-		$expr[] = $search->compare( '==', 'customer.address.position', 1 );
221
-		$expr[] = $search->compare( '!=', 'customer.address.mtime', '1970-01-01 00:00:00' );
222
-		$expr[] = $search->compare( '!=', 'customer.address.ctime', '1970-01-01 00:00:00' );
223
-		$expr[] = $search->compare( '==', 'customer.address.editor', $this->editor );
224
-
225
-		$search->setConditions( $search->combine( '&&', $expr ) );
226
-		$result = $this->object->searchItems( $search, [], $total );
227
-		$this->assertEquals( 1, count( $result ) );
165
+		$expr[] = $search->compare('!=', 'customer.id', null);
166
+		$expr[] = $search->compare('==', 'customer.label', 'unitCustomer2');
167
+		$expr[] = $search->compare('==', 'customer.code', 'UTC002');
168
+
169
+		$expr[] = $search->compare('>=', 'customer.salutation', '');
170
+		$expr[] = $search->compare('>=', 'customer.company', '');
171
+		$expr[] = $search->compare('>=', 'customer.vatid', '');
172
+		$expr[] = $search->compare('>=', 'customer.title', '');
173
+		$expr[] = $search->compare('>=', 'customer.firstname', '');
174
+		$expr[] = $search->compare('>=', 'customer.lastname', '');
175
+		$expr[] = $search->compare('>=', 'customer.address1', '');
176
+		$expr[] = $search->compare('>=', 'customer.address2', '');
177
+		$expr[] = $search->compare('>=', 'customer.address3', '');
178
+		$expr[] = $search->compare('>=', 'customer.postal', '');
179
+		$expr[] = $search->compare('>=', 'customer.city', '');
180
+		$expr[] = $search->compare('>=', 'customer.state', '');
181
+		$expr[] = $search->compare('!=', 'customer.languageid', null);
182
+		$expr[] = $search->compare('>=', 'customer.countryid', '');
183
+		$expr[] = $search->compare('>=', 'customer.telephone', '');
184
+		$expr[] = $search->compare('>=', 'customer.email', '');
185
+		$expr[] = $search->compare('>=', 'customer.telefax', '');
186
+		$expr[] = $search->compare('>=', 'customer.website', '');
187
+		$expr[] = $search->compare('>=', 'customer.longitude', '10.0');
188
+		$expr[] = $search->compare('>=', 'customer.latitude', '50.0');
189
+
190
+		$expr[] = $search->compare('==', 'customer.birthday', '1970-01-01');
191
+		$expr[] = $search->compare('>=', 'customer.password', '');
192
+		$expr[] = $search->compare('==', 'customer.status', 0);
193
+		$expr[] = $search->compare('!=', 'customer.mtime', '1970-01-01 00:00:00');
194
+		$expr[] = $search->compare('!=', 'customer.ctime', '1970-01-01 00:00:00');
195
+		$expr[] = $search->compare('==', 'customer.editor', $this->editor);
196
+
197
+		$expr[] = $search->compare('!=', 'customer.address.id', null);
198
+		$expr[] = $search->compare('!=', 'customer.address.parentid', null);
199
+		$expr[] = $search->compare('==', 'customer.address.company', 'ABC GmbH');
200
+		$expr[] = $search->compare('==', 'customer.address.vatid', 'DE999999999');
201
+		$expr[] = $search->compare('==', 'customer.address.salutation', 'mr');
202
+		$expr[] = $search->compare('==', 'customer.address.title', 'Dr.');
203
+		$expr[] = $search->compare('==', 'customer.address.firstname', 'Good');
204
+		$expr[] = $search->compare('==', 'customer.address.lastname', 'Unittest');
205
+		$expr[] = $search->compare('==', 'customer.address.address1', 'Pickhuben');
206
+		$expr[] = $search->compare('==', 'customer.address.address2', '2-4');
207
+		$expr[] = $search->compare('==', 'customer.address.address3', '');
208
+		$expr[] = $search->compare('==', 'customer.address.postal', '11099');
209
+		$expr[] = $search->compare('==', 'customer.address.city', 'Berlin');
210
+		$expr[] = $search->compare('==', 'customer.address.state', 'Berlin');
211
+		$expr[] = $search->compare('==', 'customer.address.languageid', 'de');
212
+		$expr[] = $search->compare('==', 'customer.address.countryid', 'DE');
213
+		$expr[] = $search->compare('==', 'customer.address.telephone', '055544332221');
214
+		$expr[] = $search->compare('==', 'customer.address.email', '[email protected]');
215
+		$expr[] = $search->compare('==', 'customer.address.telefax', '055544333212');
216
+		$expr[] = $search->compare('==', 'customer.address.website', 'unittest.aimeos.org');
217
+		$expr[] = $search->compare('>=', 'customer.address.longitude', '10.0');
218
+		$expr[] = $search->compare('>=', 'customer.address.latitude', '50.0');
219
+		$expr[] = $search->compare('==', 'customer.address.flag', 0);
220
+		$expr[] = $search->compare('==', 'customer.address.position', 1);
221
+		$expr[] = $search->compare('!=', 'customer.address.mtime', '1970-01-01 00:00:00');
222
+		$expr[] = $search->compare('!=', 'customer.address.ctime', '1970-01-01 00:00:00');
223
+		$expr[] = $search->compare('==', 'customer.address.editor', $this->editor);
224
+
225
+		$search->setConditions($search->combine('&&', $expr));
226
+		$result = $this->object->searchItems($search, [], $total);
227
+		$this->assertEquals(1, count($result));
228 228
 	}
229 229
 
230 230
 
@@ -233,60 +233,60 @@  discard block
 block discarded – undo
233 233
 		$total = 0;
234 234
 
235 235
 		$search = $this->object->createSearch();
236
-		$search->setConditions( $search->compare( '==', 'customer.address.editor', $this->editor ) );
237
-		$search->setSlice( 0, 2 );
236
+		$search->setConditions($search->compare('==', 'customer.address.editor', $this->editor));
237
+		$search->setSlice(0, 2);
238 238
 
239
-		$results = $this->object->searchItems( $search, [], $total );
240
-		$this->assertEquals( 2, count( $results ) );
241
-		$this->assertEquals( 3, $total );
239
+		$results = $this->object->searchItems($search, [], $total);
240
+		$this->assertEquals(2, count($results));
241
+		$this->assertEquals(3, $total);
242 242
 
243
-		foreach($results as $itemId => $item) {
244
-			$this->assertEquals( $itemId, $item->getId() );
243
+		foreach ($results as $itemId => $item) {
244
+			$this->assertEquals($itemId, $item->getId());
245 245
 		}
246 246
 	}
247 247
 
248 248
 
249 249
 	public function testSearchItemsCriteria()
250 250
 	{
251
-		$search = $this->object->createSearch( true );
251
+		$search = $this->object->createSearch(true);
252 252
 		$conditions = array(
253
-			$search->compare( '==', 'customer.address.editor', $this->editor ),
253
+			$search->compare('==', 'customer.address.editor', $this->editor),
254 254
 			$search->getConditions()
255 255
 		);
256
-		$search->setConditions( $search->combine( '&&', $conditions ) );
257
-		$this->assertEquals( 2, count( $this->object->searchItems( $search, [], $total ) ) );
256
+		$search->setConditions($search->combine('&&', $conditions));
257
+		$this->assertEquals(2, count($this->object->searchItems($search, [], $total)));
258 258
 	}
259 259
 
260 260
 
261 261
 	public function testSearchItemsRef()
262 262
 	{
263 263
 		$search = $this->object->createSearch();
264
-		$search->setConditions( $search->compare( '==', 'customer.code', 'UTC001' ) );
264
+		$search->setConditions($search->compare('==', 'customer.code', 'UTC001'));
265 265
 
266
-		$results = $this->object->searchItems( $search, ['customer/address', 'text'] );
266
+		$results = $this->object->searchItems($search, ['customer/address', 'text']);
267 267
 
268
-		if( ( $item = reset( $results ) ) === false ) {
269
-			throw new \Exception( 'No customer item for "UTC001" available' );
268
+		if (($item = reset($results)) === false) {
269
+			throw new \Exception('No customer item for "UTC001" available');
270 270
 		}
271 271
 
272
-		$this->assertEquals( 1, count( $item->getRefItems( 'text' ) ) );
273
-		$this->assertEquals( 1, count( $item->getAddressItems() ) );
272
+		$this->assertEquals(1, count($item->getRefItems('text')));
273
+		$this->assertEquals(1, count($item->getAddressItems()));
274 274
 	}
275 275
 
276 276
 
277 277
 	public function testGetSubManager()
278 278
 	{
279
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address' ) );
280
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address', 'Standard' ) );
279
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('address'));
280
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('address', 'Standard'));
281 281
 
282
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
283
-		$this->object->getSubManager( 'unknown' );
282
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
283
+		$this->object->getSubManager('unknown');
284 284
 	}
285 285
 
286 286
 
287 287
 	public function testGetSubManagerInvalidName()
288 288
 	{
289
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
290
-		$this->object->getSubManager( 'address', 'unknown' );
289
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
290
+		$this->object->getSubManager('address', 'unknown');
291 291
 	}
292 292
 }
Please login to merge, or discard this patch.