Completed
Push — master ( 64fdfa...f07eb7 )
by Aimeos
02:02
created
lib/custom/src/MShop/Customer/Item/FosUser.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 	 * @param \Aimeos\MShop\Common\Item\Iface[] $refItems List of referenced items
34 34
 	 * @param \Aimeos\MShop\Common\Item\Helper\Password\Iface|null $helper Password encryption helper object
35 35
 	 */
36
-	public function __construct( \Aimeos\MShop\Common\Item\Address\Iface $address, array $values = array(),
37
-		array $listItems = array(), array $refItems = array(), \Aimeos\MShop\Common\Item\Helper\Password\Iface $helper = null )
36
+	public function __construct(\Aimeos\MShop\Common\Item\Address\Iface $address, array $values = array(),
37
+		array $listItems = array(), array $refItems = array(), \Aimeos\MShop\Common\Item\Helper\Password\Iface $helper = null)
38 38
 	{
39
-		parent::__construct( $address, $values, $listItems, $refItems, $helper );
39
+		parent::__construct($address, $values, $listItems, $refItems, $helper);
40 40
 
41 41
 		$this->values = $values;
42 42
 		$this->helper = $helper;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function getPassword()
53 53
 	{
54
-		if( isset( $this->values['customer.password'] ) ) {
54
+		if (isset($this->values['customer.password'])) {
55 55
 			return (string) $this->values['customer.password'];
56 56
 		}
57 57
 
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
 	 * @param string $value Password of the customer item
66 66
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item for chaining method calls
67 67
 	 */
68
-	public function setPassword( $value )
68
+	public function setPassword($value)
69 69
 	{
70
-		if( $value == $this->getPassword() ) { return $this; }
70
+		if ($value == $this->getPassword()) { return $this; }
71 71
 
72
-		if( $this->helper !== null ) {
73
-			$value = $this->helper->encode( $value, $this->getSalt() );
72
+		if ($this->helper !== null) {
73
+			$value = $this->helper->encode($value, $this->getSalt());
74 74
 		}
75 75
 
76 76
 		$this->values['customer.password'] = (string) $value;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function getRoles()
89 89
 	{
90
-		if( isset( $this->values['roles'] ) ) {
90
+		if (isset($this->values['roles'])) {
91 91
 			return (array) $this->values['roles'];
92 92
 		}
93 93
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @param array $roles List of Symfony roles
102 102
 	 */
103
-	public function setRoles( array $roles )
103
+	public function setRoles(array $roles)
104 104
 	{
105 105
 		$this->values['roles'] = $roles;
106 106
 		$this->setModified();
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function getSalt()
118 118
 	{
119
-		if( !isset( $this->values['salt'] ) ) {
120
-			$this->values['salt'] = sha1( microtime( true ) . getmypid() );
119
+		if (!isset($this->values['salt'])) {
120
+			$this->values['salt'] = sha1(microtime(true) . getmypid());
121 121
 		}
122 122
 
123 123
 		return $this->values['salt'];
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @param string $value Password salt
131 131
 	 */
132
-	public function setSalt( $value )
132
+	public function setSalt($value)
133 133
 	{
134 134
 		$this->values['salt'] = (string) $value;
135 135
 		$this->setModified();
Please login to merge, or discard this patch.
lib/custom/src/MShop/Customer/Manager/FosUser.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @param array $siteids List of IDs for sites whose entries should be deleted
244 244
 	 */
245
-	public function cleanup( array $siteids )
245
+	public function cleanup(array $siteids)
246 246
 	{
247 247
 		$path = 'mshop/customer/manager/submanagers';
248
-		foreach( $this->getContext()->getConfig()->get( $path, array( 'address', 'lists' ) ) as $domain ) {
249
-			$this->getSubManager( $domain )->cleanup( $siteids );
248
+		foreach ($this->getContext()->getConfig()->get($path, array('address', 'lists')) as $domain) {
249
+			$this->getSubManager($domain)->cleanup($siteids);
250 250
 		}
251 251
 	}
252 252
 
@@ -256,10 +256,10 @@  discard block
 block discarded – undo
256 256
 	 *
257 257
 	 * @param array $ids List of IDs
258 258
 	 */
259
-	public function deleteItems( array $ids )
259
+	public function deleteItems(array $ids)
260 260
 	{
261 261
 		$path = 'mshop/customer/manager/fosuser/delete';
262
-		$this->deleteItemsBase( $ids, $path, false );
262
+		$this->deleteItemsBase($ids, $path, false);
263 263
 	}
264 264
 
265 265
 
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
 	 * @param boolean $withsub Return also attributes of sub-managers if true
270 270
 	 * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface
271 271
 	 */
272
-	public function getSearchAttributes( $withsub = true )
272
+	public function getSearchAttributes($withsub = true)
273 273
 	{
274 274
 		$path = 'mshop/customer/manager/submanagers';
275 275
 
276
-		return $this->getSearchAttributesBase( $this->searchConfig, $path, array( 'address', 'lists' ), $withsub );
276
+		return $this->getSearchAttributesBase($this->searchConfig, $path, array('address', 'lists'), $withsub);
277 277
 	}
278 278
 
279 279
 
@@ -294,27 +294,27 @@  discard block
 block discarded – undo
294 294
 	 * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object
295 295
 	 * @param boolean $fetch True if the new ID should be returned in the item
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() ) { return; }
304
+		if (!$item->isModified()) { return; }
305 305
 
306 306
 		$context = $this->getContext();
307 307
 		$dbm = $context->getDatabaseManager();
308 308
 		$dbname = $this->getResourceName();
309
-		$conn = $dbm->acquire( $dbname );
309
+		$conn = $dbm->acquire($dbname);
310 310
 
311 311
 		try
312 312
 		{
313 313
 			$id = $item->getId();
314
-			$date = date( 'Y-m-d H:i:s' );
314
+			$date = date('Y-m-d H:i:s');
315 315
 			$billingAddress = $item->getPaymentAddress();
316 316
 
317
-			if( $id === null )
317
+			if ($id === null)
318 318
 			{
319 319
 				/** mshop/customer/manager/fosuser/insert
320 320
 				 * Inserts a new customer record into the database table
@@ -378,50 +378,50 @@  discard block
 block discarded – undo
378 378
 				$path = 'mshop/customer/manager/fosuser/update';
379 379
 			}
380 380
 
381
-			$stmt = $this->getCachedStatement( $conn, $path );
382
-
383
-			$stmt->bind( 1, $item->getCode() ); // canonical username
384
-			$stmt->bind( 2, $item->getCode() ); // username
385
-			$stmt->bind( 3, $billingAddress->getCompany() );
386
-			$stmt->bind( 4, $billingAddress->getVatID() );
387
-			$stmt->bind( 5, $billingAddress->getSalutation() );
388
-			$stmt->bind( 6, $billingAddress->getTitle() );
389
-			$stmt->bind( 7, $billingAddress->getFirstname() );
390
-			$stmt->bind( 8, $billingAddress->getLastname() );
391
-			$stmt->bind( 9, $billingAddress->getAddress1() );
392
-			$stmt->bind( 10, $billingAddress->getAddress2() );
393
-			$stmt->bind( 11, $billingAddress->getAddress3() );
394
-			$stmt->bind( 12, $billingAddress->getPostal() );
395
-			$stmt->bind( 13, $billingAddress->getCity() );
396
-			$stmt->bind( 14, $billingAddress->getState() );
397
-			$stmt->bind( 15, $billingAddress->getCountryId() );
398
-			$stmt->bind( 16, $billingAddress->getLanguageId() );
399
-			$stmt->bind( 17, $billingAddress->getTelephone() );
400
-			$stmt->bind( 18, $billingAddress->getEmail() );
401
-			$stmt->bind( 19, $billingAddress->getEmail() );
402
-			$stmt->bind( 20, $billingAddress->getTelefax() );
403
-			$stmt->bind( 21, $billingAddress->getWebsite() );
404
-			$stmt->bind( 22, $billingAddress->getLongitude() );
405
-			$stmt->bind( 23, $billingAddress->getLatitude() );
406
-			$stmt->bind( 24, $item->getBirthday() );
407
-			$stmt->bind( 25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT );
408
-			$stmt->bind( 26, $item->getDateVerified() );
409
-			$stmt->bind( 27, $item->getPassword() );
410
-			$stmt->bind( 28, $date ); // Modification time
411
-			$stmt->bind( 29, $context->getEditor() );
412
-			$stmt->bind( 30, serialize( $item->getRoles() ) );
413
-			$stmt->bind( 31, $item->getSalt() );
414
-
415
-			if( $id !== null ) {
416
-				$stmt->bind( 32, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT );
417
-				$item->setId( $id );
381
+			$stmt = $this->getCachedStatement($conn, $path);
382
+
383
+			$stmt->bind(1, $item->getCode()); // canonical username
384
+			$stmt->bind(2, $item->getCode()); // username
385
+			$stmt->bind(3, $billingAddress->getCompany());
386
+			$stmt->bind(4, $billingAddress->getVatID());
387
+			$stmt->bind(5, $billingAddress->getSalutation());
388
+			$stmt->bind(6, $billingAddress->getTitle());
389
+			$stmt->bind(7, $billingAddress->getFirstname());
390
+			$stmt->bind(8, $billingAddress->getLastname());
391
+			$stmt->bind(9, $billingAddress->getAddress1());
392
+			$stmt->bind(10, $billingAddress->getAddress2());
393
+			$stmt->bind(11, $billingAddress->getAddress3());
394
+			$stmt->bind(12, $billingAddress->getPostal());
395
+			$stmt->bind(13, $billingAddress->getCity());
396
+			$stmt->bind(14, $billingAddress->getState());
397
+			$stmt->bind(15, $billingAddress->getCountryId());
398
+			$stmt->bind(16, $billingAddress->getLanguageId());
399
+			$stmt->bind(17, $billingAddress->getTelephone());
400
+			$stmt->bind(18, $billingAddress->getEmail());
401
+			$stmt->bind(19, $billingAddress->getEmail());
402
+			$stmt->bind(20, $billingAddress->getTelefax());
403
+			$stmt->bind(21, $billingAddress->getWebsite());
404
+			$stmt->bind(22, $billingAddress->getLongitude());
405
+			$stmt->bind(23, $billingAddress->getLatitude());
406
+			$stmt->bind(24, $item->getBirthday());
407
+			$stmt->bind(25, $item->getStatus(), \Aimeos\MW\DB\Statement\Base::PARAM_INT);
408
+			$stmt->bind(26, $item->getDateVerified());
409
+			$stmt->bind(27, $item->getPassword());
410
+			$stmt->bind(28, $date); // Modification time
411
+			$stmt->bind(29, $context->getEditor());
412
+			$stmt->bind(30, serialize($item->getRoles()));
413
+			$stmt->bind(31, $item->getSalt());
414
+
415
+			if ($id !== null) {
416
+				$stmt->bind(32, $id, \Aimeos\MW\DB\Statement\Base::PARAM_INT);
417
+				$item->setId($id);
418 418
 			} else {
419
-				$stmt->bind( 32, $date ); // Creation time
419
+				$stmt->bind(32, $date); // Creation time
420 420
 			}
421 421
 
422 422
 			$stmt->execute()->finish();
423 423
 
424
-			if( $id === null && $fetch === true )
424
+			if ($id === null && $fetch === true)
425 425
 			{
426 426
 				/** mshop/customer/manager/fosuser/newid
427 427
 				 * Retrieves the ID generated by the database when inserting a new record
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
 				 * @see mshop/customer/manager/fosuser/count
455 455
 				 */
456 456
 				$path = 'mshop/customer/manager/fosuser/newid';
457
-				$item->setId( $this->newId( $conn, $path ) );
457
+				$item->setId($this->newId($conn, $path));
458 458
 			}
459 459
 
460
-			$dbm->release( $conn, $dbname );
460
+			$dbm->release($conn, $dbname);
461 461
 		}
462
-		catch( \Exception $e )
462
+		catch (\Exception $e)
463 463
 		{
464
-			$dbm->release( $conn, $dbname );
464
+			$dbm->release($conn, $dbname);
465 465
 			throw $e;
466 466
 		}
467 467
 	}
@@ -475,11 +475,11 @@  discard block
 block discarded – undo
475 475
 	 * @return array List of items implementing \Aimeos\MShop\Customer\Item\Iface
476 476
 	 * @throws \Aimeos\MShop\Customer\Exception If creating items failed
477 477
 	 */
478
-	public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null )
478
+	public function searchItems(\Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null)
479 479
 	{
480 480
 		$dbm = $this->getContext()->getDatabaseManager();
481 481
 		$dbname = $this->getResourceName();
482
-		$conn = $dbm->acquire( $dbname );
482
+		$conn = $dbm->acquire($dbname);
483 483
 		$map = array();
484 484
 
485 485
 		try
@@ -487,22 +487,22 @@  discard block
 block discarded – undo
487 487
 			$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
488 488
 			$cfgPathSearch = 'mshop/customer/manager/fosuser/search';
489 489
 			$cfgPathCount = 'mshop/customer/manager/fosuser/count';
490
-			$required = array( 'customer' );
490
+			$required = array('customer');
491 491
 
492
-			$results = $this->searchItemsBase( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );
493
-			while( ( $row = $results->fetch() ) !== false ) {
494
-				$map[ $row['customer.id'] ] = $row;
492
+			$results = $this->searchItemsBase($conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level);
493
+			while (($row = $results->fetch()) !== false) {
494
+				$map[$row['customer.id']] = $row;
495 495
 			}
496 496
 
497
-			$dbm->release( $conn, $dbname );
497
+			$dbm->release($conn, $dbname);
498 498
 		}
499
-		catch( \Exception $e )
499
+		catch (\Exception $e)
500 500
 		{
501
-			$dbm->release( $conn, $dbname  );
501
+			$dbm->release($conn, $dbname);
502 502
 			throw $e;
503 503
 		}
504 504
 
505
-		return $this->buildItems( $map, $ref, 'customer' );
505
+		return $this->buildItems($map, $ref, 'customer');
506 506
 	}
507 507
 
508 508
 
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 	 * @param string|null $name Name of the implementation, will be from configuration (or Default) if null
514 514
 	 * @return mixed Manager for different extensions, e.g stock, tags, locations, etc.
515 515
 	 */
516
-	public function getSubManager( $manager, $name = null )
516
+	public function getSubManager($manager, $name = null)
517 517
 	{
518
-		return $this->getSubManagerBase( 'customer', $manager, ( $name === null ? 'FosUser' : $name ) );
518
+		return $this->getSubManagerBase('customer', $manager, ($name === null ? 'FosUser' : $name));
519 519
 	}
520 520
 
521 521
 
@@ -527,19 +527,19 @@  discard block
 block discarded – undo
527 527
 	 * @param array $refItems Items referenced by the customer item via the list items
528 528
 	 * @return \Aimeos\MShop\Customer\Item\Iface New customer item
529 529
 	 */
530
-	protected function createItemBase( array $values = array(), array $listItems = array(), array $refItems = array() )
530
+	protected function createItemBase(array $values = array(), array $listItems = array(), array $refItems = array())
531 531
 	{
532
-		if( !isset( $this->addressManager ) ) {
533
-			$this->addressManager = $this->getSubManager( 'address' );
532
+		if (!isset($this->addressManager)) {
533
+			$this->addressManager = $this->getSubManager('address');
534 534
 		}
535 535
 
536
-		if( isset( $values['roles'] ) ) {
537
-			$values['roles'] = unserialize( $values['roles'] );
536
+		if (isset($values['roles'])) {
537
+			$values['roles'] = unserialize($values['roles']);
538 538
 		}
539 539
 
540 540
 		$helper = $this->getPasswordHelper();
541 541
 		$address = $this->addressManager->createItem();
542 542
 
543
-		return new \Aimeos\MShop\Customer\Item\FosUser( $address, $values, $listItems, $refItems, $helper );
543
+		return new \Aimeos\MShop\Customer\Item\FosUser($address, $values, $listItems, $refItems, $helper);
544 544
 	}
545 545
 }
Please login to merge, or discard this patch.
lib/custom/tests/MShop/Customer/Item/FosUserTest.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 			'customer.address.position' => 1,
23 23
 		);
24 24
 
25
-		$this->address = new \Aimeos\MShop\Common\Item\Address\Standard( 'common.address.', $addressValues );
25
+		$this->address = new \Aimeos\MShop\Common\Item\Address\Standard('common.address.', $addressValues);
26 26
 
27 27
 		$values = array(
28 28
 			'customer.id' => 541,
@@ -54,71 +54,71 @@  discard block
 block discarded – undo
54 54
 			'customer.mtime'=> '2010-01-05 00:00:05',
55 55
 			'customer.ctime'=> '2010-01-01 00:00:00',
56 56
 			'customer.editor' => 'unitTestUser',
57
-			'roles' => array( 'ROLE_ADMIN' ),
57
+			'roles' => array('ROLE_ADMIN'),
58 58
 			'salt' => 'test',
59 59
 		);
60 60
 
61
-		$this->object = new \Aimeos\MShop\Customer\Item\FosUser( $this->address, $values );
61
+		$this->object = new \Aimeos\MShop\Customer\Item\FosUser($this->address, $values);
62 62
 	}
63 63
 
64 64
 	protected function tearDown()
65 65
 	{
66
-		unset( $this->object );
66
+		unset($this->object);
67 67
 	}
68 68
 
69 69
 	public function testGetPassword()
70 70
 	{
71
-		$this->assertEquals( 'testpwd', $this->object->getPassword() );
71
+		$this->assertEquals('testpwd', $this->object->getPassword());
72 72
 	}
73 73
 
74 74
 	public function testSetPassword()
75 75
 	{
76
-		$this->object->setPassword( 'new' );
77
-		$this->assertTrue( $this->object->isModified() );
78
-		$this->assertEquals( 'new', $this->object->getPassword() );
76
+		$this->object->setPassword('new');
77
+		$this->assertTrue($this->object->isModified());
78
+		$this->assertEquals('new', $this->object->getPassword());
79 79
 	}
80 80
 
81 81
 	public function testSetPasswordGenerated()
82 82
 	{
83
-		$helper = new \Aimeos\MShop\Common\Item\Helper\Password\Standard( array( 'format' => '%1$s{%2$s}' ) );
84
-		$object = new \Aimeos\MShop\Customer\Item\FosUser( $this->address, array(), array(), array(), $helper );
83
+		$helper = new \Aimeos\MShop\Common\Item\Helper\Password\Standard(array('format' => '%1$s{%2$s}'));
84
+		$object = new \Aimeos\MShop\Customer\Item\FosUser($this->address, array(), array(), array(), $helper);
85 85
 
86
-		$object->setPassword( 'newpwd' );
87
-		$this->assertEquals( sha1( 'newpwd{' . $object->getSalt() . '}' ), $object->getPassword() );
86
+		$object->setPassword('newpwd');
87
+		$this->assertEquals(sha1('newpwd{' . $object->getSalt() . '}'), $object->getPassword());
88 88
 	}
89 89
 
90 90
 	public function testGetRoles()
91 91
 	{
92
-		$this->assertEquals( array( 'ROLE_ADMIN' ), $this->object->getRoles() );
92
+		$this->assertEquals(array('ROLE_ADMIN'), $this->object->getRoles());
93 93
 	}
94 94
 
95 95
 	public function testSetRoles()
96 96
 	{
97
-		$this->object->setRoles( array( 'ROLE_USER' ) );
98
-		$this->assertTrue( $this->object->isModified() );
99
-		$this->assertEquals( array( 'ROLE_USER' ), $this->object->getRoles() );
97
+		$this->object->setRoles(array('ROLE_USER'));
98
+		$this->assertTrue($this->object->isModified());
99
+		$this->assertEquals(array('ROLE_USER'), $this->object->getRoles());
100 100
 	}
101 101
 
102 102
 	public function testGetSalt()
103 103
 	{
104
-		$this->assertEquals( 'test', $this->object->getSalt() );
104
+		$this->assertEquals('test', $this->object->getSalt());
105 105
 	}
106 106
 
107 107
 	public function testGetSaltGenerated()
108 108
 	{
109
-		$object = new \Aimeos\MShop\Customer\Item\FosUser( $this->address, array() );
110
-		$this->assertInternalType( 'string', $object->getSalt() );
109
+		$object = new \Aimeos\MShop\Customer\Item\FosUser($this->address, array());
110
+		$this->assertInternalType('string', $object->getSalt());
111 111
 	}
112 112
 
113 113
 	public function testSetSalt()
114 114
 	{
115
-		$this->object->setSalt( 'new' );
116
-		$this->assertTrue( $this->object->isModified() );
117
-		$this->assertEquals( 'new', $this->object->getSalt() );
115
+		$this->object->setSalt('new');
116
+		$this->assertTrue($this->object->isModified());
117
+		$this->assertEquals('new', $this->object->getSalt());
118 118
 	}
119 119
 
120 120
 	public function testIsModified()
121 121
 	{
122
-		$this->assertFalse( $this->object->isModified() );
122
+		$this->assertFalse($this->object->isModified());
123 123
 	}
124 124
 }
Please login to merge, or discard this patch.
lib/custom/tests/MShop/Customer/Manager/FosUserTest.php 1 patch
Spacing   +142 added lines, -142 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\FosUser( $context );
24
+		$this->object = new \Aimeos\MShop\Customer\Manager\FosUser($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,58 +85,58 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		$item = $this->object->createItem();
87 87
 
88
-		$item->setCode( 'unitTest' );
89
-		$item->setLabel( 'unitTest' );
90
-		$this->object->saveItem( $item );
91
-		$itemSaved = $this->object->getItem( $item->getId() );
88
+		$item->setCode('unitTest');
89
+		$item->setLabel('unitTest');
90
+		$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
-		$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
-		$this->assertEquals( $item->getRoles(), $itemSaved->getRoles() );
111
-		$this->assertEquals( $item->getSalt(), $itemSaved->getSalt() );
112
-
113
-		$this->assertEquals( $this->editor, $itemSaved->getEditor() );
114
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated() );
115
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified() );
116
-
117
-		$this->assertEquals( $itemExp->getId(), $itemUpd->getId() );
118
-		$this->assertEquals( $itemExp->getSiteId(), $itemUpd->getSiteId() );
119
-		$this->assertEquals( $itemExp->getStatus(), $itemUpd->getStatus() );
120
-		$this->assertEquals( $itemExp->getCode(), $itemUpd->getCode() );
121
-		$this->assertEquals( $itemExp->getLabel(), $itemUpd->getLabel() );
122
-		$this->assertEquals( $itemExp->getPaymentAddress(), $itemUpd->getPaymentAddress() );
123
-		$this->assertEquals( $itemExp->getBirthday(), $itemUpd->getBirthday() );
124
-		$this->assertEquals( $itemExp->getPassword(), $itemUpd->getPassword() );
125
-		$this->assertEquals( $itemExp->getRoles(), $itemUpd->getRoles() );
126
-		$this->assertEquals( $itemExp->getSalt(), $itemUpd->getSalt() );
127
-
128
-		$this->assertEquals( $this->editor, $itemUpd->getEditor() );
129
-		$this->assertEquals( $itemExp->getTimeCreated(), $itemUpd->getTimeCreated() );
130
-		$this->assertRegExp( '/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified() );
131
-
132
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
133
-		$this->object->getItem( $item->getId() );
94
+		$itemExp->setCode('unitTest2');
95
+		$itemExp->setLabel('unitTest2');
96
+		$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
+		$this->assertEquals($item->getRoles(), $itemSaved->getRoles());
111
+		$this->assertEquals($item->getSalt(), $itemSaved->getSalt());
112
+
113
+		$this->assertEquals($this->editor, $itemSaved->getEditor());
114
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeCreated());
115
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemSaved->getTimeModified());
116
+
117
+		$this->assertEquals($itemExp->getId(), $itemUpd->getId());
118
+		$this->assertEquals($itemExp->getSiteId(), $itemUpd->getSiteId());
119
+		$this->assertEquals($itemExp->getStatus(), $itemUpd->getStatus());
120
+		$this->assertEquals($itemExp->getCode(), $itemUpd->getCode());
121
+		$this->assertEquals($itemExp->getLabel(), $itemUpd->getLabel());
122
+		$this->assertEquals($itemExp->getPaymentAddress(), $itemUpd->getPaymentAddress());
123
+		$this->assertEquals($itemExp->getBirthday(), $itemUpd->getBirthday());
124
+		$this->assertEquals($itemExp->getPassword(), $itemUpd->getPassword());
125
+		$this->assertEquals($itemExp->getRoles(), $itemUpd->getRoles());
126
+		$this->assertEquals($itemExp->getSalt(), $itemUpd->getSalt());
127
+
128
+		$this->assertEquals($this->editor, $itemUpd->getEditor());
129
+		$this->assertEquals($itemExp->getTimeCreated(), $itemUpd->getTimeCreated());
130
+		$this->assertRegExp('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $itemUpd->getTimeModified());
131
+
132
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
133
+		$this->object->getItem($item->getId());
134 134
 	}
135 135
 
136 136
 
137 137
 	public function testCreateSearch()
138 138
 	{
139
-		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch() );
139
+		$this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $this->object->createSearch());
140 140
 	}
141 141
 
142 142
 
@@ -146,69 +146,69 @@  discard block
 block discarded – undo
146 146
 		$search = $this->object->createSearch();
147 147
 
148 148
 		$expr = array();
149
-		$expr[] = $search->compare( '!=', 'customer.id', null );
150
-		$expr[] = $search->compare( '==', 'customer.label', 'UTC002' );
151
-		$expr[] = $search->compare( '==', 'customer.code', 'UTC002' );
152
-
153
-		$expr[] = $search->compare( '>=', 'customer.salutation', '' );
154
-		$expr[] = $search->compare( '>=', 'customer.company', '' );
155
-		$expr[] = $search->compare( '>=', 'customer.vatid', '' );
156
-		$expr[] = $search->compare( '>=', 'customer.title', '' );
157
-		$expr[] = $search->compare( '>=', 'customer.firstname', '' );
158
-		$expr[] = $search->compare( '>=', 'customer.lastname', '' );
159
-		$expr[] = $search->compare( '>=', 'customer.address1', '' );
160
-		$expr[] = $search->compare( '>=', 'customer.address2', '' );
161
-		$expr[] = $search->compare( '>=', 'customer.address3', '' );
162
-		$expr[] = $search->compare( '>=', 'customer.postal', '' );
163
-		$expr[] = $search->compare( '>=', 'customer.city', '' );
164
-		$expr[] = $search->compare( '>=', 'customer.state', '' );
165
-		$expr[] = $search->compare( '!=', 'customer.languageid', null );
166
-		$expr[] = $search->compare( '>=', 'customer.countryid', '' );
167
-		$expr[] = $search->compare( '>=', 'customer.telephone', '' );
168
-		$expr[] = $search->compare( '>=', 'customer.email', '' );
169
-		$expr[] = $search->compare( '>=', 'customer.telefax', '' );
170
-		$expr[] = $search->compare( '>=', 'customer.website', '' );
171
-		$expr[] = $search->compare( '>=', 'customer.longitude', '10.0' );
172
-		$expr[] = $search->compare( '>=', 'customer.latitude', '50.0' );
173
-
174
-		$expr[] = $search->compare( '==', 'customer.birthday', '1970-01-01' );
175
-		$expr[] = $search->compare( '>=', 'customer.password', '' );
176
-		$expr[] = $search->compare( '==', 'customer.status', 0 );
177
-		$expr[] = $search->compare( '!=', 'customer.mtime', '1970-01-01 00:00:00' );
178
-		$expr[] = $search->compare( '!=', 'customer.ctime', '1970-01-01 00:00:00' );
179
-		$expr[] = $search->compare( '==', 'customer.editor', $this->editor );
180
-
181
-		$expr[] = $search->compare( '!=', 'customer.address.id', null );
182
-		$expr[] = $search->compare( '!=', 'customer.address.parentid', null );
183
-		$expr[] = $search->compare( '==', 'customer.address.company', 'ABC GmbH' );
184
-		$expr[] = $search->compare( '==', 'customer.address.vatid', 'DE999999999' );
185
-		$expr[] = $search->compare( '==', 'customer.address.salutation', 'mr' );
186
-		$expr[] = $search->compare( '==', 'customer.address.title', 'Dr.' );
187
-		$expr[] = $search->compare( '==', 'customer.address.firstname', 'Good' );
188
-		$expr[] = $search->compare( '==', 'customer.address.lastname', 'Unittest' );
189
-		$expr[] = $search->compare( '==', 'customer.address.address1', 'Pickhuben' );
190
-		$expr[] = $search->compare( '==', 'customer.address.address2', '2-4' );
191
-		$expr[] = $search->compare( '==', 'customer.address.address3', '' );
192
-		$expr[] = $search->compare( '==', 'customer.address.postal', '11099' );
193
-		$expr[] = $search->compare( '==', 'customer.address.city', 'Berlin' );
194
-		$expr[] = $search->compare( '==', 'customer.address.state', 'Berlin' );
195
-		$expr[] = $search->compare( '==', 'customer.address.languageid', 'de' );
196
-		$expr[] = $search->compare( '==', 'customer.address.countryid', 'DE' );
197
-		$expr[] = $search->compare( '==', 'customer.address.telephone', '055544332221' );
198
-		$expr[] = $search->compare( '==', 'customer.address.email', '[email protected]' );
199
-		$expr[] = $search->compare( '==', 'customer.address.telefax', '055544333212' );
200
-		$expr[] = $search->compare( '==', 'customer.address.website', 'unittest.aimeos.org' );
201
-		$expr[] = $search->compare( '>=', 'customer.address.longitude', '10.0' );
202
-		$expr[] = $search->compare( '>=', 'customer.address.latitude', '50.0' );
203
-		$expr[] = $search->compare( '==', 'customer.address.flag', 0 );
204
-		$expr[] = $search->compare( '==', 'customer.address.position', 1 );
205
-		$expr[] = $search->compare( '!=', 'customer.address.mtime', '1970-01-01 00:00:00' );
206
-		$expr[] = $search->compare( '!=', 'customer.address.ctime', '1970-01-01 00:00:00' );
207
-		$expr[] = $search->compare( '==', 'customer.address.editor', $this->editor );
208
-
209
-		$search->setConditions( $search->combine( '&&', $expr ) );
210
-		$result = $this->object->searchItems( $search, array(), $total );
211
-		$this->assertEquals( 1, count( $result ) );
149
+		$expr[] = $search->compare('!=', 'customer.id', null);
150
+		$expr[] = $search->compare('==', 'customer.label', 'UTC002');
151
+		$expr[] = $search->compare('==', 'customer.code', 'UTC002');
152
+
153
+		$expr[] = $search->compare('>=', 'customer.salutation', '');
154
+		$expr[] = $search->compare('>=', 'customer.company', '');
155
+		$expr[] = $search->compare('>=', 'customer.vatid', '');
156
+		$expr[] = $search->compare('>=', 'customer.title', '');
157
+		$expr[] = $search->compare('>=', 'customer.firstname', '');
158
+		$expr[] = $search->compare('>=', 'customer.lastname', '');
159
+		$expr[] = $search->compare('>=', 'customer.address1', '');
160
+		$expr[] = $search->compare('>=', 'customer.address2', '');
161
+		$expr[] = $search->compare('>=', 'customer.address3', '');
162
+		$expr[] = $search->compare('>=', 'customer.postal', '');
163
+		$expr[] = $search->compare('>=', 'customer.city', '');
164
+		$expr[] = $search->compare('>=', 'customer.state', '');
165
+		$expr[] = $search->compare('!=', 'customer.languageid', null);
166
+		$expr[] = $search->compare('>=', 'customer.countryid', '');
167
+		$expr[] = $search->compare('>=', 'customer.telephone', '');
168
+		$expr[] = $search->compare('>=', 'customer.email', '');
169
+		$expr[] = $search->compare('>=', 'customer.telefax', '');
170
+		$expr[] = $search->compare('>=', 'customer.website', '');
171
+		$expr[] = $search->compare('>=', 'customer.longitude', '10.0');
172
+		$expr[] = $search->compare('>=', 'customer.latitude', '50.0');
173
+
174
+		$expr[] = $search->compare('==', 'customer.birthday', '1970-01-01');
175
+		$expr[] = $search->compare('>=', 'customer.password', '');
176
+		$expr[] = $search->compare('==', 'customer.status', 0);
177
+		$expr[] = $search->compare('!=', 'customer.mtime', '1970-01-01 00:00:00');
178
+		$expr[] = $search->compare('!=', 'customer.ctime', '1970-01-01 00:00:00');
179
+		$expr[] = $search->compare('==', 'customer.editor', $this->editor);
180
+
181
+		$expr[] = $search->compare('!=', 'customer.address.id', null);
182
+		$expr[] = $search->compare('!=', 'customer.address.parentid', null);
183
+		$expr[] = $search->compare('==', 'customer.address.company', 'ABC GmbH');
184
+		$expr[] = $search->compare('==', 'customer.address.vatid', 'DE999999999');
185
+		$expr[] = $search->compare('==', 'customer.address.salutation', 'mr');
186
+		$expr[] = $search->compare('==', 'customer.address.title', 'Dr.');
187
+		$expr[] = $search->compare('==', 'customer.address.firstname', 'Good');
188
+		$expr[] = $search->compare('==', 'customer.address.lastname', 'Unittest');
189
+		$expr[] = $search->compare('==', 'customer.address.address1', 'Pickhuben');
190
+		$expr[] = $search->compare('==', 'customer.address.address2', '2-4');
191
+		$expr[] = $search->compare('==', 'customer.address.address3', '');
192
+		$expr[] = $search->compare('==', 'customer.address.postal', '11099');
193
+		$expr[] = $search->compare('==', 'customer.address.city', 'Berlin');
194
+		$expr[] = $search->compare('==', 'customer.address.state', 'Berlin');
195
+		$expr[] = $search->compare('==', 'customer.address.languageid', 'de');
196
+		$expr[] = $search->compare('==', 'customer.address.countryid', 'DE');
197
+		$expr[] = $search->compare('==', 'customer.address.telephone', '055544332221');
198
+		$expr[] = $search->compare('==', 'customer.address.email', '[email protected]');
199
+		$expr[] = $search->compare('==', 'customer.address.telefax', '055544333212');
200
+		$expr[] = $search->compare('==', 'customer.address.website', 'unittest.aimeos.org');
201
+		$expr[] = $search->compare('>=', 'customer.address.longitude', '10.0');
202
+		$expr[] = $search->compare('>=', 'customer.address.latitude', '50.0');
203
+		$expr[] = $search->compare('==', 'customer.address.flag', 0);
204
+		$expr[] = $search->compare('==', 'customer.address.position', 1);
205
+		$expr[] = $search->compare('!=', 'customer.address.mtime', '1970-01-01 00:00:00');
206
+		$expr[] = $search->compare('!=', 'customer.address.ctime', '1970-01-01 00:00:00');
207
+		$expr[] = $search->compare('==', 'customer.address.editor', $this->editor);
208
+
209
+		$search->setConditions($search->combine('&&', $expr));
210
+		$result = $this->object->searchItems($search, array(), $total);
211
+		$this->assertEquals(1, count($result));
212 212
 	}
213 213
 
214 214
 
@@ -217,44 +217,44 @@  discard block
 block discarded – undo
217 217
 		$total = 0;
218 218
 
219 219
 		$search = $this->object->createSearch();
220
-		$search->setConditions( $search->compare( '==', 'customer.address.editor', $this->editor ) );
221
-		$search->setSlice( 0, 2 );
220
+		$search->setConditions($search->compare('==', 'customer.address.editor', $this->editor));
221
+		$search->setSlice(0, 2);
222 222
 
223
-		$results = $this->object->searchItems( $search, array(), $total );
224
-		$this->assertEquals( 2, count( $results ) );
225
-		$this->assertEquals( 3, $total );
223
+		$results = $this->object->searchItems($search, array(), $total);
224
+		$this->assertEquals(2, count($results));
225
+		$this->assertEquals(3, $total);
226 226
 
227
-		foreach($results as $itemId => $item) {
228
-			$this->assertEquals( $itemId, $item->getId() );
227
+		foreach ($results as $itemId => $item) {
228
+			$this->assertEquals($itemId, $item->getId());
229 229
 		}
230 230
 	}
231 231
 
232 232
 
233 233
 	public function testSearchItemsBaseCriteria()
234 234
 	{
235
-		$search = $this->object->createSearch( true );
235
+		$search = $this->object->createSearch(true);
236 236
 		$conditions = array(
237
-			$search->compare( '==', 'customer.address.editor', $this->editor ),
237
+			$search->compare('==', 'customer.address.editor', $this->editor),
238 238
 			$search->getConditions()
239 239
 		);
240
-		$search->setConditions( $search->combine( '&&', $conditions ) );
241
-		$this->assertEquals( 2, count( $this->object->searchItems( $search, array(), $total ) ) );
240
+		$search->setConditions($search->combine('&&', $conditions));
241
+		$this->assertEquals(2, count($this->object->searchItems($search, array(), $total)));
242 242
 	}
243 243
 
244 244
 
245 245
 	public function testGetSubManager()
246 246
 	{
247
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address' ) );
248
-		$this->assertInstanceOf( '\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager( 'address', 'Standard' ) );
247
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('address'));
248
+		$this->assertInstanceOf('\\Aimeos\\MShop\\Common\\Manager\\Iface', $this->object->getSubManager('address', 'Standard'));
249 249
 
250
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
251
-		$this->object->getSubManager( 'unknown' );
250
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
251
+		$this->object->getSubManager('unknown');
252 252
 	}
253 253
 
254 254
 
255 255
 	public function testGetSubManagerInvalidName()
256 256
 	{
257
-		$this->setExpectedException( '\\Aimeos\\MShop\\Exception' );
258
-		$this->object->getSubManager( 'address', 'unknown' );
257
+		$this->setExpectedException('\\Aimeos\\MShop\\Exception');
258
+		$this->object->getSubManager('address', 'unknown');
259 259
 	}
260 260
 }
Please login to merge, or discard this patch.