Completed
Push — master ( 7a4b9a...d26f8a )
by Aimeos
02:59
created
controller/frontend/tests/Controller/Frontend/Basket/StandardTest.php 1 patch
Spacing   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -19,112 +19,112 @@  discard block
 block discarded – undo
19 19
 	public static function setUpBeforeClass()
20 20
 	{
21 21
 		$context = \TestHelperFrontend::getContext();
22
-		self::$testItem = \Aimeos\MShop\Factory::createManager( $context, 'product' )->findItem( 'U:TESTP' );
22
+		self::$testItem = \Aimeos\MShop\Factory::createManager($context, 'product')->findItem('U:TESTP');
23 23
 	}
24 24
 
25 25
 
26 26
 	protected function setUp()
27 27
 	{
28
-		\Aimeos\MShop\Factory::setCache( true );
28
+		\Aimeos\MShop\Factory::setCache(true);
29 29
 
30 30
 		$this->context = \TestHelperFrontend::getContext();
31
-		$this->object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
31
+		$this->object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
32 32
 	}
33 33
 
34 34
 
35 35
 	protected function tearDown()
36 36
 	{
37
-		\Aimeos\MShop\Factory::setCache( false );
37
+		\Aimeos\MShop\Factory::setCache(false);
38 38
 		\Aimeos\MShop\Factory::clear();
39 39
 
40 40
 		$this->object->clear();
41
-		$this->context->getSession()->set( 'aimeos', [] );
41
+		$this->context->getSession()->set('aimeos', []);
42 42
 
43
-		unset( $this->context, $this->object );
43
+		unset($this->context, $this->object);
44 44
 	}
45 45
 
46 46
 
47 47
 	public function testClear()
48 48
 	{
49
-		$this->object->addProduct( self::$testItem->getId(), 2 );
49
+		$this->object->addProduct(self::$testItem->getId(), 2);
50 50
 		$this->object->clear();
51 51
 
52
-		$this->assertEquals( 0, count( $this->object->get()->getProducts() ) );
52
+		$this->assertEquals(0, count($this->object->get()->getProducts()));
53 53
 	}
54 54
 
55 55
 
56 56
 	public function testGet()
57 57
 	{
58
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Base\Iface', $this->object->get() );
58
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Base\Iface', $this->object->get());
59 59
 	}
60 60
 
61 61
 
62 62
 	public function testSave()
63 63
 	{
64
-		$stub = $this->getMockBuilder( '\Aimeos\MShop\Order\Manager\Base\Standard' )
65
-			->setConstructorArgs( [$this->context] )
66
-			->setMethods( ['setSession'] )
64
+		$stub = $this->getMockBuilder('\Aimeos\MShop\Order\Manager\Base\Standard')
65
+			->setConstructorArgs([$this->context])
66
+			->setMethods(['setSession'])
67 67
 			->getMock();
68 68
 
69
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order/base', $stub );
69
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $stub);
70 70
 
71
-		$stub->expects( $this->exactly( 2 ) )->method( 'setSession' );
71
+		$stub->expects($this->exactly(2))->method('setSession');
72 72
 
73
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
74
-		$object->addProduct( self::$testItem->getId(), 2 );
73
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
74
+		$object->addProduct(self::$testItem->getId(), 2);
75 75
 		$object->save();
76 76
 	}
77 77
 
78 78
 
79 79
 	public function testSetType()
80 80
 	{
81
-		$this->assertInstanceOf( '\Aimeos\Controller\Frontend\Basket\Iface', $this->object->setType( 'test' ) );
81
+		$this->assertInstanceOf('\Aimeos\Controller\Frontend\Basket\Iface', $this->object->setType('test'));
82 82
 	}
83 83
 
84 84
 
85 85
 	public function testStore()
86 86
 	{
87
-		$stub = $this->getMockBuilder( '\Aimeos\MShop\Order\Manager\Base\Standard' )
88
-			->setConstructorArgs( [$this->context] )
89
-			->setMethods( ['store'] )
87
+		$stub = $this->getMockBuilder('\Aimeos\MShop\Order\Manager\Base\Standard')
88
+			->setConstructorArgs([$this->context])
89
+			->setMethods(['store'])
90 90
 			->getMock();
91 91
 
92
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order/base', $stub );
92
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $stub);
93 93
 
94
-		$stub->expects( $this->once() )->method( 'store' );
94
+		$stub->expects($this->once())->method('store');
95 95
 
96
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
96
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
97 97
 		$object->store();
98 98
 	}
99 99
 
100 100
 
101 101
 	public function testStoreLimit()
102 102
 	{
103
-		$this->context->setEditor( 'core:unittest' );
103
+		$this->context->setEditor('core:unittest');
104 104
 		$config = $this->context->getConfig();
105
-		$config->set( 'controller/frontend/basket/limit-count', 0 );
106
-		$config->set( 'controller/frontend/basket/limit-seconds', 86400 * 365 );
105
+		$config->set('controller/frontend/basket/limit-count', 0);
106
+		$config->set('controller/frontend/basket/limit-seconds', 86400 * 365);
107 107
 
108
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
108
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
109 109
 
110
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Basket\Exception' );
110
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Basket\Exception');
111 111
 		$object->store();
112 112
 	}
113 113
 
114 114
 
115 115
 	public function testLoad()
116 116
 	{
117
-		$stub = $this->getMockBuilder( '\Aimeos\MShop\Order\Manager\Base\Standard' )
118
-			->setConstructorArgs( [$this->context] )
119
-			->setMethods( ['load'] )
117
+		$stub = $this->getMockBuilder('\Aimeos\MShop\Order\Manager\Base\Standard')
118
+			->setConstructorArgs([$this->context])
119
+			->setMethods(['load'])
120 120
 			->getMock();
121 121
 
122
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order/base', $stub );
122
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order/base', $stub);
123 123
 
124
-		$stub->expects( $this->once() )->method( 'load' )
125
-			->will( $this->returnValue( $stub->createItem() ) );
124
+		$stub->expects($this->once())->method('load')
125
+			->will($this->returnValue($stub->createItem()));
126 126
 
127
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
127
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
128 128
 		$object->load( -1 );
129 129
 	}
130 130
 
@@ -132,301 +132,301 @@  discard block
 block discarded – undo
132 132
 	public function testAddDeleteProduct()
133 133
 	{
134 134
 		$basket = $this->object->get();
135
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' );
135
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC');
136 136
 
137
-		$this->object->addProduct( $item->getId(), 2, [], [], [], [], [], 'default' );
138
-		$item2 = $this->object->get()->getProduct( 0 );
139
-		$this->object->deleteProduct( 0 );
137
+		$this->object->addProduct($item->getId(), 2, [], [], [], [], [], 'default');
138
+		$item2 = $this->object->get()->getProduct(0);
139
+		$this->object->deleteProduct(0);
140 140
 
141
-		$this->assertEquals( 0, count( $basket->getProducts() ) );
142
-		$this->assertEquals( 'CNC', $item2->getProductCode() );
141
+		$this->assertEquals(0, count($basket->getProducts()));
142
+		$this->assertEquals('CNC', $item2->getProductCode());
143 143
 	}
144 144
 
145 145
 
146 146
 	public function testAddProductCustomAttribute()
