@@ -231,7 +231,7 @@ |
||
231 | 231 | /** |
232 | 232 | * Returns the frontend controller |
233 | 233 | * |
234 | - * @return \Aimeos\Controller\Frontend\Customer\Iface Frontend controller object |
|
234 | + * @return \Aimeos\Controller\Frontend\Iface Frontend controller object |
|
235 | 235 | * @since 2017.04 |
236 | 236 | */ |
237 | 237 | protected function getController() |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
31 | 31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
32 | 32 | */ |
33 | - public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
|
33 | + public function __construct(\Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context) |
|
34 | 34 | { |
35 | 35 | $iface = '\Aimeos\Controller\Frontend\Customer\Iface'; |
36 | - if( !( $controller instanceof $iface ) ) |
|
36 | + if (!($controller instanceof $iface)) |
|
37 | 37 | { |
38 | - $msg = sprintf( 'Class "%1$s" does not implement interface "%2$s"', get_class( $controller ), $iface ); |
|
39 | - throw new \Aimeos\Controller\Frontend\Exception( $msg ); |
|
38 | + $msg = sprintf('Class "%1$s" does not implement interface "%2$s"', get_class($controller), $iface); |
|
39 | + throw new \Aimeos\Controller\Frontend\Exception($msg); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $this->controller = $controller; |
43 | 43 | |
44 | - parent::__construct( $context ); |
|
44 | + parent::__construct($context); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @return mixed Returns the value of the called method |
54 | 54 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
55 | 55 | */ |
56 | - public function __call( $name, array $param ) |
|
56 | + public function __call($name, array $param) |
|
57 | 57 | { |
58 | - return @call_user_func_array( array( $this->controller, $name ), $param ); |
|
58 | + return @call_user_func_array(array($this->controller, $name), $param); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
67 | 67 | * @since 2017.04 |
68 | 68 | */ |
69 | - public function addItem( array $values ) |
|
69 | + public function addItem(array $values) |
|
70 | 70 | { |
71 | - return $this->controller->addItem( $values ); |
|
71 | + return $this->controller->addItem($values); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
79 | 79 | * @since 2017.04 |
80 | 80 | */ |
81 | - public function createItem( array $values = [] ) |
|
81 | + public function createItem(array $values = []) |
|
82 | 82 | { |
83 | - return $this->controller->createItem( $values ); |
|
83 | + return $this->controller->createItem($values); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | * @param string $id Unique customer ID |
91 | 91 | * @since 2017.04 |
92 | 92 | */ |
93 | - public function deleteItem( $id ) |
|
93 | + public function deleteItem($id) |
|
94 | 94 | { |
95 | - return $this->controller->deleteItem( $id ); |
|
95 | + return $this->controller->deleteItem($id); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
105 | 105 | * @since 2017.04 |
106 | 106 | */ |
107 | - public function editItem( $id, array $values ) |
|
107 | + public function editItem($id, array $values) |
|
108 | 108 | { |
109 | - return $this->controller->editItem( $id, $values ); |
|
109 | + return $this->controller->editItem($id, $values); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
119 | 119 | * @since 2017.04 |
120 | 120 | */ |
121 | - public function getItem( $id = null, array $domains = [] ) |
|
121 | + public function getItem($id = null, array $domains = []) |
|
122 | 122 | { |
123 | - return $this->controller->getItem( $id, $domains ); |
|
123 | + return $this->controller->getItem($id, $domains); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
135 | 135 | * @since 2017.04 |
136 | 136 | */ |
137 | - public function findItem( $code, array $domains = [] ) |
|
137 | + public function findItem($code, array $domains = []) |
|
138 | 138 | { |
139 | - return $this->controller->findItem( $code, $domains ); |
|
139 | + return $this->controller->findItem($code, $domains); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | * @param \Aimeos\MShop\Customer\Item\Iface Customer item |
147 | 147 | * @since 2017.04 |
148 | 148 | */ |
149 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ) |
|
149 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item) |
|
150 | 150 | { |
151 | - return $this->controller->saveItem( $item ); |
|
151 | + return $this->controller->saveItem($item); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | * @return \Aimeos\MShop\Customer\Item\Iface Customer address item |
160 | 160 | * @since 2017.04 |
161 | 161 | */ |
162 | - public function addAddressItem( array $values ) |
|
162 | + public function addAddressItem(array $values) |
|
163 | 163 | { |
164 | - return $this->controller->addAddressItem( $values ); |
|
164 | + return $this->controller->addAddressItem($values); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
172 | 172 | * @since 2017.04 |
173 | 173 | */ |
174 | - public function createAddressItem( array $values = [] ) |
|
174 | + public function createAddressItem(array $values = []) |
|
175 | 175 | { |
176 | - return $this->controller->createAddressItem( $values ); |
|
176 | + return $this->controller->createAddressItem($values); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | * @param string $id Unique customer address ID |
184 | 184 | * @since 2017.04 |
185 | 185 | */ |
186 | - public function deleteAddressItem( $id ) |
|
186 | + public function deleteAddressItem($id) |
|
187 | 187 | { |
188 | - $this->controller->deleteAddressItem( $id ); |
|
188 | + $this->controller->deleteAddressItem($id); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | * @return \Aimeos\MShop\Customer\Item\Iface Customer address item |
198 | 198 | * @since 2017.04 |
199 | 199 | */ |
200 | - public function editAddressItem( $id, array $values ) |
|
200 | + public function editAddressItem($id, array $values) |
|
201 | 201 | { |
202 | - return $this->controller->editAddressItem( $id, $values ); |
|
202 | + return $this->controller->editAddressItem($id, $values); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
211 | 211 | * @since 2017.04 |
212 | 212 | */ |
213 | - public function getAddressItem( $id ) |
|
213 | + public function getAddressItem($id) |
|
214 | 214 | { |
215 | - return $this->controller->getAddressItem( $id ); |
|
215 | + return $this->controller->getAddressItem($id); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | * @param \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
223 | 223 | * @since 2017.04 |
224 | 224 | */ |
225 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ) |
|
225 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item) |
|
226 | 226 | { |
227 | - $this->controller->saveAddressItem( $item ); |
|
227 | + $this->controller->saveAddressItem($item); |
|
228 | 228 | } |
229 | 229 | |
230 | 230 |
@@ -201,6 +201,9 @@ |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | |
204 | + /** |
|
205 | + * @param string $name |
|
206 | + */ |
|
204 | 207 | protected function access( $name ) |
205 | 208 | { |
206 | 209 | $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Customer\Decorator\Base' ); |
@@ -20,78 +20,78 @@ discard block |
||
20 | 20 | { |
21 | 21 | $this->context = \TestHelperFrontend::getContext(); |
22 | 22 | |
23 | - $this->stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Customer\Standard' ) |
|
23 | + $this->stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Customer\Standard') |
|
24 | 24 | ->disableOriginalConstructor() |
25 | 25 | ->getMock(); |
26 | 26 | |
27 | - $this->object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Customer\Decorator\Base' ) |
|
28 | - ->setConstructorArgs( [$this->stub, $this->context] ) |
|
27 | + $this->object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Customer\Decorator\Base') |
|
28 | + ->setConstructorArgs([$this->stub, $this->context]) |
|
29 | 29 | ->getMockForAbstractClass(); |
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | protected function tearDown() |
34 | 34 | { |
35 | - unset( $this->context, $this->object, $this->stub ); |
|
35 | + unset($this->context, $this->object, $this->stub); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | public function testConstructException() |
40 | 40 | { |
41 | - $stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Iface' )->getMock(); |
|
41 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Iface')->getMock(); |
|
42 | 42 | |
43 | - $this->setExpectedException( '\Aimeos\Controller\Frontend\Exception' ); |
|
43 | + $this->setExpectedException('\Aimeos\Controller\Frontend\Exception'); |
|
44 | 44 | |
45 | - $this->getMockBuilder( '\Aimeos\Controller\Frontend\Customer\Decorator\Base' ) |
|
46 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
45 | + $this->getMockBuilder('\Aimeos\Controller\Frontend\Customer\Decorator\Base') |
|
46 | + ->setConstructorArgs([$stub, $this->context]) |
|
47 | 47 | ->getMockForAbstractClass(); |
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | public function testCall() |
52 | 52 | { |
53 | - $stub = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Customer\Standard' ) |
|
53 | + $stub = $this->getMockBuilder('\Aimeos\Controller\Frontend\Customer\Standard') |
|
54 | 54 | ->disableOriginalConstructor() |
55 | - ->setMethods( ['invalid'] ) |
|
55 | + ->setMethods(['invalid']) |
|
56 | 56 | ->getMock(); |
57 | 57 | |
58 | - $object = $this->getMockBuilder( '\Aimeos\Controller\Frontend\Customer\Decorator\Base' ) |
|
59 | - ->setConstructorArgs( [$stub, $this->context] ) |
|
58 | + $object = $this->getMockBuilder('\Aimeos\Controller\Frontend\Customer\Decorator\Base') |
|
59 | + ->setConstructorArgs([$stub, $this->context]) |
|
60 | 60 | ->getMockForAbstractClass(); |
61 | 61 | |
62 | - $stub->expects( $this->once() )->method( 'invalid' )->will( $this->returnValue( true ) ); |
|
62 | + $stub->expects($this->once())->method('invalid')->will($this->returnValue(true)); |
|
63 | 63 | |
64 | - $this->assertTrue( $object->invalid() ); |
|
64 | + $this->assertTrue($object->invalid()); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
68 | 68 | public function testAddItem() |
69 | 69 | { |
70 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->createItem(); |
|
70 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->createItem(); |
|
71 | 71 | |
72 | - $this->stub->expects( $this->once() )->method( 'addItem' ) |
|
73 | - ->will( $this->returnValue( $item ) ); |
|
72 | + $this->stub->expects($this->once())->method('addItem') |
|
73 | + ->will($this->returnValue($item)); |
|
74 | 74 | |
75 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $this->object->addItem( [] ) ); |
|
75 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $this->object->addItem([])); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
79 | 79 | public function testCreateItem() |
80 | 80 | { |
81 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->createItem(); |
|
81 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->createItem(); |
|
82 | 82 | |
83 | - $this->stub->expects( $this->once() )->method( 'createItem' ) |
|
84 | - ->will( $this->returnValue( $item ) ); |
|
83 | + $this->stub->expects($this->once())->method('createItem') |
|
84 | + ->will($this->returnValue($item)); |
|
85 | 85 | |
86 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $this->object->createItem() ); |
|
86 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $this->object->createItem()); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | 90 | public function testDeleteItem() |
91 | 91 | { |
92 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->createItem(); |
|
92 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->createItem(); |
|
93 | 93 | |
94 | - $this->stub->expects( $this->once() )->method( 'deleteItem' ); |
|
94 | + $this->stub->expects($this->once())->method('deleteItem'); |
|
95 | 95 | |
96 | 96 | $this->object->deleteItem( -1 ); |
97 | 97 | } |
@@ -99,63 +99,63 @@ discard block |
||
99 | 99 | |
100 | 100 | public function testEditItem() |
101 | 101 | { |
102 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->createItem(); |
|
102 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->createItem(); |
|
103 | 103 | |
104 | - $this->stub->expects( $this->once() )->method( 'editItem' ) |
|
105 | - ->will( $this->returnValue( $item ) ); |
|
104 | + $this->stub->expects($this->once())->method('editItem') |
|
105 | + ->will($this->returnValue($item)); |
|
106 | 106 | |
107 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $this->object->editItem( -1, [] ) ); |
|
107 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $this->object->editItem( -1, [] )); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
111 | 111 | public function testGetItem() |
112 | 112 | { |
113 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->createItem(); |
|
113 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->createItem(); |
|
114 | 114 | |
115 | - $this->stub->expects( $this->once() )->method( 'getItem' ) |
|
116 | - ->will( $this->returnValue( $item ) ); |
|
115 | + $this->stub->expects($this->once())->method('getItem') |
|
116 | + ->will($this->returnValue($item)); |
|
117 | 117 | |
118 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $this->object->getItem( -1 ) ); |
|
118 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $this->object->getItem( -1 )); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
122 | 122 | public function testFindItem() |
123 | 123 | { |
124 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->createItem(); |
|
124 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->createItem(); |
|
125 | 125 | |
126 | - $this->stub->expects( $this->once() )->method( 'findItem' ) |
|
127 | - ->will( $this->returnValue( $item ) ); |
|
126 | + $this->stub->expects($this->once())->method('findItem') |
|
127 | + ->will($this->returnValue($item)); |
|
128 | 128 | |
129 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $this->object->findItem( 'test' ) ); |
|
129 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $this->object->findItem('test')); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
133 | 133 | public function testSaveItem() |
134 | 134 | { |
135 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->createItem(); |
|
135 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->createItem(); |
|
136 | 136 | |
137 | - $this->stub->expects( $this->once() )->method( 'saveItem' ); |
|
137 | + $this->stub->expects($this->once())->method('saveItem'); |
|
138 | 138 | |
139 | - $this->object->saveItem( $item ); |
|
139 | + $this->object->saveItem($item); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | 143 | public function testCreateAddressItem() |
144 | 144 | { |
145 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' )->createItem(); |
|
145 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address')->createItem(); |
|
146 | 146 | |
147 | - $this->stub->expects( $this->once() )->method( 'createAddressItem' ) |
|
148 | - ->will( $this->returnValue( $item ) ); |
|
147 | + $this->stub->expects($this->once())->method('createAddressItem') |
|
148 | + ->will($this->returnValue($item)); |
|
149 | 149 | |
150 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $this->object->createAddressItem() ); |
|
150 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $this->object->createAddressItem()); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | 154 | public function testDeleteAddressItem() |
155 | 155 | { |
156 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' )->createItem(); |
|
156 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address')->createItem(); |
|
157 | 157 | |
158 | - $this->stub->expects( $this->once() )->method( 'deleteAddressItem' ); |
|
158 | + $this->stub->expects($this->once())->method('deleteAddressItem'); |
|
159 | 159 | |
160 | 160 | $this->object->deleteAddressItem( -1 ); |
161 | 161 | } |
@@ -163,49 +163,49 @@ discard block |
||
163 | 163 | |
164 | 164 | public function testEditAddressItem() |
165 | 165 | { |
166 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' )->createItem(); |
|
166 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address')->createItem(); |
|
167 | 167 | |
168 | - $this->stub->expects( $this->once() )->method( 'editAddressItem' ) |
|
169 | - ->will( $this->returnValue( $item ) ); |
|
168 | + $this->stub->expects($this->once())->method('editAddressItem') |
|
169 | + ->will($this->returnValue($item)); |
|
170 | 170 | |
171 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $this->object->editAddressItem( -1, [] ) ); |
|
171 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $this->object->editAddressItem( -1, [] )); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
175 | 175 | public function testGetAddressItem() |
176 | 176 | { |
177 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' )->createItem(); |
|
177 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address')->createItem(); |
|
178 | 178 | |
179 | - $this->stub->expects( $this->once() )->method( 'getAddressItem' ) |
|
180 | - ->will( $this->returnValue( $item ) ); |
|
179 | + $this->stub->expects($this->once())->method('getAddressItem') |
|
180 | + ->will($this->returnValue($item)); |
|
181 | 181 | |
182 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $this->object->getAddressItem( -1 ) ); |
|
182 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $this->object->getAddressItem( -1 )); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | |
186 | 186 | public function testSaveAddressItem() |
187 | 187 | { |
188 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' )->createItem(); |
|
188 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address')->createItem(); |
|
189 | 189 | |
190 | - $this->stub->expects( $this->once() )->method( 'saveAddressItem' ); |
|
190 | + $this->stub->expects($this->once())->method('saveAddressItem'); |
|
191 | 191 | |
192 | - $this->object->saveAddressItem( $item ); |
|
192 | + $this->object->saveAddressItem($item); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | |
196 | 196 | public function testGetController() |
197 | 197 | { |
198 | - $result = $this->access( 'getController' )->invokeArgs( $this->object, [] ); |
|
198 | + $result = $this->access('getController')->invokeArgs($this->object, []); |
|
199 | 199 | |
200 | - $this->assertSame( $this->stub, $result ); |
|
200 | + $this->assertSame($this->stub, $result); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
204 | - protected function access( $name ) |
|
204 | + protected function access($name) |
|
205 | 205 | { |
206 | - $class = new \ReflectionClass( '\Aimeos\Controller\Frontend\Customer\Decorator\Base' ); |
|
207 | - $method = $class->getMethod( $name ); |
|
208 | - $method->setAccessible( true ); |
|
206 | + $class = new \ReflectionClass('\Aimeos\Controller\Frontend\Customer\Decorator\Base'); |
|
207 | + $method = $class->getMethod($name); |
|
208 | + $method->setAccessible(true); |
|
209 | 209 | |
210 | 210 | return $method; |
211 | 211 | } |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
29 | 29 | * @since 2017.04 |
30 | 30 | */ |
31 | - public function addItem( array $values ) |
|
31 | + public function addItem(array $values) |
|
32 | 32 | { |
33 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
33 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
34 | 34 | |
35 | 35 | $item = $manager->createItem(); |
36 | - $item->fromArray( $values ); |
|
37 | - $manager->saveItem( $item ); |
|
36 | + $item->fromArray($values); |
|
37 | + $manager->saveItem($item); |
|
38 | 38 | |
39 | 39 | return $item; |
40 | 40 | } |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
47 | 47 | */ |
48 | - public function createItem( array $values = [] ) |
|
48 | + public function createItem(array $values = []) |
|
49 | 49 | { |
50 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
50 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
51 | 51 | |
52 | 52 | $item = $manager->createItem(); |
53 | - $item->fromArray( $values ); |
|
54 | - $item->setStatus( 1 ); |
|
53 | + $item->fromArray($values); |
|
54 | + $item->setStatus(1); |
|
55 | 55 | |
56 | 56 | return $item; |
57 | 57 | } |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | * @param string $id Unique customer ID |
64 | 64 | * @since 2017.04 |
65 | 65 | */ |
66 | - public function deleteItem( $id ) |
|
66 | + public function deleteItem($id) |
|
67 | 67 | { |
68 | - $this->checkUser( $id ); |
|
68 | + $this->checkUser($id); |
|
69 | 69 | |
70 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
71 | - $manager->deleteItem( $id ); |
|
70 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
71 | + $manager->deleteItem($id); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
81 | 81 | * @since 2017.04 |
82 | 82 | */ |
83 | - public function editItem( $id, array $values ) |
|
83 | + public function editItem($id, array $values) |
|
84 | 84 | { |
85 | - $this->checkUser( $id ); |
|
85 | + $this->checkUser($id); |
|
86 | 86 | |
87 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
87 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
88 | 88 | |
89 | - $item = $manager->getItem( $id, [], true ); |
|
90 | - $item->fromArray( $values ); |
|
91 | - $manager->saveItem( $item ); |
|
89 | + $item = $manager->getItem($id, [], true); |
|
90 | + $item->fromArray($values); |
|
91 | + $manager->saveItem($item); |
|
92 | 92 | |
93 | 93 | return $item; |
94 | 94 | } |
@@ -102,17 +102,17 @@ discard block |
||
102 | 102 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
103 | 103 | * @since 2017.04 |
104 | 104 | */ |
105 | - public function getItem( $id = null, array $domains = [] ) |
|
105 | + public function getItem($id = null, array $domains = []) |
|
106 | 106 | { |
107 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' ); |
|
107 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer'); |
|
108 | 108 | |
109 | - if( $id === null ) { |
|
110 | - return $manager->getItem( $this->getContext()->getUserId(), $domains, true ); |
|
109 | + if ($id === null) { |
|
110 | + return $manager->getItem($this->getContext()->getUserId(), $domains, true); |
|
111 | 111 | } |
112 | 112 | |
113 | - $this->checkUser( $id ); |
|
113 | + $this->checkUser($id); |
|
114 | 114 | |
115 | - return $manager->getItem( $id, $domains, true ); |
|
115 | + return $manager->getItem($id, $domains, true); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
127 | 127 | * @since 2017.04 |
128 | 128 | */ |
129 | - public function findItem( $code, array $domains = [] ) |
|
129 | + public function findItem($code, array $domains = []) |
|
130 | 130 | { |
131 | - return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->findItem( $code, $domains ); |
|
131 | + return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->findItem($code, $domains); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @param \Aimeos\MShop\Customer\Item\Iface Customer item |
139 | 139 | */ |
140 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ) |
|
140 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item) |
|
141 | 141 | { |
142 | - \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->saveItem( $item ); |
|
142 | + \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->saveItem($item); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -150,15 +150,15 @@ discard block |
||
150 | 150 | * @return \Aimeos\MShop\Customer\Item\Iface Customer address item |
151 | 151 | * @since 2017.04 |
152 | 152 | */ |
153 | - public function addAddressItem( array $values ) |
|
153 | + public function addAddressItem(array $values) |
|
154 | 154 | { |
155 | 155 | $context = $this->getContext(); |
156 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
156 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
157 | 157 | |
158 | 158 | $item = $manager->createItem(); |
159 | - $item->fromArray( $values ); |
|
160 | - $item->setParentId( $context->getUserId() ); |
|
161 | - $manager->saveItem( $item ); |
|
159 | + $item->fromArray($values); |
|
160 | + $item->setParentId($context->getUserId()); |
|
161 | + $manager->saveItem($item); |
|
162 | 162 | |
163 | 163 | return $item; |
164 | 164 | } |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
171 | 171 | */ |
172 | - public function createAddressItem( array $values = [] ) |
|
172 | + public function createAddressItem(array $values = []) |
|
173 | 173 | { |
174 | 174 | $context = $this->getContext(); |
175 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
175 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
176 | 176 | |
177 | 177 | $item = $manager->createItem(); |
178 | - $item->fromArray( $values ); |
|
179 | - $item->setParentId( $context->getUserId() ); |
|
178 | + $item->fromArray($values); |
|
179 | + $item->setParentId($context->getUserId()); |
|
180 | 180 | |
181 | 181 | return $item; |
182 | 182 | } |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | * @param string $id Unique customer address ID |
189 | 189 | * @since 2017.04 |
190 | 190 | */ |
191 | - public function deleteAddressItem( $id ) |
|
191 | + public function deleteAddressItem($id) |
|
192 | 192 | { |
193 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
193 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
194 | 194 | |
195 | - $this->checkUser( $manager->getItem( $id, [], true )->getParentId() ); |
|
195 | + $this->checkUser($manager->getItem($id, [], true)->getParentId()); |
|
196 | 196 | |
197 | - $manager->deleteItem( $id ); |
|
197 | + $manager->deleteItem($id); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -206,15 +206,15 @@ discard block |
||
206 | 206 | * @return \Aimeos\MShop\Customer\Item\Iface Customer address item |
207 | 207 | * @since 2017.04 |
208 | 208 | */ |
209 | - public function editAddressItem( $id, array $values ) |
|
209 | + public function editAddressItem($id, array $values) |
|
210 | 210 | { |
211 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
211 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
212 | 212 | |
213 | - $item = $manager->getItem( $id, [], true ); |
|
214 | - $this->checkUser( $item->getParentId() ); |
|
213 | + $item = $manager->getItem($id, [], true); |
|
214 | + $this->checkUser($item->getParentId()); |
|
215 | 215 | |
216 | - $item->fromArray( $values ); |
|
217 | - $manager->saveItem( $item ); |
|
216 | + $item->fromArray($values); |
|
217 | + $manager->saveItem($item); |
|
218 | 218 | |
219 | 219 | return $item; |
220 | 220 | } |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
228 | 228 | * @since 2017.04 |
229 | 229 | */ |
230 | - public function getAddressItem( $id ) |
|
230 | + public function getAddressItem($id) |
|
231 | 231 | { |
232 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
233 | - $item = $manager->getItem( $id ); |
|
232 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
233 | + $item = $manager->getItem($id); |
|
234 | 234 | |
235 | - $this->checkUser( $item->getParentId() ); |
|
235 | + $this->checkUser($item->getParentId()); |
|
236 | 236 | |
237 | 237 | return $item; |
238 | 238 | } |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @param \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
245 | 245 | */ |
246 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ) |
|
246 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item) |
|
247 | 247 | { |
248 | - \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' )->saveItem( $item ); |
|
248 | + \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address')->saveItem($item); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -255,12 +255,12 @@ discard block |
||
255 | 255 | * @param string $id Unique customer ID |
256 | 256 | * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed |
257 | 257 | */ |
258 | - protected function checkUser( $id ) |
|
258 | + protected function checkUser($id) |
|
259 | 259 | { |
260 | - if( $id !== $this->getContext()->getUserId() ) |
|
260 | + if ($id !== $this->getContext()->getUserId()) |
|
261 | 261 | { |
262 | - $msg = sprintf( 'Not allowed to access customer data for ID "%1$s"', $id ); |
|
263 | - throw new \Aimeos\Controller\Frontend\Customer\Exception( $msg ); |
|
262 | + $msg = sprintf('Not allowed to access customer data for ID "%1$s"', $id); |
|
263 | + throw new \Aimeos\Controller\Frontend\Customer\Exception($msg); |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @param string|null $name Name of the controller implementaton (default: "Standard") |
29 | 29 | * @return \Aimeos\Controller\Frontend\Customer\Iface Controller object |
30 | 30 | */ |
31 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
31 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
32 | 32 | { |
33 | 33 | /** controller/frontend/customer/name |
34 | 34 | * Class name of the used customer frontend controller implementation |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | * @since 2014.03 |
64 | 64 | * @category Developer |
65 | 65 | */ |
66 | - if( $name === null ) { |
|
67 | - $name = $context->getConfig()->get( 'controller/frontend/customer/name', 'Standard' ); |
|
66 | + if ($name === null) { |
|
67 | + $name = $context->getConfig()->get('controller/frontend/customer/name', 'Standard'); |
|
68 | 68 | } |
69 | 69 | |
70 | - if( ctype_alnum( $name ) === false ) |
|
70 | + if (ctype_alnum($name) === false) |
|
71 | 71 | { |
72 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Customer\\' . $name : '<not a string>'; |
|
73 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
72 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Customer\\' . $name : '<not a string>'; |
|
73 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $iface = '\\Aimeos\\Controller\\Frontend\\Customer\\Iface'; |
77 | 77 | $classname = '\\Aimeos\\Controller\\Frontend\\Customer\\' . $name; |
78 | 78 | |
79 | - $manager = self::createControllerBase( $context, $classname, $iface ); |
|
79 | + $manager = self::createControllerBase($context, $classname, $iface); |
|
80 | 80 | |
81 | 81 | /** controller/frontend/customer/decorators/excludes |
82 | 82 | * Excludes decorators added by the "common" option from the customer frontend controllers |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @see controller/frontend/customer/decorators/excludes |
153 | 153 | * @see controller/frontend/customer/decorators/global |
154 | 154 | */ |
155 | - return self::addControllerDecorators( $context, $manager, 'customer' ); |
|
155 | + return self::addControllerDecorators($context, $manager, 'customer'); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
27 | 27 | * @since 2017.04 |
28 | 28 | */ |
29 | - public function addItem( array $values ); |
|
29 | + public function addItem(array $values); |
|
30 | 30 | |
31 | 31 | |
32 | 32 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
36 | 36 | * @since 2017.04 |
37 | 37 | */ |
38 | - public function createItem( array $values = [] ); |
|
38 | + public function createItem(array $values = []); |
|
39 | 39 | |
40 | 40 | |
41 | 41 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param string $id Unique customer ID |
45 | 45 | * @since 2017.04 |
46 | 46 | */ |
47 | - public function deleteItem( $id ); |
|
47 | + public function deleteItem($id); |
|
48 | 48 | |
49 | 49 | |
50 | 50 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item |
56 | 56 | * @since 2017.04 |
57 | 57 | */ |
58 | - public function editItem( $id, array $values ); |
|
58 | + public function editItem($id, array $values); |
|
59 | 59 | |
60 | 60 | |
61 | 61 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
67 | 67 | * @since 2017.04 |
68 | 68 | */ |
69 | - public function getItem( $id = null, array $domains = [] ); |
|
69 | + public function getItem($id = null, array $domains = []); |
|
70 | 70 | |
71 | 71 | |
72 | 72 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items |
80 | 80 | * @since 2017.04 |
81 | 81 | */ |
82 | - public function findItem( $code, array $domains = [] ); |
|
82 | + public function findItem($code, array $domains = []); |
|
83 | 83 | |
84 | 84 | |
85 | 85 | /** |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param \Aimeos\MShop\Customer\Item\Iface Customer item |
89 | 89 | * @since 2017.04 |
90 | 90 | */ |
91 | - public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item ); |
|
91 | + public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item); |
|
92 | 92 | |
93 | 93 | |
94 | 94 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @return \Aimeos\MShop\Customer\Item\Iface Customer address item |
99 | 99 | * @since 2017.04 |
100 | 100 | */ |
101 | - public function addAddressItem( array $values ); |
|
101 | + public function addAddressItem(array $values); |
|
102 | 102 | |
103 | 103 | |
104 | 104 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
108 | 108 | * @since 2017.04 |
109 | 109 | */ |
110 | - public function createAddressItem( array $values = [] ); |
|
110 | + public function createAddressItem(array $values = []); |
|
111 | 111 | |
112 | 112 | |
113 | 113 | /** |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param string $id Unique customer address ID |
117 | 117 | * @since 2017.04 |
118 | 118 | */ |
119 | - public function deleteAddressItem( $id ); |
|
119 | + public function deleteAddressItem($id); |
|
120 | 120 | |
121 | 121 | |
122 | 122 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @return \Aimeos\MShop\Customer\Item\Iface Customer address item |
128 | 128 | * @since 2017.04 |
129 | 129 | */ |
130 | - public function editAddressItem( $id, array $values ); |
|
130 | + public function editAddressItem($id, array $values); |
|
131 | 131 | |
132 | 132 | |
133 | 133 | /** |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
138 | 138 | * @since 2017.04 |
139 | 139 | */ |
140 | - public function getAddressItem( $id ); |
|
140 | + public function getAddressItem($id); |
|
141 | 141 | |
142 | 142 | |
143 | 143 | /** |
@@ -146,5 +146,5 @@ discard block |
||
146 | 146 | * @param \Aimeos\MShop\Customer\Item\Address\Iface Customer address item |
147 | 147 | * @since 2017.04 |
148 | 148 | */ |
149 | - public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item ); |
|
149 | + public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item); |
|
150 | 150 | } |
@@ -15,31 +15,31 @@ |
||
15 | 15 | { |
16 | 16 | $target = '\\Aimeos\\Controller\\Frontend\\Customer\\Iface'; |
17 | 17 | |
18 | - $controller = \Aimeos\Controller\Frontend\Customer\Factory::createController( \TestHelperFrontend::getContext() ); |
|
19 | - $this->assertInstanceOf( $target, $controller ); |
|
18 | + $controller = \Aimeos\Controller\Frontend\Customer\Factory::createController(\TestHelperFrontend::getContext()); |
|
19 | + $this->assertInstanceOf($target, $controller); |
|
20 | 20 | |
21 | - $controller = \Aimeos\Controller\Frontend\Customer\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' ); |
|
22 | - $this->assertInstanceOf( $target, $controller ); |
|
21 | + $controller = \Aimeos\Controller\Frontend\Customer\Factory::createController(\TestHelperFrontend::getContext(), 'Standard'); |
|
22 | + $this->assertInstanceOf($target, $controller); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | |
26 | 26 | public function testCreateControllerInvalidImplementation() |
27 | 27 | { |
28 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
29 | - \Aimeos\Controller\Frontend\Customer\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' ); |
|
28 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
29 | + \Aimeos\Controller\Frontend\Customer\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
33 | 33 | public function testCreateControllerInvalidName() |
34 | 34 | { |
35 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
36 | - \Aimeos\Controller\Frontend\Customer\Factory::createController( \TestHelperFrontend::getContext(), '%^' ); |
|
35 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
36 | + \Aimeos\Controller\Frontend\Customer\Factory::createController(\TestHelperFrontend::getContext(), '%^'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
40 | 40 | public function testCreateControllerNotExisting() |
41 | 41 | { |
42 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
43 | - \Aimeos\Controller\Frontend\Customer\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' ); |
|
42 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
43 | + \Aimeos\Controller\Frontend\Customer\Factory::createController(\TestHelperFrontend::getContext(), 'notexist'); |
|
44 | 44 | } |
45 | 45 | } |
@@ -18,106 +18,106 @@ |
||
18 | 18 | protected function setUp() |
19 | 19 | { |
20 | 20 | $this->context = \TestHelperFrontend::getContext(); |
21 | - $this->object = new \Aimeos\Controller\Frontend\Customer\Standard( $this->context ); |
|
21 | + $this->object = new \Aimeos\Controller\Frontend\Customer\Standard($this->context); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | 25 | protected function tearDown() |
26 | 26 | { |
27 | - unset( $this->context, $this->object ); |
|
27 | + unset($this->context, $this->object); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | public function testAddEditSaveDeleteItem() |
32 | 32 | { |
33 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' ); |
|
34 | - $id = $manager->findItem( 'UTC001' )->getId(); |
|
33 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer'); |
|
34 | + $id = $manager->findItem('UTC001')->getId(); |
|
35 | 35 | |
36 | - $this->context->setUserId( $id ); |
|
37 | - $item = $this->object->addItem( ['customer.code' => 'unittest-ctnl', 'customer.status' => 1] ); |
|
38 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
36 | + $this->context->setUserId($id); |
|
37 | + $item = $this->object->addItem(['customer.code' => 'unittest-ctnl', 'customer.status' => 1]); |
|
38 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
39 | 39 | |
40 | - $this->context->setUserId( $item->getId() ); |
|
41 | - $item = $this->object->editItem( $item->getId(), ['customer.code' => 'unittest-ctnl2'] ); |
|
42 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $item ); |
|
40 | + $this->context->setUserId($item->getId()); |
|
41 | + $item = $this->object->editItem($item->getId(), ['customer.code' => 'unittest-ctnl2']); |
|
42 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $item); |
|
43 | 43 | |
44 | - $item->setStatus( 0 ); |
|
45 | - $this->object->saveItem( $item ); |
|
46 | - $this->assertEquals( 0, $item->getStatus() ); |
|
44 | + $item->setStatus(0); |
|
45 | + $this->object->saveItem($item); |
|
46 | + $this->assertEquals(0, $item->getStatus()); |
|
47 | 47 | |
48 | - $this->object->deleteItem( $item->getId() ); |
|
48 | + $this->object->deleteItem($item->getId()); |
|
49 | 49 | |
50 | - $this->setExpectedException( '\Aimeos\MShop\Exception' ); |
|
51 | - $manager->findItem( 'unittest-ctnl' ); |
|
50 | + $this->setExpectedException('\Aimeos\MShop\Exception'); |
|
51 | + $manager->findItem('unittest-ctnl'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | public function testCreateItem() |
56 | 56 | { |
57 | 57 | $result = $this->object->createItem(); |
58 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
58 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testGetItem() |
63 | 63 | { |
64 | - $id = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' )->getId(); |
|
65 | - $this->context->setUserId( $id ); |
|
64 | + $id = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001')->getId(); |
|
65 | + $this->context->setUserId($id); |
|
66 | 66 | |
67 | - $result = $this->object->getItem( $id, ['address', 'text'] ); |
|
67 | + $result = $this->object->getItem($id, ['address', 'text']); |
|
68 | 68 | |
69 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
70 | - $this->assertEquals( 1, count( $result->getRefItems( 'text' ) ) ); |
|
71 | - $this->assertEquals( 1, count( $result->getAddressItems() ) ); |
|
69 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
70 | + $this->assertEquals(1, count($result->getRefItems('text'))); |
|
71 | + $this->assertEquals(1, count($result->getAddressItems())); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | 75 | public function testFindItem() |
76 | 76 | { |
77 | - $result = $this->object->findItem( 'UTC001' ); |
|
78 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Iface', $result ); |
|
77 | + $result = $this->object->findItem('UTC001'); |
|
78 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Iface', $result); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
82 | 82 | public function testAddEditSaveDeleteAddressItem() |
83 | 83 | { |
84 | - $customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' ); |
|
85 | - $this->context->setUserId( $customer->getId() ); |
|
84 | + $customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001'); |
|
85 | + $this->context->setUserId($customer->getId()); |
|
86 | 86 | |
87 | - $item = $this->object->addAddressItem( ['customer.address.lastname' => 'unittest-ctnl'] ); |
|
88 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
87 | + $item = $this->object->addAddressItem(['customer.address.lastname' => 'unittest-ctnl']); |
|
88 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
89 | 89 | |
90 | - $item = $this->object->editAddressItem( $item->getId(), ['customer.address.lastname' => 'unittest-ctnl2'] ); |
|
91 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $item ); |
|
90 | + $item = $this->object->editAddressItem($item->getId(), ['customer.address.lastname' => 'unittest-ctnl2']); |
|
91 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $item); |
|
92 | 92 | |
93 | - $item->setLastName( 'test' ); |
|
94 | - $this->object->saveAddressItem( $item ); |
|
95 | - $this->assertEquals( 'test', $item->getLastName() ); |
|
93 | + $item->setLastName('test'); |
|
94 | + $this->object->saveAddressItem($item); |
|
95 | + $this->assertEquals('test', $item->getLastName()); |
|
96 | 96 | |
97 | - $this->object->deleteAddressItem( $item->getId() ); |
|
97 | + $this->object->deleteAddressItem($item->getId()); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | 101 | public function testCreateAddressItem() |
102 | 102 | { |
103 | 103 | $result = $this->object->createAddressItem(); |
104 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
104 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
108 | 108 | public function testGetAddressItem() |
109 | 109 | { |
110 | - $manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/address' ); |
|
110 | + $manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/address'); |
|
111 | 111 | $search = $manager->createSearch(); |
112 | - $search->setSlice( 0, 1 ); |
|
113 | - $result = $manager->searchItems( $search ); |
|
112 | + $search->setSlice(0, 1); |
|
113 | + $result = $manager->searchItems($search); |
|
114 | 114 | |
115 | - if( ( $item = reset( $result ) ) === false ) { |
|
116 | - throw new \RuntimeException( 'No customer address available' ); |
|
115 | + if (($item = reset($result)) === false) { |
|
116 | + throw new \RuntimeException('No customer address available'); |
|
117 | 117 | } |
118 | 118 | |
119 | - $this->context->setUserId( $item->getParentId() ); |
|
120 | - $result = $this->object->getAddressItem( $item->getId() ); |
|
121 | - $this->assertInstanceOf( '\Aimeos\MShop\Customer\Item\Address\Iface', $result ); |
|
119 | + $this->context->setUserId($item->getParentId()); |
|
120 | + $result = $this->object->getAddressItem($item->getId()); |
|
121 | + $this->assertInstanceOf('\Aimeos\MShop\Customer\Item\Address\Iface', $result); |
|
122 | 122 | } |
123 | 123 | } |