@@ -33,10 +33,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function getSalt() |
| 118 | 118 | { |
| 119 | - if( isset( $this->values['salt'] ) ) { |
|
| 119 | + if (isset($this->values['salt'])) { |
|
| 120 | 120 | return $this->values['salt']; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -129,7 +129,7 @@ discard block |
||
| 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(); |
@@ -22,7 +22,7 @@ discard block |
||
| 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 |
||
| 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->assertEquals( 'mshop', $object->getSalt() ); |
|
| 109 | + $object = new \Aimeos\MShop\Customer\Item\FosUser($this->address, array()); |
|
| 110 | + $this->assertEquals('mshop', $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 | } |