147 147
 	{
148
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
148
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
149 149
 
150 150
 		$search = $attributeManager->createSearch();
151 151
 		$expr = array(
152
-			$search->compare( '==', 'attribute.code', 'custom' ),
153
-			$search->compare( '==', 'attribute.type.code', 'date' ),
152
+			$search->compare('==', 'attribute.code', 'custom'),
153
+			$search->compare('==', 'attribute.type.code', 'date'),
154 154
 		);
155
-		$search->setConditions( $search->combine( '&&', $expr ) );
155
+		$search->setConditions($search->combine('&&', $expr));
156 156
 
157
-		$attributes = $attributeManager->searchItems( $search );
157
+		$attributes = $attributeManager->searchItems($search);
158 158
 
159
-		if( ( $attrItem = reset( $attributes ) ) === false ) {
160
-			throw new \RuntimeException( 'Attribute not found' );
159
+		if (($attrItem = reset($attributes)) === false) {
160
+			throw new \RuntimeException('Attribute not found');
161 161
 		}
162 162
 
163
-		$attrValues = array( $attrItem->getId() => '2000-01-01' );
163
+		$attrValues = array($attrItem->getId() => '2000-01-01');
164 164
 
165
-		$this->object->addProduct( self::$testItem->getId(), 1, [], [], [], [], $attrValues );
165
+		$this->object->addProduct(self::$testItem->getId(), 1, [], [], [], [], $attrValues);
166 166
 		$basket = $this->object->get();
167 167
 
168
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
169
-		$this->assertEquals( '2000-01-01', $basket->getProduct( 0 )->getAttribute( 'date', 'custom' ) );
168
+		$this->assertEquals(1, count($basket->getProducts()));
169
+		$this->assertEquals('2000-01-01', $basket->getProduct(0)->getAttribute('date', 'custom'));
170 170
 	}
171 171
 
172 172
 
173 173
 	public function testAddProductCustomPrice()
174 174
 	{
175
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
175
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
176 176
 
177 177
 		$search = $attributeManager->createSearch();
178 178
 		$expr = array(
179
-			$search->compare( '==', 'attribute.code', 'custom' ),
180
-			$search->compare( '==', 'attribute.type.code', 'price' ),
179
+			$search->compare('==', 'attribute.code', 'custom'),
180
+			$search->compare('==', 'attribute.type.code', 'price'),
181 181
 		);
182
-		$search->setConditions( $search->combine( '&&', $expr ) );
182
+		$search->setConditions($search->combine('&&', $expr));
183 183
 
184
-		$attributes = $attributeManager->searchItems( $search );
184
+		$attributes = $attributeManager->searchItems($search);
185 185
 
186
-		if( ( $attrItem = reset( $attributes ) ) === false ) {
187
-			throw new \RuntimeException( 'Attribute not found' );
186
+		if (($attrItem = reset($attributes)) === false) {
187
+			throw new \RuntimeException('Attribute not found');
188 188
 		}
189 189
 
190
-		$attrValues = array( $attrItem->getId() => '0.01' );
190
+		$attrValues = array($attrItem->getId() => '0.01');
191 191
 
192
-		$this->object->addProduct( self::$testItem->getId(), 1, [], [], [], [], $attrValues );
192
+		$this->object->addProduct(self::$testItem->getId(), 1, [], [], [], [], $attrValues);
193 193
 		$basket = $this->object->get();
194 194
 
195
-		$this->assertEquals( 1, count( $basket->getProducts() ) );
196
-		$this->assertEquals( '0.01', $basket->getProduct( 0 )->getPrice()->getValue() );
195
+		$this->assertEquals(1, count($basket->getProducts()));
196
+		$this->assertEquals('0.01', $basket->getProduct(0)->getPrice()->getValue());
197 197
 	}
198 198
 
199 199
 
200 200
 	public function testAddProductCustomPriceException()
201 201
 	{
202
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
202
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
203 203
 
204 204
 		$search = $attributeManager->createSearch();
205 205
 		$expr = array(
206
-			$search->compare( '==', 'attribute.code', 'custom' ),
207
-			$search->compare( '==', 'attribute.type.code', 'price' ),
206
+			$search->compare('==', 'attribute.code', 'custom'),
207
+			$search->compare('==', 'attribute.type.code', 'price'),
208 208
 		);
209
-		$search->setConditions( $search->combine( '&&', $expr ) );
209
+		$search->setConditions($search->combine('&&', $expr));
210 210
 
211
-		$attributes = $attributeManager->searchItems( $search );
211
+		$attributes = $attributeManager->searchItems($search);
212 212
 
213
-		if( ( $attrItem = reset( $attributes ) ) === false ) {
214
-			throw new \RuntimeException( 'Attribute not found' );
213
+		if (($attrItem = reset($attributes)) === false) {
214
+			throw new \RuntimeException('Attribute not found');
215 215
 		}
216 216
 
217
-		$attrValues = array( $attrItem->getId() => ',' );
217
+		$attrValues = array($attrItem->getId() => ',');
218 218
 
219
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Basket\Exception' );
220
-		$this->object->addProduct( self::$testItem->getId(), 1, [], [], [], [], $attrValues );
219
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Basket\Exception');
220
+		$this->object->addProduct(self::$testItem->getId(), 1, [], [], [], [], $attrValues);
221 221
 	}
222 222
 
223 223
 
224 224
 	public function testAddProductAttributeNotAssigned()
225 225
 	{
226
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
226
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
227 227
 
228 228
 		$search = $attributeManager->createSearch();
229 229
 		$expr = array(
230
-			$search->compare( '==', 'attribute.code', '30' ),
231
-			$search->compare( '==', 'attribute.type.code', 'width' ),
230
+			$search->compare('==', 'attribute.code', '30'),
231
+			$search->compare('==', 'attribute.type.code', 'width'),
232 232
 		);
233
-		$search->setConditions( $search->combine( '&&', $expr ) );
233
+		$search->setConditions($search->combine('&&', $expr));
234 234
 
235
-		$attribute = $attributeManager->searchItems( $search );
235
+		$attribute = $attributeManager->searchItems($search);
236 236
 
237
-		if( empty( $attribute ) ) {
238
-			throw new \RuntimeException( 'Attribute not found' );
237
+		if (empty($attribute)) {
238
+			throw new \RuntimeException('Attribute not found');
239 239
 		}
240 240
 
241
-		$hiddenAttrIds = array_keys( $attribute );
242
-		$configAttrIds = array_keys( $attribute );
241
+		$hiddenAttrIds = array_keys($attribute);
242
+		$configAttrIds = array_keys($attribute);
243 243
 
244
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
245
-		$this->object->addProduct( self::$testItem->getId(), 1, [], [], $configAttrIds, $hiddenAttrIds );
244
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
245
+		$this->object->addProduct(self::$testItem->getId(), 1, [], [], $configAttrIds, $hiddenAttrIds);
246 246
 	}
247 247
 
248 248
 
249 249
 	public function testAddProductNegativeQuantityException()
250 250
 	{
251
-		$this->setExpectedException( '\\Aimeos\\MShop\\Order\\Exception' );
252
-		$this->object->addProduct( self::$testItem->getId(), -1 );
251
+		$this->setExpectedException('\\Aimeos\\MShop\\Order\\Exception');
252
+		$this->object->addProduct(self::$testItem->getId(), -1);
253 253
 	}
254 254
 
255 255
 
256 256
 	public function testAddProductNoPriceException()
257 257
 	{
258
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'MNOP' );
258
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('MNOP');
259 259
 
260
-		$this->setExpectedException( '\\Aimeos\\MShop\\Price\\Exception' );
261
-		$this->object->addProduct( $item->getId(), 1 );
260
+		$this->setExpectedException('\\Aimeos\\MShop\\Price\\Exception');
261
+		$this->object->addProduct($item->getId(), 1);
262 262
 	}
263 263
 
264 264
 
265 265
 	public function testAddProductConfigAttributeException()
266 266
 	{
267
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
268
-		$this->object->addProduct( self::$testItem->getId(), 1, [], [], array( -1 ) );
267
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
268
+		$this->object->addProduct(self::$testItem->getId(), 1, [], [], array( -1 ));
269 269
 	}
270 270
 
271 271
 
272 272
 	public function testAddProductLowQuantityPriceException()
273 273
 	{
274
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'IJKL' );
274
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('IJKL');
275 275
 
276
-		$this->setExpectedException( '\\Aimeos\\MShop\\Price\\Exception' );
277
-		$this->object->addProduct( $item->getId(), 1 );
276
+		$this->setExpectedException('\\Aimeos\\MShop\\Price\\Exception');
277
+		$this->object->addProduct($item->getId(), 1);
278 278
 	}
279 279
 
280 280
 
281 281
 	public function testAddProductHigherQuantities()
282 282
 	{
283
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'IJKL' );
283
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('IJKL');
284 284
 
285
-		$this->object->addProduct( $item->getId(), 2, [], [], [], [], [], 'unit_type3' );
285
+		$this->object->addProduct($item->getId(), 2, [], [], [], [], [], 'unit_type3');
286 286
 
287
-		$this->assertEquals( 2, $this->object->get()->getProduct( 0 )->getQuantity() );
288
-		$this->assertEquals( 'IJKL', $this->object->get()->getProduct( 0 )->getProductCode() );
287
+		$this->assertEquals(2, $this->object->get()->getProduct(0)->getQuantity());
288
+		$this->assertEquals('IJKL', $this->object->get()->getProduct(0)->getProductCode());
289 289
 	}
290 290
 
291 291
 
292 292
 	public function testDeleteProductFlagError()
293 293
 	{
294
-		$this->object->addProduct( self::$testItem->getId(), 2 );
294
+		$this->object->addProduct(self::$testItem->getId(), 2);
295 295
 
296
-		$item = $this->object->get()->getProduct( 0 );
297
-		$item->setFlags( \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE );
296
+		$item = $this->object->get()->getProduct(0);
297
+		$item->setFlags(\Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE);
298 298
 
299
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
300
-		$this->object->deleteProduct( 0 );
299
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
300
+		$this->object->deleteProduct(0);
301 301
 	}
302 302
 
303 303
 
304 304
 	public function testEditProduct()
305 305
 	{
306
-		$this->object->addProduct( self::$testItem->getId(), 1 );
306
+		$this->object->addProduct(self::$testItem->getId(), 1);
307 307
 
308
-		$item = $this->object->get()->getProduct( 0 );
309
-		$this->assertEquals( 1, $item->getQuantity() );
308
+		$item = $this->object->get()->getProduct(0);
309
+		$this->assertEquals(1, $item->getQuantity());
310 310
 
311
-		$this->object->editProduct( 0, 4 );
311
+		$this->object->editProduct(0, 4);
312 312
 
313
-		$item = $this->object->get()->getProduct( 0 );
314
-		$this->assertEquals( 4, $item->getQuantity() );
315
-		$this->assertEquals( 'U:TESTP', $item->getProductCode() );
313
+		$item = $this->object->get()->getProduct(0);
314
+		$this->assertEquals(4, $item->getQuantity());
315
+		$this->assertEquals('U:TESTP', $item->getProductCode());
316 316
 	}
317 317
 
318 318
 
319 319
 	public function testEditProductAttributes()
320 320
 	{
321
-		$attributeManager = \Aimeos\MShop\Factory::createManager( $this->context, 'attribute' );
321
+		$attributeManager = \Aimeos\MShop\Factory::createManager($this->context, 'attribute');
322 322
 
323 323
 		$search = $attributeManager->createSearch();
324 324
 		$conditions = array(
325
-			$search->compare( '==', 'attribute.domain', 'product' ),
326
-			$search->combine( '||', array(
327
-				$search->combine( '&&', array(
328
-					$search->compare( '==', 'attribute.code', 'xs' ),
329
-					$search->compare( '==', 'attribute.type.code', 'size' ),
330
-				) ),
331
-				$search->combine( '&&', array(
332
-					$search->compare( '==', 'attribute.code', 'white' ),
333
-					$search->compare( '==', 'attribute.type.code', 'color' ),
334
-				) ),
335
-			) )
325
+			$search->compare('==', 'attribute.domain', 'product'),
326
+			$search->combine('||', array(
327
+				$search->combine('&&', array(
328
+					$search->compare('==', 'attribute.code', 'xs'),
329
+					$search->compare('==', 'attribute.type.code', 'size'),
330
+				)),
331
+				$search->combine('&&', array(
332
+					$search->compare('==', 'attribute.code', 'white'),
333
+					$search->compare('==', 'attribute.type.code', 'color'),
334
+				)),
335
+			))
336 336
 		);
337
-		$search->setConditions( $search->combine( '&&', $conditions ) );
338
-		$attributes = $attributeManager->searchItems( $search );
337
+		$search->setConditions($search->combine('&&', $conditions));
338
+		$attributes = $attributeManager->searchItems($search);
339 339
 
340
-		if( ( $attribute = reset( $attributes ) ) === false ) {
341
-			throw new \RuntimeException( 'No attributes available' );
340
+		if (($attribute = reset($attributes)) === false) {
341
+			throw new \RuntimeException('No attributes available');
342 342
 		}
343 343
 
344 344
 
345
-		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:TESTP' );
345
+		$item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('U:TESTP');
346 346
 
347
-		$this->object->addProduct( $item->getId(), 1, [], [], array_keys( $attributes ) );
348
-		$this->object->editProduct( 0, 4 );
347
+		$this->object->addProduct($item->getId(), 1, [], [], array_keys($attributes));
348
+		$this->object->editProduct(0, 4);
349 349
 
350
-		$item = $this->object->get()->getProduct( 0 );
351
-		$this->assertEquals( 2, count( $item->getAttributes() ) );
352
-		$this->assertEquals( 4, $item->getQuantity() );
350
+		$item = $this->object->get()->getProduct(0);
351
+		$this->assertEquals(2, count($item->getAttributes()));
352
+		$this->assertEquals(4, $item->getQuantity());
353 353
 
354 354
 
355
-		$this->object->editProduct( 0, 3, [], array( $attribute->getType() ) );
355
+		$this->object->editProduct(0, 3, [], array($attribute->getType()));
356 356
 
357
-		$item = $this->object->get()->getProduct( 0 );
358
-		$this->assertEquals( 3, $item->getQuantity() );
359
-		$this->assertEquals( 1, count( $item->getAttributes() ) );
360
-		$this->assertEquals( 'U:TESTP', $item->getProductCode() );
357
+		$item = $this->object->get()->getProduct(0);
358
+		$this->assertEquals(3, $item->getQuantity());
359
+		$this->assertEquals(1, count($item->getAttributes()));
360
+		$this->assertEquals('U:TESTP', $item->getProductCode());
361 361
 	}
362 362
 
363 363
 
364 364
 	public function testEditProductFlagError()
365 365
 	{
366
-		$this->object->addProduct( self::$testItem->getId(), 2 );
366
+		$this->object->addProduct(self::$testItem->getId(), 2);
367 367
 
368
-		$item = $this->object->get()->getProduct( 0 );
369
-		$item->setFlags( \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE );
368
+		$item = $this->object->get()->getProduct(0);
369
+		$item->setFlags(\Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE);
370 370
 
371
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
372
-		$this->object->editProduct( 0, 4 );
371
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
372
+		$this->object->editProduct(0, 4);
373 373
 	}
374 374
 
375 375
 
376 376
 	public function testAddCoupon()
377 377
 	{
378
-		$this->object->addProduct( self::$testItem->getId(), 2 );
379
-		$this->object->addCoupon( 'GHIJ' );
378
+		$this->object->addProduct(self::$testItem->getId(), 2);
379
+		$this->object->addCoupon('GHIJ');
380 380
 
381 381
 		$basket = $this->object->get();
382 382
 
383
-		$this->assertEquals( 1, count( $basket->getCoupons() ) );
383
+		$this->assertEquals(1, count($basket->getCoupons()));
384 384
 	}
385 385
 
386 386
 
387 387
 	public function testAddCouponInvalidCode()
388 388
 	{
389
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
390
-		$this->object->addCoupon( 'invalid' );
389
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
390
+		$this->object->addCoupon('invalid');
391 391
 	}
392 392
 
393 393
 
394 394
 	public function testAddCouponMissingRequirements()
395 395
 	{
396
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
397
-		$this->object->addCoupon( 'OPQR' );
396
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
397
+		$this->object->addCoupon('OPQR');
398 398
 	}
399 399
 
400 400
 
401 401
 	public function testDeleteCoupon()
402 402
 	{
403
-		$this->object->addProduct( self::$testItem->getId(), 2 );
404
-		$this->object->addCoupon( '90AB' );
405
-		$this->object->deleteCoupon( '90AB' );
403
+		$this->object->addProduct(self::$testItem->getId(), 2);
404
+		$this->object->addCoupon('90AB');
405
+		$this->object->deleteCoupon('90AB');
406 406
 
407 407
 		$basket = $this->object->get();
408 408
 
409
-		$this->assertEquals( 0, count( $basket->getCoupons() ) );
409
+		$this->assertEquals(0, count($basket->getCoupons()));
410 410
 	}
411 411
 
412 412
 
413 413
 	public function testSetAddressDelete()
414 414
 	{
415
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null );
415
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null);
416 416
 
417
-		$this->setExpectedException( '\Aimeos\MShop\Order\Exception' );
418
-		$this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
417
+		$this->setExpectedException('\Aimeos\MShop\Order\Exception');
418
+		$this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
419 419
 	}
