@@ -47,72 +47,72 @@ |
||
47 | 47 | 'customer.mtime'=> '2010-01-05 00:00:05', |
48 | 48 | 'customer.ctime'=> '2010-01-01 00:00:00', |
49 | 49 | 'customer.editor' => 'unitTestUser', |
50 | - 'roles' => array( 'ROLE_ADMIN' ), |
|
50 | + 'roles' => array('ROLE_ADMIN'), |
|
51 | 51 | 'salt' => 'test', |
52 | 52 | ); |
53 | 53 | |
54 | - $this->address = new \Aimeos\MShop\Common\Item\Address\Standard( 'customer.', $values ); |
|
55 | - $this->object = new \Aimeos\MShop\Customer\Item\FosUser( $this->address, $values ); |
|
54 | + $this->address = new \Aimeos\MShop\Common\Item\Address\Standard('customer.', $values); |
|
55 | + $this->object = new \Aimeos\MShop\Customer\Item\FosUser($this->address, $values); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | protected function tearDown() |
59 | 59 | { |
60 | - unset( $this->object ); |
|
60 | + unset($this->object); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | public function testGetPassword() |
64 | 64 | { |
65 | - $this->assertEquals( 'testpwd', $this->object->getPassword() ); |
|
65 | + $this->assertEquals('testpwd', $this->object->getPassword()); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | public function testSetPassword() |
69 | 69 | { |
70 | - $this->object->setPassword( 'new' ); |
|
71 | - $this->assertTrue( $this->object->isModified() ); |
|
72 | - $this->assertEquals( 'new', $this->object->getPassword() ); |
|
70 | + $this->object->setPassword('new'); |
|
71 | + $this->assertTrue($this->object->isModified()); |
|
72 | + $this->assertEquals('new', $this->object->getPassword()); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | public function testSetPasswordGenerated() |
76 | 76 | { |
77 | - $helper = new \Aimeos\MShop\Common\Helper\Password\Standard( array( 'format' => '%1$s{%2$s}' ) ); |
|
78 | - $object = new \Aimeos\MShop\Customer\Item\FosUser( $this->address, [], [], [], [], [], $helper ); |
|
77 | + $helper = new \Aimeos\MShop\Common\Helper\Password\Standard(array('format' => '%1$s{%2$s}')); |
|
78 | + $object = new \Aimeos\MShop\Customer\Item\FosUser($this->address, [], [], [], [], [], $helper); |
|
79 | 79 | |
80 | - $object->setPassword( 'newpwd' ); |
|
81 | - $this->assertEquals( sha1( 'newpwd{' . $object->getSalt() . '}' ), $object->getPassword() ); |
|
80 | + $object->setPassword('newpwd'); |
|
81 | + $this->assertEquals(sha1('newpwd{' . $object->getSalt() . '}'), $object->getPassword()); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | public function testGetRoles() |
85 | 85 | { |
86 | - $this->assertEquals( array( 'ROLE_ADMIN' ), $this->object->getRoles() ); |
|
86 | + $this->assertEquals(array('ROLE_ADMIN'), $this->object->getRoles()); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | public function testSetRoles() |
90 | 90 | { |
91 | - $this->object->setRoles( array( 'ROLE_USER' ) ); |
|
92 | - $this->assertTrue( $this->object->isModified() ); |
|
93 | - $this->assertEquals( array( 'ROLE_USER' ), $this->object->getRoles() ); |
|
91 | + $this->object->setRoles(array('ROLE_USER')); |
|
92 | + $this->assertTrue($this->object->isModified()); |
|
93 | + $this->assertEquals(array('ROLE_USER'), $this->object->getRoles()); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | public function testGetSalt() |
97 | 97 | { |
98 | - $this->assertEquals( 'test', $this->object->getSalt() ); |
|
98 | + $this->assertEquals('test', $this->object->getSalt()); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | public function testGetSaltGenerated() |
102 | 102 | { |
103 | - $object = new \Aimeos\MShop\Customer\Item\FosUser( $this->address, [] ); |
|
104 | - $this->assertEquals( '', $object->getSalt() ); |
|
103 | + $object = new \Aimeos\MShop\Customer\Item\FosUser($this->address, []); |
|
104 | + $this->assertEquals('', $object->getSalt()); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | public function testSetSalt() |
108 | 108 | { |
109 | - $this->object->setSalt( 'new' ); |
|
110 | - $this->assertTrue( $this->object->isModified() ); |
|
111 | - $this->assertEquals( 'new', $this->object->getSalt() ); |
|
109 | + $this->object->setSalt('new'); |
|
110 | + $this->assertTrue($this->object->isModified()); |
|
111 | + $this->assertEquals('new', $this->object->getSalt()); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | public function testIsModified() |
115 | 115 | { |
116 | - $this->assertFalse( $this->object->isModified() ); |
|
116 | + $this->assertFalse($this->object->isModified()); |
|
117 | 117 | } |
118 | 118 | } |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | * @param \Aimeos\MShop\Common\Helper\Password\Iface|null $helper Password encryption helper object |
36 | 36 | * @param string|null $salt Password salt |
37 | 37 | */ |
38 | - public function __construct( \Aimeos\MShop\Common\Item\Address\Iface $address, array $values = [], |
|
38 | + public function __construct(\Aimeos\MShop\Common\Item\Address\Iface $address, array $values = [], |
|
39 | 39 | array $listItems = [], array $refItems = [], array $addrItems = [], array $propItems = [], |
40 | - \Aimeos\MShop\Common\Helper\Password\Iface $helper = null, $salt = null ) |
|
40 | + \Aimeos\MShop\Common\Helper\Password\Iface $helper = null, $salt = null) |
|
41 | 41 | { |
42 | - parent::__construct( $address, $values, $listItems, $refItems, $addrItems, $propItems, $helper, $salt ); |
|
42 | + parent::__construct($address, $values, $listItems, $refItems, $addrItems, $propItems, $helper, $salt); |
|
43 | 43 | |
44 | 44 | $this->values = $values; |
45 | 45 | $this->helper = $helper; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function getPassword() |
56 | 56 | { |
57 | - if( isset( $this->values['customer.password'] ) ) { |
|
57 | + if (isset($this->values['customer.password'])) { |
|
58 | 58 | return (string) $this->values['customer.password']; |
59 | 59 | } |
60 | 60 | |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | * @param string $value Password of the customer item |
69 | 69 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item for chaining method calls |
70 | 70 | */ |
71 | - public function setPassword( $value ) |
|
71 | + public function setPassword($value) |
|
72 | 72 | { |
73 | - if( (string) $value !== $this->getPassword() ) |
|
73 | + if ((string) $value !== $this->getPassword()) |
|
74 | 74 | { |
75 | - if( $this->helper !== null ) { |
|
76 | - $value = $this->helper->encode( $value, $this->getSalt() ); |
|
75 | + if ($this->helper !== null) { |
|
76 | + $value = $this->helper->encode($value, $this->getSalt()); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $this->values['customer.password'] = (string) $value; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function getRoles() |
93 | 93 | { |
94 | - if( isset( $this->values['roles'] ) ) { |
|
94 | + if (isset($this->values['roles'])) { |
|
95 | 95 | return (array) $this->values['roles']; |
96 | 96 | } |
97 | 97 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @param array $roles List of Symfony roles |
106 | 106 | */ |
107 | - public function setRoles( array $roles ) |
|
107 | + public function setRoles(array $roles) |
|
108 | 108 | { |
109 | 109 | $this->values['roles'] = $roles; |
110 | 110 | $this->setModified(); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function getSalt() |
122 | 122 | { |
123 | - if( isset( $this->values['salt'] ) ) { |
|
123 | + if (isset($this->values['salt'])) { |
|
124 | 124 | return $this->values['salt']; |
125 | 125 | } |
126 | 126 | |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @param string $value Password salt |
135 | 135 | */ |
136 | - public function setSalt( $value ) |
|
136 | + public function setSalt($value) |
|
137 | 137 | { |
138 | - if( (string) $value !== $this->getSalt() ) |
|
138 | + if ((string) $value !== $this->getSalt()) |
|
139 | 139 | { |
140 | 140 | $this->values['salt'] = (string) $value; |
141 | 141 | $this->setModified(); |