420 420
 
421 421
 
422 422
 	public function testSetBillingAddressByItem()
423 423
 	{
424
-		$item = $this->getAddress( 'Example company' );
424
+		$item = $this->getAddress('Example company');
425 425
 
426
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $item );
426
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $item);
427 427
 
428
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
429
-		$this->assertEquals( 'Example company', $address->getCompany() );
428
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
429
+		$this->assertEquals('Example company', $address->getCompany());
430 430
 	}
431 431
 
432 432
 
@@ -454,37 +454,37 @@  discard block
 block discarded – undo
454 454
 			'order.base.address.flag' => 0,
455 455
 		);
456 456
 
457
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $fixture );
457
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $fixture);
458 458
 
459
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT );
460
-		$this->assertEquals( 'Example company', $address->getCompany() );
461
-		$this->assertEquals( 'Dr.', $address->getTitle() );
462
-		$this->assertEquals( 'firstunit', $address->getFirstname() );
459
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT);
460
+		$this->assertEquals('Example company', $address->getCompany());
461
+		$this->assertEquals('Dr.', $address->getTitle());
462
+		$this->assertEquals('firstunit', $address->getFirstname());
463 463
 	}
464 464
 
465 465
 
466 466
 	public function testSetBillingAddressByArrayError()
467 467
 	{
468
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
469
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, array( 'error' => false ) );
468
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
469
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, array('error' => false));
470 470
 	}
471 471
 
472 472
 
473 473
 	public function testSetBillingAddressParameterError()
474 474
 	{
475
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
476
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 'error' );
475
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
476
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 'error');
477 477
 	}
478 478
 
479 479
 
480 480
 	public function testSetDeliveryAddressByItem()
481 481
 	{
482
-		$item = $this->getAddress( 'Example company' );
482
+		$item = $this->getAddress('Example company');
483 483
 
484
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $item );
484
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $item);
485 485
 
486
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY );
487
-		$this->assertEquals( 'Example company', $address->getCompany() );
486
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY);
487
+		$this->assertEquals('Example company', $address->getCompany());
488 488
 	}
489 489
 
490 490
 
@@ -511,119 +511,119 @@  discard block
 block discarded – undo
511 511
 			'order.base.address.website' => 'www.example.com',
512 512
 			'order.base.address.flag' => 0,
513 513
 		);
514
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $fixture );
514
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $fixture);
515 515
 
516
-		$address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY );
517
-		$this->assertEquals( 'Example company', $address->getCompany() );
518
-		$this->assertEquals( 'Dr.', $address->getTitle() );
519
-		$this->assertEquals( 'firstunit', $address->getFirstname() );
516
+		$address = $this->object->get()->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY);
517
+		$this->assertEquals('Example company', $address->getCompany());
518
+		$this->assertEquals('Dr.', $address->getTitle());
519
+		$this->assertEquals('firstunit', $address->getFirstname());
520 520
 	}
521 521
 
522 522
 
523 523
 	public function testSetDeliveryAddressByArrayError()
524 524
 	{
525
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
526
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, array( 'error' => false ) );
525
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
526
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, array('error' => false));
527 527
 	}
528 528
 
529 529
 
530 530
 	public function testSetDeliveryAddressTypeError()
531 531
 	{
532
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
533
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, 'error' );
532
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
533
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, 'error');
534 534
 	}
535 535
 
536 536
 
537 537
 	public function testSetServicePayment()
538 538
 	{
539
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
540
-		$service = $manager->findItem( 'unitpaymentcode', [], 'service', 'payment' );
539
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
540
+		$service = $manager->findItem('unitpaymentcode', [], 'service', 'payment');
541 541
 
542
-		$this->object->setService( 'payment', $service->getId(), [] );
543
-		$this->assertEquals( 'unitpaymentcode', $this->object->get()->getService( 'payment' )->getCode() );
542
+		$this->object->setService('payment', $service->getId(), []);
543
+		$this->assertEquals('unitpaymentcode', $this->object->get()->getService('payment')->getCode());
544 544
 
545
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
546
-		$this->object->setService( 'payment', $service->getId(), array( 'prepay' => true ) );
545
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
546
+		$this->object->setService('payment', $service->getId(), array('prepay' => true));
547 547
 	}
548 548
 
549 549
 
550 550
 	public function testSetDeliveryOption()
551 551
 	{
552
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
553
-		$service = $manager->findItem( 'unitcode', [], 'service', 'delivery' );
552
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
553
+		$service = $manager->findItem('unitcode', [], 'service', 'delivery');
554 554
 
555
-		$this->object->setService( 'delivery', $service->getId(), [] );
556
-		$this->assertEquals( 'unitcode', $this->object->get()->getService( 'delivery' )->getCode() );
555
+		$this->object->setService('delivery', $service->getId(), []);
556
+		$this->assertEquals('unitcode', $this->object->get()->getService('delivery')->getCode());
557 557
 
558
-		$this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' );
559
-		$this->object->setService( 'delivery', $service->getId(), array( 'fast shipping' => true, 'air shipping' => false ) );
558
+		$this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Basket\\Exception');
559
+		$this->object->setService('delivery', $service->getId(), array('fast shipping' => true, 'air shipping' => false));
560 560
 	}
561 561
 
562 562
 
563 563
 	public function testCheckLocale()
564 564
 	{
565
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'service' );
566
-		$payment = $manager->findItem( 'unitpaymentcode', [], 'service', 'payment' );
567
-		$delivery = $manager->findItem( 'unitcode', [], 'service', 'delivery' );
565
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'service');
566
+		$payment = $manager->findItem('unitpaymentcode', [], 'service', 'payment');
567
+		$delivery = $manager->findItem('unitcode', [], 'service', 'delivery');
568 568
 
569
-		$this->object->addProduct( self::$testItem->getId(), 2 );
570
-		$this->object->addCoupon( 'OPQR' );
569
+		$this->object->addProduct(self::$testItem->getId(), 2);
570
+		$this->object->addCoupon('OPQR');
571 571
 
572
-		$this->object->setService( 'payment', $payment->getId() );
573
-		$this->object->setService( 'delivery', $delivery->getId() );
572
+		$this->object->setService('payment', $payment->getId());
573
+		$this->object->setService('delivery', $delivery->getId());
574 574
 
575 575
 		$basket = $this->object->get();
576 576
 		$price = $basket->getPrice();
577 577
 
578
-		foreach( $basket->getProducts() as $product )
578
+		foreach ($basket->getProducts() as $product)
579 579
 		{
580
-			$this->assertEquals( 2, $product->getQuantity() );
581
-			$product->getPrice()->setCurrencyId( 'CHF' );
580
+			$this->assertEquals(2, $product->getQuantity());
581
+			$product->getPrice()->setCurrencyId('CHF');
582 582
 		}
583 583
 
584
-		$basket->getService( 'delivery' )->getPrice()->setCurrencyId( 'CHF' );
585
-		$basket->getService( 'payment' )->getPrice()->setCurrencyId( 'CHF' );
586
-		$basket->getLocale()->setCurrencyId( 'CHF' );
587
-		$price->setCurrencyId( 'CHF' );
584
+		$basket->getService('delivery')->getPrice()->setCurrencyId('CHF');
585
+		$basket->getService('payment')->getPrice()->setCurrencyId('CHF');
586
+		$basket->getLocale()->setCurrencyId('CHF');
587
+		$price->setCurrencyId('CHF');
588 588
 
589
-		$this->context->getLocale()->setCurrencyId( 'CHF' );
590
-		$this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $this->getAddress( 'Example company' ) );
589
+		$this->context->getLocale()->setCurrencyId('CHF');
590
+		$this->object->setAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $this->getAddress('Example company'));
591 591
 
592
-		$this->context->getSession()->set( 'aimeos/basket/currency', 'CHF' );
593
-		$this->context->getLocale()->setCurrencyId( 'EUR' );
592
+		$this->context->getSession()->set('aimeos/basket/currency', 'CHF');
593
+		$this->context->getLocale()->setCurrencyId('EUR');
594 594
 
595
-		$this->context->getSession()->set( 'aimeos/basket/content-unittest-en-EUR-', null );
595
+		$this->context->getSession()->set('aimeos/basket/content-unittest-en-EUR-', null);
596 596
 
597
-		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
597
+		$object = new \Aimeos\Controller\Frontend\Basket\Standard($this->context);
598 598
 		$basket = $object->get();
599 599
 
600
-		foreach( $basket->getProducts() as $product )
600
+		foreach ($basket->getProducts() as $product)
601 601
 		{
602
-			$this->assertEquals( 'EUR', $product->getPrice()->getCurrencyId() );
603
-			$this->assertEquals( 2, $product->getQuantity() );
602
+			$this->assertEquals('EUR', $product->getPrice()->getCurrencyId());
603
+			$this->assertEquals(2, $product->getQuantity());
604 604
 		}
605 605
 
606
-		$this->assertEquals( 'EUR', $basket->getService( 'payment' )->getPrice()->getCurrencyId() );
607
-		$this->assertEquals( 'EUR', $basket->getService( 'delivery' )->getPrice()->getCurrencyId() );
608
-		$this->assertEquals( 'EUR', $basket->getLocale()->getCurrencyId() );
609
-		$this->assertEquals( 'EUR', $basket->getPrice()->getCurrencyId() );
606
+		$this->assertEquals('EUR', $basket->getService('payment')->getPrice()->getCurrencyId());
607
+		$this->assertEquals('EUR', $basket->getService('delivery')->getPrice()->getCurrencyId());
608
+		$this->assertEquals('EUR', $basket->getLocale()->getCurrencyId());
609
+		$this->assertEquals('EUR', $basket->getPrice()->getCurrencyId());
610 610
 	}
611 611
 
612 612
 
613 613
 	/**
614 614
 	 * @param string $company
615 615
 	 */
616
-	protected function getAddress( $company )
616
+	protected function getAddress($company)
617 617
 	{
618
-		$customer = \Aimeos\MShop\Customer\Manager\Factory::createManager( \TestHelperFrontend::getContext(), 'Standard' );
619
-		$addressManager = $customer->getSubManager( 'address', 'Standard' );
618
+		$customer = \Aimeos\MShop\Customer\Manager\Factory::createManager(\TestHelperFrontend::getContext(), 'Standard');
619
+		$addressManager = $customer->getSubManager('address', 'Standard');
620 620
 
621 621
 		$search = $addressManager->createSearch();
622
-		$search->setConditions( $search->compare( '==', 'customer.address.company', $company ) );
623
-		$items = $addressManager->searchItems( $search );
622
+		$search->setConditions($search->compare('==', 'customer.address.company', $company));
623
+		$items = $addressManager->searchItems($search);
624 624
 
625
-		if( ( $item = reset( $items ) ) === false ) {
626
-			throw new \RuntimeException( sprintf( 'No address item with company "%1$s" found', $company ) );
625
+		if (($item = reset($items)) === false) {
626
+			throw new \RuntimeException(sprintf('No address item with company "%1$s" found', $company));
627 627
 		}
628 628
 
629 629
 		return $item;
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Customer/StandardTest.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -18,114 +18,114 @@  discard block
 block discarded – undo
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
-		$item = $this->object->saveItem( $item );
46
-		$this->assertEquals( 0, $item->getStatus() );
44
+		$item->setStatus(0);
45
+		$item = $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, ['customer/address', 'text'] );
67
+		$result = $this->object->getItem($id, ['customer/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
 
124 124
 
125 125
 	public function testAddEditDeleteListItem()
126 126
 	{
127
-		$customer = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' )->findItem( 'UTC001' );
128
-		$this->context->setUserId( $customer->getId() );
127
+		$customer = \Aimeos\MShop\Factory::createManager($this->context, 'customer')->findItem('UTC001');
128
+		$this->context->setUserId($customer->getId());
129 129
 
130 130
 		$values = [
131 131
 			'customer.lists.type' => 'favorite',
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 			'customer.lists.refid' => '-1'
134 134
 		];
135 135
 
136
-		$item = $this->object->addListItem( $values );
137
-		$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item );
136
+		$item = $this->object->addListItem($values);
137
+		$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item);
138 138
 
139 139
 		$values = [
140 140
 			'customer.lists.type' => 'favorite',
@@ -142,46 +142,46 @@  discard block
 block discarded – undo
142 142
 			'customer.lists.refid' => '-2'
143 143
 		];
144 144
 
145
-		$item = $this->object->editListItem( $item->getId(), $values );
146
-		$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item );
145
+		$item = $this->object->editListItem($item->getId(), $values);
146
+		$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item);
147 147
 
148
-		$this->object->deleteListItem( $item->getId() );
148
+		$this->object->deleteListItem($item->getId());
149 149
 
150
-		$this->setExpectedException( '\Aimeos\MShop\Exception' );
151
-		$this->object->getListItem( $item->getId() );
150
+		$this->setExpectedException('\Aimeos\MShop\Exception');
151
+		$this->object->getListItem($item->getId());
152 152
 	}
153 153
 
154 154
 
155 155
 	public function testGetListItem()
156 156
 	{
157
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer/lists' );
157
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer/lists');
158 158
 		$search = $manager->createSearch();
159
-		$search->setSlice( 0, 1 );
160
-		$result = $manager->searchItems( $search );
159
+		$search->setSlice(0, 1);
160
+		$result = $manager->searchItems($search);
161 161
 
162
-		if( ( $item = reset( $result ) ) === false ) {
163
-			throw new \RuntimeException( 'No customer lists item available' );
162
+		if (($item = reset($result)) === false) {
163
+			throw new \RuntimeException('No customer lists item available');
164 164
 		}
165 165
 
166
-		$this->context->setUserId( $item->getParentId() );
167
-		$result = $this->object->getListItem( $item->getId() );
168
-		$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $result );
166
+		$this->context->setUserId($item->getParentId());
167
+		$result = $this->object->getListItem($item->getId());
168
+		$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $result);
169 169
 	}
170 170
 
171 171
 
172 172
 	public function testSearchListItem()
173 173
 	{
174
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' );
175
-		$customer = $manager->findItem( 'UTC001' );
176
-		$this->context->setUserId( $customer->getId() );
174
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer');
175
+		$customer = $manager->findItem('UTC001');
176
+		$this->context->setUserId($customer->getId());
177 177
 
178 178
 		$filter = $this->object->createListsFilter();
179
-		$result = $this->object->searchListItems( $filter );
179
+		$result = $this->object->searchListItems($filter);
180 180
 
181
-		foreach( $result as $item )
181
+		foreach ($result as $item)
182 182
 		{
183
-			$this->assertEquals( $customer->getId(), $item->getParentId() );
184
-			$this->assertInstanceOf( '\Aimeos\MShop\Common\Item\Lists\Iface', $item );
183
+			$this->assertEquals($customer->getId(), $item->getParentId());
184
+			$this->assertInstanceOf('\Aimeos\MShop\Common\Item\Lists\Iface', $item);
185 185
 		}
186 186
 	}
187 187
 }
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Order/StandardTest.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -18,184 +18,184 @@
 block discarded – undo
18 18
 
19 19
 	protected function setUp()
20 20
 	{
21
-		\Aimeos\MShop\Factory::setCache( true );
21
+		\Aimeos\MShop\Factory::setCache(true);
22 22
 
23 23
 		$this->context = \TestHelperFrontend::getContext();
24
-		$this->object = new \Aimeos\Controller\Frontend\Order\Standard( $this->context );
24
+		$this->object = new \Aimeos\Controller\Frontend\Order\Standard($this->context);
25 25
 	}
26 26
 
27 27
 
28 28
 	protected function tearDown()
29 29
 	{
30
-		unset( $this->object, $this->context );
30
+		unset($this->object, $this->context);
31 31
 
32
-		\Aimeos\MShop\Factory::setCache( false );
32
+		\Aimeos\MShop\Factory::setCache(false);
33 33
 		\Aimeos\MShop\Factory::clear();
34 34
 	}
35 35
 
36 36
 
37 37
 	public function testAddItem()
38 38
 	{
39
-		$manager = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
40
-			->setConstructorArgs( [$this->context] )
41
-			->setMethods( ['saveItem'] )
39
+		$manager = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
40
+			->setConstructorArgs([$this->context])
41
+			->setMethods(['saveItem'])
42 42
 			->getMock();
43 43
 
44
-		\Aimeos\MShop\Factory::injectManager( $this->context, 'order', $manager );
44
+		\Aimeos\MShop\Factory::injectManager($this->context, 'order', $manager);
45 45
 
46
-		$manager->expects( $this->once() )->method( 'saveItem' )
47
-			->will( $this->returnValue( $manager->createItem() ) );
46
+		$manager->expects($this->once())->method('saveItem')
47
+			->will($this->returnValue($manager->createItem()));
48 48
 
49
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, 'test' ) );
49
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->addItem( -1, 'test' ));
50 50
 	}
51 51
 
52 52
 
53 53
 	public function testAddItemLimit()
54 54
 	{
55
-		$this->context->getConfig()->set( 'controller/frontend/order/limit-seconds', 86400 * 365 );
55
+		$this->context->getConfig()->set('controller/frontend/order/limit-seconds', 86400 * 365);
56 56
 
57
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order/base' );
58
-		$result = $manager->searchItems( $manager->createSearch()->setSlice( 0, 1 ) );
57
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'order/base');
58
+		$result = $manager->searchItems($manager->createSearch()->setSlice(0, 1));
59 59
 
60
-		if( ( $item = reset( $result ) ) === false ) {
61
-			throw new \RuntimeException( 'No order item found' );
60
+		if (($item = reset($result)) === false) {
61
+			throw new \RuntimeException('No order item found');
62 62
 		}
63 63
 
64
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Order\Exception' );
65
-		$this->object->addItem( $item->getId(), 'test' );
64
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Order\Exception');
65
+		$this->object->addItem($item->getId(), 'test');
66 66
 	}
67 67
 
68 68
 
69 69
 	public function testCreateFilter()
70 70
 	{
71
-		$this->assertInstanceOf( '\Aimeos\MW\Criteria\Iface', $this->object->createFilter() );
71
+		$this->assertInstanceOf('\Aimeos\MW\Criteria\Iface', $this->object->createFilter());
72 72
 	}
73 73
 
74 74
 
75 75
 	public function testGetItem()
76 76
 	{
77
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'customer' );
78
-		$customerItem = $manager->findItem( 'UTC001' );
77
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'customer');
78
+		$customerItem = $manager->findItem('UTC001');
79 79
 
80
-		$this->context->setEditor( 'core:unittest' );
80
+		$this->context->setEditor('core:unittest');
81 81
 
82
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'order' );
83
-		$search = $manager->createSearch()->setSlice( 0, 1 );
84
-		$search->setConditions( $search->compare( '==', 'order.base.customerid', $customerItem->getId() ) );
85
-		$result = $manager->searchItems( $search );
82
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'order');
83
+		$search = $manager->createSearch()->setSlice(0, 1);
84
+		$search->setConditions($search->compare('==', 'order.base.customerid', $customerItem->getId()));
85
+		$result = $manager->searchItems($search);
86 86
 
87
-		if( ( $item = reset( $result ) ) === false ) {
88
-			throw new \RuntimeException( 'No order item found' );
87
+		if (($item = reset($result)) === false) {
88
+			throw new \RuntimeException('No order item found');
89 89
 		}
90 90
 
91
-		$this->assertInstanceOf( '\Aimeos\MShop\Order\Item\Iface', $this->object->getItem( $item->getId() ) );
91
+		$this->assertInstanceOf('\Aimeos\MShop\Order\Item\Iface', $this->object->getItem($item->getId()));
92 92
 	}
93 93
 
94 94
 
95 95
 	public function testGetItemException()
96 96
 	{
97
-		$this->setExpectedException( '\Aimeos\Controller\Frontend\Order\Exception' );
97
+		$this->setExpectedException('\Aimeos\Controller\Frontend\Order\Exception');
98 98
 		$this->object->getItem( -1 );
99 99
 	}
100 100
 
101 101
 
102 102
 	public function testSearchItems()
103 103
 	{
104
-		$this->assertGreaterThan( 1, $this->object->searchItems( $this->object->createFilter() ) );
104
+		$this->assertGreaterThan(1, $this->object->searchItems($this->object->createFilter()));
105 105
 	}
106 106
 
107 107
 
108 108
 	public function testStore()
109 109
 	{
110 110
 		$name = 'ControllerFrontendOrderStore';
111
-		$this->context->getConfig()->set( 'mshop/order/manager/name', $name );
111
+		$this->context->getConfig()->set('mshop/order/manager/name', $name);
112 112
 
113 113
 
114
-		$orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' )
115
-			->setMethods( array( 'saveItem', 'getSubManager' ) )
116
-			->setConstructorArgs( array( $this->context ) )
114
+		$orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard')
115
+			->setMethods(array('saveItem', 'getSubManager'))
116
+			->setConstructorArgs(array($this->context))
117 117
 			->getMock();
118 118
 
119
-		$orderBaseManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard' )
120
-			->setMethods( array( 'store' ) )
121
-			->setConstructorArgs( array( $this->context ) )
119
+		$orderBaseManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard')
120
+			->setMethods(array('store'))
121
+			->setConstructorArgs(array($this->context))
122 122
 			->getMock();
123 123
 
124
-		\Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub );
124
+		\Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub);
125 125
 
126 126
 
127 127
 		$orderBaseItem = $orderBaseManagerStub->createItem();
128
-		$orderBaseItem->setId( 1 );
128
+		$orderBaseItem->setId(1);
129 129
 
130 130
 
131
-		$orderBaseManagerStub->expects( $this->once() )->method( 'store' );
131
+		$orderBaseManagerStub->expects($this->once())->method('store');
132 132
 
133
-		$orderManagerStub->expects( $this->once() )->method( 'getSubManager' )
134
-			->will( $this->returnValue( $orderBaseManagerStub ) );
133
+		$orderManagerStub->expects($this->once())->method('getSubManager')
134
+			->will($this->returnValue($orderBaseManagerStub));
135 135
 
136
-		$orderManagerStub->expects( $this->once() )->method( 'saveItem' );
136
+		$orderManagerStub->expects($this->once())->method('saveItem');
137 137
 
138 138
 
139
-		$this->object->store( $orderBaseItem );
139
+		$this->object->store($orderBaseItem);
140 140
 	}
141 141
 
142 142
 
143 143
 	public function testBlock()
144 144
 	{
145 145
 		$name = 'ControllerFrontendOrderBlock';
146
-		$this->context->getConfig()->set( 'controller/common/order/name', $name );
146
+		$this->context->getConfig()->set('controller/common/order/name', $name);
147 147
 
148 148
 
149
-		$orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' )
150
-			->setMethods( array( 'block' ) )
151
-			->setConstructorArgs( array( $this->context ) )
149
+		$orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard')
150
+			->setMethods(array('block'))
151
+			->setConstructorArgs(array($this->context))
152 152
 			->getMock();
153 153
 
154
-		\Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub );
154
+		\Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub);
155 155
 
156
-		$orderCntlStub->expects( $this->once() )->method( 'block' );
156
+		$orderCntlStub->expects($this->once())->method('block');
157 157
 
158 158
 
159
-		$this->object->block( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() );
159
+		$this->object->block(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem());
160 160
 	}
161 161
 
162 162
 
163 163
 	public function testUnblock()
164 164
 	{
165 165
 		$name = 'ControllerFrontendOrderUnblock';
166
-		$this->context->getConfig()->set( 'controller/common/order/name', $name );
166
+		$this->context->getConfig()->set('controller/common/order/name', $name);
167 167
 
168 168
 
169
-		$orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' )
170
-			->setMethods( array( 'unblock' ) )
171
-			->setConstructorArgs( array( $this->context ) )
169
+		$orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard')
170
+			->setMethods(array('unblock'))
171
+			->setConstructorArgs(array($this->context))
172 172
 			->getMock();
173 173
 
174
-		\Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub );
174
+		\Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub);
175 175
 
176
-		$orderCntlStub->expects( $this->once() )->method( 'unblock' );
176
+		$orderCntlStub->expects($this->once())->method('unblock');
177 177
 
178 178
 
179
-		$this->object->unblock( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() );
179
+		$this->object->unblock(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem());
180 180
 	}
181 181
 
182 182
 
183 183
 	public function testUpdate()
184 184
 	{
185 185
 		$name = 'ControllerFrontendOrderUpdate';
186
-		$this->context->getConfig()->set( 'controller/common/order/name', $name );
186
+		$this->context->getConfig()->set('controller/common/order/name', $name);
187 187
 
188 188
 
189
-		$orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' )
190
-			->setMethods( array( 'update' ) )
191
-			->setConstructorArgs( array( $this->context ) )
189
+		$orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard')
190
+			->setMethods(array('update'))
191
+			->setConstructorArgs(array($this->context))
192 192
 			->getMock();
193 193
 
194
-		\Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub );
194
+		\Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub);
195 195
 
196
-		$orderCntlStub->expects( $this->once() )->method( 'update' );
196
+		$orderCntlStub->expects($this->once())->method('update');
197 197
 
198 198
 
199
-		$this->object->update( \Aimeos\MShop\Factory::createManager( $this->context, 'order' )->createItem() );
199
+		$this->object->update(\Aimeos\MShop\Factory::createManager($this->context, 'order')->createItem());
200 200
 	}
201 201
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Customer/Standard.php 1 patch
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
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
-		$item->setId( null );
36
+		$item->fromArray($values);
37
+		$item->setId(null);
38 38
 
39
-		return $manager->saveItem( $item );
39
+		return $manager->saveItem($item);
40 40
 	}
41 41
 
42 42
 
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
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->setId( null );
55
-		$item->setStatus( 1 );
53
+		$item->fromArray($values);
54
+		$item->setId(null);
55
+		$item->setStatus(1);
56 56
 
57 57
 		return $item;
58 58
 	}
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 	 * @param string $id Unique customer ID
65 65
 	 * @since 2017.04
66 66
 	 */
67
-	public function deleteItem( $id )
67
+	public function deleteItem($id)
68 68
 	{
69
-		$this->checkUser( $id );
69
+		$this->checkUser($id);
70 70
 
71
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' );
72
-		$manager->deleteItem( $id );
71
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer');
72
+		$manager->deleteItem($id);
73 73
 	}
74 74
 
75 75
 
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item
82 82
 	 * @since 2017.04
83 83
 	 */
84
-	public function editItem( $id, array $values )
84
+	public function editItem($id, array $values)
85 85
 	{
86
-		$this->checkUser( $id );
86
+		$this->checkUser($id);
87 87
 
88
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' );
89
-		$item = $manager->getItem( $id, [], true );
88
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer');
89
+		$item = $manager->getItem($id, [], true);
90 90
 
91
-		unset( $values['customer.id'] );
92
-		$item->fromArray( $values );
91
+		unset($values['customer.id']);
92
+		$item->fromArray($values);
93 93
 
94
-		return $manager->saveItem( $item );
94
+		return $manager->saveItem($item);
95 95
 	}
96 96
 
97 97
 
@@ -103,17 +103,17 @@  discard block
 block discarded – undo
103 103
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items
104 104
 	 * @since 2017.04
105 105
 	 */
106
-	public function getItem( $id = null, array $domains = [] )
106
+	public function getItem($id = null, array $domains = [])
107 107
 	{
108
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' );
108
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer');
109 109
 
110
-		if( $id == null ) {
111
-			return $manager->getItem( $this->getContext()->getUserId(), $domains, true );
110
+		if ($id == null) {
111
+			return $manager->getItem($this->getContext()->getUserId(), $domains, true);
112 112
 		}
113 113
 
114
-		$this->checkUser( $id );
114
+		$this->checkUser($id);
115 115
 
116
-		return $manager->getItem( $id, $domains, true );
116
+		return $manager->getItem($id, $domains, true);
117 117
 	}
118 118
 
119 119
 
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer item including the referenced domains items
128 128
 	 * @since 2017.04
129 129
 	 */
130
-	public function findItem( $code, array $domains = [] )
130
+	public function findItem($code, array $domains = [])
131 131
 	{
132
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->findItem( $code, $domains );
132
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->findItem($code, $domains);
133 133
 	}
134 134
 
135 135
 
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 	 * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item
140 140
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID
141 141
 	 */
142
-	public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item )
142
+	public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item)
143 143
 	{
144
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer' )->saveItem( $item );
144
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer')->saveItem($item);
145 145
 	}
146 146
 
147 147
 
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
153 153
 	 * @since 2017.04
154 154
 	 */
155
-	public function addAddressItem( array $values )
155
+	public function addAddressItem(array $values)
156 156
 	{
157 157
 		$context = $this->getContext();
158
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' );
158
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address');
159 159
 
160 160
 		$item = $manager->createItem();
161
-		$item->fromArray( $values );
162
-		$item->setId( null );
163
-		$item->setParentId( $context->getUserId() );
161
+		$item->fromArray($values);
162
+		$item->setId(null);
163
+		$item->setParentId($context->getUserId());
164 164
 
165
-		return $manager->saveItem( $item );
165
+		return $manager->saveItem($item);
166 166
 	}
167 167
 
168 168
 
@@ -171,16 +171,16 @@  discard block
 block discarded – undo
171 171
 	 *
172 172
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
173 173
 	 */
174
-	public function createAddressItem( array $values = [] )
174
+	public function createAddressItem(array $values = [])
175 175
 	{
176 176
 		$context = $this->getContext();
177
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' );
177
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/address');
178 178
 
179 179
 		$item = $manager->createItem();
180
-		$item->fromArray( $values );
181
-		$item->setId( null );
180
+		$item->fromArray($values);
181
+		$item->setId(null);
182 182
 
183
-		$item->setParentId( $context->getUserId() );
183
+		$item->setParentId($context->getUserId());
184 184
 
185 185
 		return $item;
186 186
 	}
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
 	 * @param string $id Unique customer address ID
193 193
 	 * @since 2017.04
194 194
 	 */
195
-	public function deleteAddressItem( $id )
195
+	public function deleteAddressItem($id)
196 196
 	{
197
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' );
197
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address');
198 198
 
199
-		$this->checkUser( $manager->getItem( $id, [], true )->getParentId() );
199
+		$this->checkUser($manager->getItem($id, [], true)->getParentId());
200 200
 
201
-		$manager->deleteItem( $id );
201
+		$manager->deleteItem($id);
202 202
 	}
203 203
 
204 204
 
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
211 211
 	 * @since 2017.04
212 212
 	 */
213
-	public function editAddressItem( $id, array $values )
213
+	public function editAddressItem($id, array $values)
214 214
 	{
215
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' );
215
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address');
216 216
 
217
-		$item = $manager->getItem( $id, [], true );
218
-		$this->checkUser( $item->getParentId() );
217
+		$item = $manager->getItem($id, [], true);
218
+		$this->checkUser($item->getParentId());
219 219
 
220
-		unset( $values['customer.address.id'] );
221
-		$item->fromArray( $values );
220
+		unset($values['customer.address.id']);
221
+		$item->fromArray($values);
222 222
 
223
-		return $manager->saveItem( $item );
223
+		return $manager->saveItem($item);
224 224
 	}
225 225
 
226 226
 
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
232 232
 	 * @since 2017.04
233 233
 	 */
234
-	public function getAddressItem( $id )
234
+	public function getAddressItem($id)
235 235
 	{
236
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' );
236
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address');
237 237
 
238
-		$item = $manager->getItem( $id );
239
-		$this->checkUser( $item->getParentId() );
238
+		$item = $manager->getItem($id);
239
+		$this->checkUser($item->getParentId());
240 240
 
241 241
 		return $item;
242 242
 	}
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
 	 * @param \Aimeos\MShop\Customer\Item\Address\Iface $item Customer address item
249 249
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID
250 250
 	 */
251
-	public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item )
251
+	public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item)
252 252
 	{
253
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' )->saveItem( $item );
253
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address')->saveItem($item);
254 254
 	}
255 255
 
256 256
 
@@ -261,32 +261,32 @@  discard block
 block discarded – undo
261 261
 	 * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item
262 262
 	 * @since 2017.06
263 263
 	 */
264
-	public function addListItem( array $values )
264
+	public function addListItem(array $values)
265 265
 	{
266 266
 		$context = $this->getContext();
267
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
267
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists');
268 268
 
269
-		if( !isset( $values['customer.lists.typeid'] ) )
269
+		if (!isset($values['customer.lists.typeid']))
270 270
 		{
271
-			if( !isset( $values['customer.lists.type'] ) ) {
272
-				throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) );
271
+			if (!isset($values['customer.lists.type'])) {
272
+				throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code'));
273 273
 			}
274 274
 
275
-			if( !isset( $values['customer.lists.domain'] ) ) {
276
-				throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) );
275
+			if (!isset($values['customer.lists.domain'])) {
276
+				throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain'));
277 277
 			}
278 278
 
279
-			$typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' );
280
-			$typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] );
279
+			$typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type');
280
+			$typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']);
281 281
 			$values['customer.lists.typeid'] = $typeItem->getId();
282 282
 		}
283 283
 
284 284
 		$item = $manager->createItem();
285
-		$item->fromArray( $values );
286
-		$item->setId( null );
287
-		$item->setParentId( $context->getUserId() );
285
+		$item->fromArray($values);
286
+		$item->setId(null);
287
+		$item->setParentId($context->getUserId());
288 288
 
289
-		return $manager->saveItem( $item );
289
+		return $manager->saveItem($item);
290 290
 	}
291 291
 
292 292
 
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
 	public function createListsFilter()
300 300
 	{
301 301
 		$context = $this->getContext();
302
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
302
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists');
303 303
 
304 304
 		$filter = $manager->createSearch();
305
-		$filter->setConditions( $filter->compare( '==', 'customer.lists.parentid', $context->getUserId() ) );
305
+		$filter->setConditions($filter->compare('==', 'customer.lists.parentid', $context->getUserId()));
306 306
 
307 307
 		return $filter;
308 308
 	}
@@ -314,13 +314,13 @@  discard block
 block discarded – undo
314 314
 	 * @param string $id Unique customer address ID
315 315
 	 * @since 2017.06
316 316
 	 */
317
-	public function deleteListItem( $id )
317
+	public function deleteListItem($id)
318 318
 	{
319
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' );
319
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists');
320 320
 
321
-		$this->checkUser( $manager->getItem( $id )->getParentId() );
321
+		$this->checkUser($manager->getItem($id)->getParentId());
322 322
 
323
-		$manager->deleteItem( $id );
323
+		$manager->deleteItem($id);
324 324
 	}
325 325
 
326 326
 
@@ -332,33 +332,33 @@  discard block
 block discarded – undo
332 332
 	 * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item
333 333
 	 * @since 2017.06
334 334
 	 */
335
-	public function editListItem( $id, array $values )
335
+	public function editListItem($id, array $values)
336 336
 	{
337 337
 		$context = $this->getContext();
338
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists' );
338
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists');
339 339
 
340
-		$item = $manager->getItem( $id, [], true );
341
-		$this->checkUser( $item->getParentId() );
340
+		$item = $manager->getItem($id, [], true);
341
+		$this->checkUser($item->getParentId());
342 342
 
343
-		if( !isset( $values['customer.lists.typeid'] ) )
343
+		if (!isset($values['customer.lists.typeid']))
344 344
 		{
345
-			if( !isset( $values['customer.lists.type'] ) ) {
346
-				throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists type code' ) );
345
+			if (!isset($values['customer.lists.type'])) {
346
+				throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists type code'));
347 347
 			}
348 348
 
349
-			if( !isset( $values['customer.lists.domain'] ) ) {
350
-				throw new \Aimeos\Controller\Frontend\Customer\Exception( sprintf( 'No customer lists domain' ) );
349
+			if (!isset($values['customer.lists.domain'])) {
350
+				throw new \Aimeos\Controller\Frontend\Customer\Exception(sprintf('No customer lists domain'));
351 351
 			}
352 352
 
353
-			$typeManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/lists/type' );
354
-			$typeItem = $typeManager->findItem( $values['customer.lists.type'], [], $values['customer.lists.domain'] );
353
+			$typeManager = \Aimeos\MShop\Factory::createManager($context, 'customer/lists/type');
354
+			$typeItem = $typeManager->findItem($values['customer.lists.type'], [], $values['customer.lists.domain']);
355 355
 			$values['customer.lists.typeid'] = $typeItem->getId();
356 356
 		}
357 357
 
358
-		unset( $values['customer.lists.id'] );
359
-		$item->fromArray( $values );
358
+		unset($values['customer.lists.id']);
359
+		$item->fromArray($values);
360 360
 
361
-		return $manager->saveItem( $item );
361
+		return $manager->saveItem($item);
362 362
 	}
363 363
 
364 364
 
@@ -369,12 +369,12 @@  discard block
 block discarded – undo
369 369
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
370 370
 	 * @since 2017.06
371 371
 	 */
372
-	public function getListItem( $id )
372
+	public function getListItem($id)
373 373
 	{
374
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' );
375
-		$item = $manager->getItem( $id );
374
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists');
375
+		$item = $manager->getItem($id);
376 376
 
377
-		$this->checkUser( $item->getParentId() );
377
+		$this->checkUser($item->getParentId());
378 378
 
379 379
 		return $item;
380 380
 	}
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
 	 * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items
389 389
 	 * @since 2017.06
390 390
 	 */
391
-	public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null )
391
+	public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null)
392 392
 	{
393
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/lists' );
393
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/lists');
394 394
 
395
-		return $manager->searchItems( $filter, [], $total );
395
+		return $manager->searchItems($filter, [], $total);
396 396
 	}
397 397
 
398 398
 
@@ -402,12 +402,12 @@  discard block
 block discarded – undo
402 402
 	 * @param string $id Unique customer ID
403 403
 	 * @throws \Aimeos\Controller\Frontend\Customer\Exception If access isn't allowed
404 404
 	 */
405
-	protected function checkUser( $id )
405
+	protected function checkUser($id)
406 406
 	{
407
-		if( $id != $this->getContext()->getUserId() )
407
+		if ($id != $this->getContext()->getUserId())
408 408
 		{
409
-			$msg = sprintf( 'Not allowed to access customer data for ID "%1$s"', $id );
410
-			throw new \Aimeos\Controller\Frontend\Customer\Exception( $msg );
409
+			$msg = sprintf('Not allowed to access customer data for ID "%1$s"', $id);
410
+			throw new \Aimeos\Controller\Frontend\Customer\Exception($msg);
411 411
 		}
412 412
 	}
413 413
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Customer/Iface.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	/**
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID
90 90
 	 * @since 2017.04
91 91
 	 */
92
-	public function saveItem( \Aimeos\MShop\Customer\Item\Iface $item );
92
+	public function saveItem(\Aimeos\MShop\Customer\Item\Iface $item);
93 93
 
94 94
 
95 95
 	/**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer address item
100 100
 	 * @since 2017.04
101 101
 	 */
102
-	public function addAddressItem( array $values );
102
+	public function addAddressItem(array $values);
103 103
 
104 104
 
105 105
 	/**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
109 109
 	 * @since 2017.04
110 110
 	 */
111
-	public function createAddressItem( array $values = [] );
111
+	public function createAddressItem(array $values = []);
112 112
 
113 113
 
114 114
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @param string $id Unique customer address ID
118 118
 	 * @since 2017.04
119 119
 	 */
120
-	public function deleteAddressItem( $id );
120
+	public function deleteAddressItem($id);
121 121
 
122 122
 
123 123
 	/**
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @return \Aimeos\MShop\Customer\Item\Iface Customer address item
129 129
 	 * @since 2017.04
130 130
 	 */
131
-	public function editAddressItem( $id, array $values );
131
+	public function editAddressItem($id, array $values);
132 132
 
133 133
 
134 134
 	/**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
139 139
 	 * @since 2017.04
140 140
 	 */
141
-	public function getAddressItem( $id );
141
+	public function getAddressItem($id);
142 142
 
143 143
 
144 144
 	/**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item including the generated ID
149 149
 	 * @since 2017.04
150 150
 	 */
151
-	public function saveAddressItem( \Aimeos\MShop\Customer\Item\Address\Iface $item );
151
+	public function saveAddressItem(\Aimeos\MShop\Customer\Item\Address\Iface $item);
152 152
 
153 153
 	/**
154 154
 	 * Creates and returns a new list item object
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item
158 158
 	 * @since 2017.06
159 159
 	 */
160
-	public function addListItem( array $values );
160
+	public function addListItem(array $values);
161 161
 
162 162
 	/**
163 163
 	 * Returns a new customer lists filter criteria object
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 * @param string $id Unique customer address ID
174 174
 	 * @since 2017.06
175 175
 	 */
176
-	public function deleteListItem( $id );
176
+	public function deleteListItem($id);
177 177
 
178 178
 	/**
179 179
 	 * Saves a modified customer lists item object
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return \Aimeos\MShop\Common\Item\Lists\Iface Customer lists item
184 184
 	 * @since 2017.06
185 185
 	 */
186
-	public function editListItem( $id, array $values );
186
+	public function editListItem($id, array $values);
187 187
 
188 188
 	/**
189 189
 	 * Returns the customer item for the given customer ID
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @return \Aimeos\MShop\Customer\Item\Address\Iface Customer address item
193 193
 	 * @since 2017.06
194 194
 	 */
195
-	public function getListItem( $id );
195
+	public function getListItem($id);
196 196
 
197 197
 	/**
198 198
 	 * Returns the customer lists items filtered by the given criteria
@@ -202,5 +202,5 @@  discard block
 block discarded – undo
202 202
 	 * @return \Aimeos\MShop\Common\Item\Lists\Iface[] Customer list items
203 203
 	 * @since 2017.06
204 204
 	 */
205
-	public function searchListItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null );
205
+	public function searchListItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null);
206 206
 }
Please login to merge, or discard this patch.
controller/frontend/src/Controller/Frontend/Order/Standard.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 	 * @param string $type Arbitrary order type (max. eight chars)
30 30
 	 * @return \Aimeos\MShop\Order\Item\Iface Created order object
31 31
 	 */
32
-	public function addItem( $baseId, $type )
32
+	public function addItem($baseId, $type)
33 33
 	{
34 34
 		$total = 0;
35 35
 		$context = $this->getContext();
36
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
36
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
37 37
 
38 38
 		/** controller/frontend/order/limit-seconds
39 39
 		 * Order limitation time frame in seconds
@@ -51,24 +51,24 @@  discard block
 block discarded – undo
51 51
 		 * @see controller/frontend/basket/limit-count
52 52
 		 * @see controller/frontend/basket/limit-seconds
53 53
 		 */
54
-		$seconds = $context->getConfig()->get( 'controller/frontend/order/limit-seconds', 300 );
54
+		$seconds = $context->getConfig()->get('controller/frontend/order/limit-seconds', 300);
55 55
 
56 56
 		$search = $manager->createSearch();
57 57
 		$expr = [
58
-			$search->compare( '==', 'order.baseid', $baseId ),
59
-			$search->compare( '>=', 'order.ctime', date( 'Y-m-d H:i:s', time() - $seconds ) ),
58
+			$search->compare('==', 'order.baseid', $baseId),
59
+			$search->compare('>=', 'order.ctime', date('Y-m-d H:i:s', time() - $seconds)),
60 60
 		];
61
-		$search->setConditions( $search->combine( '&&', $expr ) );
62
-		$search->setSlice( 0, 0 );
61
+		$search->setConditions($search->combine('&&', $expr));
62
+		$search->setSlice(0, 0);
63 63
 
64
-		$manager->searchItems( $search, [], $total );
64
+		$manager->searchItems($search, [], $total);
65 65
 
66
-		if( $total > 0 ) {
67
-			throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'The order has already been created' ) );
66
+		if ($total > 0) {
67
+			throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('The order has already been created'));
68 68
 		}
69 69
 
70
-		$item = $manager->createItem()->setBaseId( $baseId )->setType( $type );
71
-		return $manager->saveItem( $item );
70
+		$item = $manager->createItem()->setBaseId($baseId)->setType($type);
71
+		return $manager->saveItem($item);
72 72
 	}
73 73
 
74 74
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function createFilter()
81 81
 	{
82
-		return \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order' )->createSearch( true );
82
+		return \Aimeos\MShop\Factory::createManager($this->getContext(), 'order')->createSearch(true);
83 83
 	}
84 84
 
85 85
 
@@ -90,30 +90,30 @@  discard block
 block discarded – undo
90 90
 	 * @param boolean $default Use default criteria to limit orders
91 91
 	 * @return \Aimeos\MShop\Order\Item\Iface Order object
92 92
 	 */
93
-	public function getItem( $id, $default = true )
93
+	public function getItem($id, $default = true)
94 94
 	{
95 95
 		$context = $this->getContext();
96
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
96
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
97 97
 
98
-		$search = $manager->createSearch( true );
98
+		$search = $manager->createSearch(true);
99 99
 		$expr = [
100
-			$search->compare( '==', 'order.id', $id ),
100
+			$search->compare('==', 'order.id', $id),
101 101
 			$search->getConditions(),
102 102
 		];
103 103
 
104
-		if( $default !== false ) {
105
-			$expr[] = $search->compare( '==', 'order.editor', $context->getEditor() );
104
+		if ($default !== false) {
105
+			$expr[] = $search->compare('==', 'order.editor', $context->getEditor());
106 106
 		}
107 107
 
108
-		$search->setConditions( $search->combine( '&&', $expr ) );
108
+		$search->setConditions($search->combine('&&', $expr));
109 109
 
110
-		$items = $manager->searchItems( $search );
110
+		$items = $manager->searchItems($search);
111 111
 
112
-		if( ( $item = reset( $items ) ) !== false ) {
112
+		if (($item = reset($items)) !== false) {
113 113
 			return $item;
114 114
 		}
115 115
 
116
-		throw new \Aimeos\Controller\Frontend\Order\Exception( sprintf( 'No order item for ID "%1$s" found', $id ) );
116
+		throw new \Aimeos\Controller\Frontend\Order\Exception(sprintf('No order item for ID "%1$s" found', $id));
117 117
 	}
118 118
 
119 119
 
@@ -124,18 +124,18 @@  discard block
 block discarded – undo
124 124
 	 * @param integer|null &$total Variable that will contain the total number of available items
125 125
 	 * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values
126 126
 	 */
127
-	public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null )
127
+	public function searchItems(\Aimeos\MW\Criteria\Iface $filter, &$total = null)
128 128
 	{
129 129
 		$context = $this->getContext();
130
-		$manager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
130
+		$manager = \Aimeos\MShop\Factory::createManager($context, 'order');
131 131
 
132 132
 		$expr = [
133 133
 			$filter->getConditions(),
134
-			$filter->compare( '==', 'order.base.customerid', $context->getUserId() ),
134
+			$filter->compare('==', 'order.base.customerid', $context->getUserId()),
135 135
 		];
136
-		$filter->setConditions( $filter->combine( '&&', $expr ) );
136
+		$filter->setConditions($filter->combine('&&', $expr));
137 137
 
138
-		return $manager->searchItems( $filter, [], $total );
138
+		return $manager->searchItems($filter, [], $total);
139 139
 	}
140 140
 
141 141
 
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
159 159
 	 */
160
-	public function block( \Aimeos\MShop\Order\Item\Iface $orderItem )
160
+	public function block(\Aimeos\MShop\Order\Item\Iface $orderItem)
161 161
 	{
162
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->block( $orderItem );
162
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->block($orderItem);
163 163
 	}
164 164
 
165 165
 
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
183 183
 	 */
184
-	public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem )
184
+	public function unblock(\Aimeos\MShop\Order\Item\Iface $orderItem)
185 185
 	{
186
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->unblock( $orderItem );
186
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->unblock($orderItem);
187 187
 	}
188 188
 
189 189
 
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object
203 203
 	 */
204
-	public function update( \Aimeos\MShop\Order\Item\Iface $orderItem )
204
+	public function update(\Aimeos\MShop\Order\Item\Iface $orderItem)
205 205
 	{
206
-		\Aimeos\Controller\Common\Order\Factory::createController( $this->getContext() )->update( $orderItem );
206
+		\Aimeos\Controller\Common\Order\Factory::createController($this->getContext())->update($orderItem);
207 207
 	}
208 208
 
209 209
 
@@ -218,22 +218,22 @@  discard block
 block discarded – undo
218 218
 	 * @return \Aimeos\MShop\Order\Item\Iface Order item that belongs to the stored basket
219 219
 	 * @deprecated 2017.04 Use store() from basket controller instead
220 220
 	 */
221
-	public function store( \Aimeos\MShop\Order\Item\Base\Iface $basket )
221
+	public function store(\Aimeos\MShop\Order\Item\Base\Iface $basket)
222 222
 	{
223 223
 		$context = $this->getContext();
224 224
 
225
-		$orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' );
226
-		$orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' );
225
+		$orderManager = \Aimeos\MShop\Factory::createManager($context, 'order');
226
+		$orderBaseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
227 227
 
228 228
 
229 229
 		$orderBaseManager->begin();
230
-		$orderBaseManager->store( $basket );
230
+		$orderBaseManager->store($basket);
231 231
 		$orderBaseManager->commit();
232 232
 
233 233
 		$orderItem = $orderManager->createItem();
234
-		$orderItem->setBaseId( $basket->getId() );
235
-		$orderItem->setType( \Aimeos\MShop\Order\Item\Base::TYPE_WEB );
234
+		$orderItem->setBaseId($basket->getId());
235
+		$orderItem->setType(\Aimeos\MShop\Order\Item\Base::TYPE_WEB);
236 236
 
237
-		return $orderManager->saveItem( $orderItem );
237
+		return $orderManager->saveItem($orderItem);
238 238
 	}
239 239
 }
Please login to merge, or discard this patch.