Completed
Push — master ( 76cfc1...e87582 )
by Aimeos
01:44
created
controller/frontend/src/Controller/Frontend/Product/Standard.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param \Aimeos\MShop\Context\Item\Iface $context Common MShop context object
34 34
 	 */
35
-	public function __construct( \Aimeos\MShop\Context\Item\Iface $context )
35
+	public function __construct(\Aimeos\MShop\Context\Item\Iface $context)
36 36
 	{
37
-		parent::__construct( $context );
37
+		parent::__construct($context);
38 38
 
39
-		$this->manager = \Aimeos\MShop::create( $context, 'index' );
40
-		$this->filter = $this->manager->createSearch( true );
41
-		$this->conditions[] = $this->filter->compare( '!=', 'index.catalog.id', null );
39
+		$this->manager = \Aimeos\MShop::create($context, 'index');
40
+		$this->filter = $this->manager->createSearch(true);
41
+		$this->conditions[] = $this->filter->compare('!=', 'index.catalog.id', null);
42 42
 
43 43
 		/** controller/frontend/order/ignore-dates
44 44
 		 * Ignore start and end dates of products
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 		 * @since 2017.08
53 53
 		 * @category Developer
54 54
 		 */
55
-		if( $context->getConfig()->get( 'controller/frontend/product/ignore-dates', false ) ) {
56
-			$this->conditions[] = $this->filter->compare( '>', 'product.status', 0 );
55
+		if ($context->getConfig()->get('controller/frontend/product/ignore-dates', false)) {
56
+			$this->conditions[] = $this->filter->compare('>', 'product.status', 0);
57 57
 		} else {
58 58
 			$this->conditions[] = $this->filter->getConditions();
59 59
 		}
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 	 * @return array Associative list of key values as key and the product count for this key as value
68 68
 	 * @since 2019.04
69 69
 	 */
70
-	public function aggregate( $key )
70
+	public function aggregate($key)
71 71
 	{
72
-		$this->filter->setConditions( $this->filter->combine( '&&', $this->conditions ) );
73
-		return $this->manager->aggregate( $this->filter, $key );
72
+		$this->filter->setConditions($this->filter->combine('&&', $this->conditions));
73
+		return $this->manager->aggregate($this->filter, $key);
74 74
 	}
75 75
 
76 76
 
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
 	 * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface
82 82
 	 * @since 2019.04
83 83
 	 */
84
-	public function allOf( $attrIds )
84
+	public function allOf($attrIds)
85 85
 	{
86
-		if( ( $ids = array_unique( $this->validateIds( (array) $attrIds ) ) ) !== [] )
86
+		if (($ids = array_unique($this->validateIds((array) $attrIds))) !== [])
87 87
 		{
88
-			$func = $this->filter->createFunction( 'index.attribute:all', [$ids] );
89
-			$this->conditions[] = $this->filter->compare( '!=', $func, null );
88
+			$func = $this->filter->createFunction('index.attribute:all', [$ids]);
89
+			$this->conditions[] = $this->filter->compare('!=', $func, null);
90 90
 		}
91 91
 
92 92
 		return $this;
@@ -102,31 +102,31 @@  discard block
 block discarded – undo
102 102
 	 * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface
103 103
 	 * @since 2019.04
104 104
 	 */
105
-	public function category( $catIds, $listtype = 'default', $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE )
105
+	public function category($catIds, $listtype = 'default', $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE)
106 106
 	{
107
-		if( ( $ids = $this->validateIds( (array) $catIds ) ) !== [] )
107
+		if (($ids = $this->validateIds((array) $catIds)) !== [])
108 108
 		{
109
-			if( $level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE )
109
+			if ($level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE)
110 110
 			{
111 111
 				$list = [];
112
-				$cntl = \Aimeos\Controller\Frontend::create( $this->getContext(), 'catalog' );
112
+				$cntl = \Aimeos\Controller\Frontend::create($this->getContext(), 'catalog');
113 113
 
114
-				foreach( $ids as $catId )
114
+				foreach ($ids as $catId)
115 115
 				{
116
-					$tree = $cntl->getTree( $catId, [], $level );
117
-					$list = array_merge( $list, $this->getCatalogIdsFromTree( $tree ) );
116
+					$tree = $cntl->getTree($catId, [], $level);
117
+					$list = array_merge($list, $this->getCatalogIdsFromTree($tree));
118 118
 				}
119 119
 
120
-				$ids = array_unique( $list );
120
+				$ids = array_unique($list);
121 121
 			}
122 122
 
123
-			$func = $this->filter->createFunction( 'index.catalog:position', [$listtype, $ids] );
123
+			$func = $this->filter->createFunction('index.catalog:position', [$listtype, $ids]);
124 124
 
125
-			$this->conditions[] = $this->filter->compare( '==', 'index.catalog.id', $ids );
126
-			$this->conditions[] = $this->filter->compare( '>=', $func, 0 );
125
+			$this->conditions[] = $this->filter->compare('==', 'index.catalog.id', $ids);
126
+			$this->conditions[] = $this->filter->compare('>=', $func, 0);
127 127
 
128
-			$func = $this->filter->createFunction( 'sort:index.catalog:position', [$listtype, $ids] );
129
-			$this->sort = $this->filter->sort( '+', $func );
128
+			$func = $this->filter->createFunction('sort:index.catalog:position', [$listtype, $ids]);
129
+			$this->sort = $this->filter->sort('+', $func);
130 130
 		}
131 131
 
132 132
 		return $this;
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	 * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface
143 143
 	 * @since 2019.04
144 144
 	 */
145
-	public function compare( $operator, $key, $value )
145
+	public function compare($operator, $key, $value)
146 146
 	{
147
-		$this->conditions[] = $this->filter->compare( $operator, $key, $value );
147
+		$this->conditions[] = $this->filter->compare($operator, $key, $value);
148 148
 		return $this;
149 149
 	}
150 150
 
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 	 * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items
158 158
 	 * @since 2019.04
159 159
 	 */
160
-	public function get( $id, $domains = ['media', 'price', 'text'] )
160
+	public function get($id, $domains = ['media', 'price', 'text'])
161 161
 	{
162
-		return $this->manager->getItem( $id, $domains );
162
+		return $this->manager->getItem($id, $domains);
163 163
 	}
164 164
 
165 165
 
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 	 * @return \Aimeos\MShop\Product\Item\Iface Product item including the referenced domains items
172 172
 	 * @since 2019.04
173 173
 	 */
174
-	public function find( $code, $domains = ['media', 'price', 'text'] )
174
+	public function find($code, $domains = ['media', 'price', 'text'])
175 175
 	{
176
-		return $this->manager->findItem( $code, $domains );
176
+		return $this->manager->findItem($code, $domains);
177 177
 	}
178 178
 
179 179
 
@@ -186,18 +186,18 @@  discard block
 block discarded – undo
186 186
 	 * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface
187 187
 	 * @since 2019.04
188 188
 	 */
189
-	public function oneOf( $attrIds )
189
+	public function oneOf($attrIds)
190 190
 	{
191
-		foreach( (array) $attrIds as $key => $entry )
191
+		foreach ((array) $attrIds as $key => $entry)
192 192
 		{
193
-			if( is_array( $entry ) && ( $ids = array_unique( $this->validateIds( $entry ) ) ) !== [] ) {
194
-				$this->conditions[] = $this->filter->compare( '==', 'index.attribute.id', $ids );
195
-				unset( $attrIds[$key] );
193
+			if (is_array($entry) && ($ids = array_unique($this->validateIds($entry))) !== []) {
194
+				$this->conditions[] = $this->filter->compare('==', 'index.attribute.id', $ids);
195
+				unset($attrIds[$key]);
196 196
 			}
197 197
 		}
198 198
 
199
-		if( ( $ids = array_unique( $this->validateIds( (array) $attrIds ) ) ) !== [] ) {
200
-			$this->conditions[] = $this->filter->compare( '==', 'index.attribute.id', $ids );
199
+		if (($ids = array_unique($this->validateIds((array) $attrIds))) !== []) {
200
+			$this->conditions[] = $this->filter->compare('==', 'index.attribute.id', $ids);
201 201
 		}
202 202
 
203 203
 		return $this;
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
 	 * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface
212 212
 	 * @since 2019.04
213 213
 	 */
214
-	public function parse( array $conditions )
214
+	public function parse(array $conditions)
215 215
 	{
216
-		$this->conditions[] = $this->filter->toConditions( $conditions );
216
+		$this->conditions[] = $this->filter->toConditions($conditions);
217 217
 		return $this;
218 218
 	}
219 219
 
@@ -225,10 +225,10 @@  discard block
 block discarded – undo
225 225
 	 * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface
226 226
 	 * @since 2019.04
227 227
 	 */
228
-	public function product( $prodIds )
228
+	public function product($prodIds)
229 229
 	{
230
-		if( ( $ids = array_unique( $this->validateIds( (array) $prodIds ) ) ) !== [] ) {
231
-			$this->conditions[] = $this->filter->compare( '==', 'product.id', $ids );
230
+		if (($ids = array_unique($this->validateIds((array) $prodIds))) !== []) {
231
+			$this->conditions[] = $this->filter->compare('==', 'product.id', $ids);
232 232
 		}
233 233
 
234 234
 		return $this;
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 	 * @return array Ordered list of product items implementing \Aimeos\MShop\Product\Item\Iface
244 244
 	 * @since 2019.04
245 245
 	 */
246
-	public function search( $domains = ['media', 'price', 'text'], &$total = null )
246
+	public function search($domains = ['media', 'price', 'text'], &$total = null)
247 247
 	{
248
-		$this->filter->setConditions( $this->filter->combine( '&&', $this->conditions ) );
249
-		return $this->manager->searchItems( $this->filter, $domains, $total );
248
+		$this->filter->setConditions($this->filter->combine('&&', $this->conditions));
249
+		return $this->manager->searchItems($this->filter, $domains, $total);
250 250
 	}
251 251
 
252 252
 
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
 	 * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface
259 259
 	 * @since 2019.04
260 260
 	 */
261
-	public function slice( $start, $limit )
261
+	public function slice($start, $limit)
262 262
 	{
263
-		$this->filter->setSlice( $start, $limit );
263
+		$this->filter->setSlice($start, $limit);
264 264
 		return $this;
265 265
 	}
266 266
 
@@ -272,44 +272,44 @@  discard block
 block discarded – undo
272 272
 	 * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface
273 273
 	 * @since 2019.04
274 274
 	 */
275
-	public function sort( $key = null )
275
+	public function sort($key = null)
276 276
 	{
277 277
 		$direction = '+';
278 278
 
279
-		if( $key != null && $key[0] === '-' )
279
+		if ($key != null && $key[0] === '-')
280 280
 		{
281
-			$key = substr( $key, 1 );
281
+			$key = substr($key, 1);
282 282
 			$direction = '-';
283 283
 		}
284 284
 
285
-		switch( $key )
285
+		switch ($key)
286 286
 		{
287 287
 			case 'code':
288
-				$this->sort = $this->filter->sort( $direction, 'product.code' );
288
+				$this->sort = $this->filter->sort($direction, 'product.code');
289 289
 				break;
290 290
 
291 291
 			case 'ctime':
292
-				$this->sort = $this->filter->sort( $direction, 'product.ctime' );
292
+				$this->sort = $this->filter->sort($direction, 'product.ctime');
293 293
 				break;
294 294
 
295 295
 			case 'name':
296 296
 				$langid = $this->getContext()->getLocale()->getLanguageId();
297 297
 
298
-				$cmpfunc = $this->filter->createFunction( 'index.text:name', [$langid] );
299
-				$this->conditions[] = $this->filter->compare( '!=', $cmpfunc, null );
298
+				$cmpfunc = $this->filter->createFunction('index.text:name', [$langid]);
299
+				$this->conditions[] = $this->filter->compare('!=', $cmpfunc, null);
300 300
 
301
-				$sortfunc = $this->filter->createFunction( 'sort:index.text:name', [$langid] );
302
-				$this->sort = $this->filter->sort( $direction, $sortfunc );
301
+				$sortfunc = $this->filter->createFunction('sort:index.text:name', [$langid]);
302
+				$this->sort = $this->filter->sort($direction, $sortfunc);
303 303
 				break;
304 304
 
305 305
 			case 'price':
306 306
 				$currencyid = $this->getContext()->getLocale()->getCurrencyId();
307 307
 
308
-				$cmpfunc = $this->filter->createFunction( 'index.price:value', [$currencyid] );
309
-				$this->conditions[] = $this->filter->compare( '!=', $cmpfunc, null );
308
+				$cmpfunc = $this->filter->createFunction('index.price:value', [$currencyid]);
309
+				$this->conditions[] = $this->filter->compare('!=', $cmpfunc, null);
310 310
 
311
-				$sortfunc = $this->filter->createFunction( 'sort:index.price:value', [$currencyid] );
312
-				$this->sort = $this->filter->sort( $direction, $sortfunc );
311
+				$sortfunc = $this->filter->createFunction('sort:index.price:value', [$currencyid]);
312
+				$this->sort = $this->filter->sort($direction, $sortfunc);
313 313
 				break;
314 314
 
315 315
 			case null:
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 				break;
318 318
 		}
319 319
 
320
-		if( $this->sort ) {
321
-			$this->filter->setSortations( [$this->sort] );
320
+		if ($this->sort) {
321
+			$this->filter->setSortations([$this->sort]);
322 322
 		}
323 323
 
324 324
 		return $this;
@@ -333,17 +333,17 @@  discard block
 block discarded – undo
333 333
 	 * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface
334 334
 	 * @since 2019.04
335 335
 	 */
336
-	public function supplier( $supIds, $listtype = 'default' )
336
+	public function supplier($supIds, $listtype = 'default')
337 337
 	{
338
-		if( ( $ids = array_unique( $this->validateIds( (array) $supIds ) ) ) !== [] )
338
+		if (($ids = array_unique($this->validateIds((array) $supIds))) !== [])
339 339
 		{
340
-			$func = $this->filter->createFunction( 'index.supplier:position', [$listtype, $ids] );
340
+			$func = $this->filter->createFunction('index.supplier:position', [$listtype, $ids]);
341 341
 
342
-			$this->conditions[] = $this->filter->compare( '==', 'index.supplier.id', $ids );
343
-			$this->conditions[] = $this->filter->compare( '>=', $func, 0 );
342
+			$this->conditions[] = $this->filter->compare('==', 'index.supplier.id', $ids);
343
+			$this->conditions[] = $this->filter->compare('>=', $func, 0);
344 344
 
345
-			$func = $this->filter->createFunction( 'sort:index.supplier:position', [$listtype, $ids] );
346
-			$this->sort = $this->filter->sort( '+', $func );
345
+			$func = $this->filter->createFunction('sort:index.supplier:position', [$listtype, $ids]);
346
+			$this->sort = $this->filter->sort('+', $func);
347 347
 		}
348 348
 
349 349
 		return $this;
@@ -357,14 +357,14 @@  discard block
 block discarded – undo
357 357
 	 * @return \Aimeos\Controller\Frontend\Product\Iface Product controller for fluent interface
358 358
 	 * @since 2019.04
359 359
 	 */
360
-	public function text( $text )
360
+	public function text($text)
361 361
 	{
362
-		if( $text )
362
+		if ($text)
363 363
 		{
364 364
 			$langid = $this->getContext()->getLocale()->getLanguageId();
365
-			$func = $this->filter->createFunction( 'index.text:relevance', [$langid, $text] );
365
+			$func = $this->filter->createFunction('index.text:relevance', [$langid, $text]);
366 366
 
367
-			$this->conditions[] = $this->filter->compare( '>', $func, 0 );
367
+			$this->conditions[] = $this->filter->compare('>', $func, 0);
368 368
 		}
369 369
 
370 370
 		return $this;
@@ -377,16 +377,16 @@  discard block
 block discarded – undo
377 377
 	 * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item with children
378 378
 	 * @return array List of catalog IDs
379 379
 	 */
380
-	protected function getCatalogIdsFromTree( \Aimeos\MShop\Catalog\Item\Iface $item )
380
+	protected function getCatalogIdsFromTree(\Aimeos\MShop\Catalog\Item\Iface $item)
381 381
 	{
382
-		if( $item->getStatus() < 1 ) {
382
+		if ($item->getStatus() < 1) {
383 383
 			return [];
384 384
 		}
385 385
 
386
-		$list = [ $item->getId() ];
386
+		$list = [$item->getId()];
387 387
 
388
-		foreach( $item->getChildren() as $child ) {
389
-			$list = array_merge( $list, $this->getCatalogIdsFromTree( $child ) );
388
+		foreach ($item->getChildren() as $child) {
389
+			$list = array_merge($list, $this->getCatalogIdsFromTree($child));
390 390
 		}
391 391
 
392 392
 		return $list;
@@ -399,13 +399,13 @@  discard block
 block discarded – undo
399 399
 	 * @param array $ids List of IDs to validate
400 400
 	 * @return array List of validated IDs
401 401
 	 */
402
-	protected function validateIds( array $ids )
402
+	protected function validateIds(array $ids)
403 403
 	{
404 404
 		$list = [];
405 405
 
406
-		foreach( $ids as $id )
406
+		foreach ($ids as $id)
407 407
 		{
408
-			if( $id != '' && preg_match( '/^[A-Za-z0-9\-\_]+$/', $id ) === 1 ) {
408
+			if ($id != '' && preg_match('/^[A-Za-z0-9\-\_]+$/', $id) === 1) {
409 409
 				$list[] = (string) $id;
410 410
 			}
411 411
 		}
Please login to merge, or discard this patch.
controller/frontend/tests/Controller/Frontend/Product/StandardTest.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -17,225 +17,225 @@
 block discarded – undo
17 17
 	protected function setUp()
18 18
 	{
19 19
 		$this->context = \TestHelperFrontend::getContext();
20
-		$this->object = new \Aimeos\Controller\Frontend\Product\Standard( $this->context );
20
+		$this->object = new \Aimeos\Controller\Frontend\Product\Standard($this->context);
21 21
 	}
22 22
 
23 23
 
24 24
 	protected function tearDown()
25 25
 	{
26
-		unset( $this->object );
26
+		unset($this->object);
27 27
 	}
28 28
 
29 29
 
30 30
 	public function testAggregate()
31 31
 	{
32
-		$list = $this->object->aggregate( 'index.attribute.id' );
32
+		$list = $this->object->aggregate('index.attribute.id');
33 33
 
34
-		$this->assertGreaterThan( 0, count( $list ) );
34
+		$this->assertGreaterThan(0, count($list));
35 35
 	}
36 36
 
37 37
 
38 38
 	public function testAllOf()
39 39
 	{
40
-		$manager = \Aimeos\MShop::create( $this->context, 'attribute' );
40
+		$manager = \Aimeos\MShop::create($this->context, 'attribute');
41 41
 
42
-		$length = $manager->findItem( '30', [], 'product', 'length' )->getId();
43
-		$width = $manager->findItem( '29', [], 'product', 'width' )->getId();
42
+		$length = $manager->findItem('30', [], 'product', 'length')->getId();
43
+		$width = $manager->findItem('29', [], 'product', 'width')->getId();
44 44
 
45
-		$this->assertEquals( 2, count( $this->object->allOf( [$length, $width] )->search() ) );
45
+		$this->assertEquals(2, count($this->object->allOf([$length, $width])->search()));
46 46
 	}
47 47
 
48 48
 
49 49
 	public function testCategory()
50 50
 	{
51
-		$manager = \Aimeos\MShop::create( $this->context, 'catalog' );
52
-		$catId = $manager->findItem( 'cafe' )->getId();
51
+		$manager = \Aimeos\MShop::create($this->context, 'catalog');
52
+		$catId = $manager->findItem('cafe')->getId();
53 53
 
54
-		$this->assertEquals( 2, count( $this->object->category( $catId, 'promotion' )->search() ) );
54
+		$this->assertEquals(2, count($this->object->category($catId, 'promotion')->search()));
55 55
 	}
56 56
 
57 57
 
58 58
 	public function testCategoryTree()
59 59
 	{
60
-		$manager = \Aimeos\MShop::create( $this->context, 'catalog' );
60
+		$manager = \Aimeos\MShop::create($this->context, 'catalog');
61 61
 
62
-		$catId = $manager->findItem( 'categories' )->getId();
63
-		$grpId = $manager->findItem( 'group' )->getId();
62
+		$catId = $manager->findItem('categories')->getId();
63
+		$grpId = $manager->findItem('group')->getId();
64 64
 
65
-		$this->object->category( [$catId, $grpId], 'promotion', \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE );
66
-		$this->assertEquals( 3, count( $this->object->search() ) );
65
+		$this->object->category([$catId, $grpId], 'promotion', \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE);
66
+		$this->assertEquals(3, count($this->object->search()));
67 67
 	}
68 68
 
69 69
 
70 70
 	public function testCompare()
71 71
 	{
72
-		$this->assertEquals( 1, count( $this->object->compare( '==', 'product.type', 'bundle' )->search() ) );
72
+		$this->assertEquals(1, count($this->object->compare('==', 'product.type', 'bundle')->search()));
73 73
 	}
74 74
 
75 75
 
76 76
 	public function testGet()
77 77
 	{
78
-		$item = \Aimeos\MShop::create( $this->context, 'product' )->findItem( 'CNC' );
78
+		$item = \Aimeos\MShop::create($this->context, 'product')->findItem('CNC');
79 79
 
80
-		$this->assertInstanceOf( \Aimeos\MShop\Product\Item\Iface::class, $this->object->get( $item->getId() ) );
80
+		$this->assertInstanceOf(\Aimeos\MShop\Product\Item\Iface::class, $this->object->get($item->getId()));
81 81
 	}
82 82
 
83 83
 
84 84
 	public function testFind()
85 85
 	{
86
-		$this->assertInstanceOf( \Aimeos\MShop\Product\Item\Iface::class, $this->object->find( 'CNC' ) );
86
+		$this->assertInstanceOf(\Aimeos\MShop\Product\Item\Iface::class, $this->object->find('CNC'));
87 87
 	}
88 88
 
89 89
 
90 90
 	public function testOneOf()
91 91
 	{
92
-		$manager = \Aimeos\MShop::create( $this->context, 'attribute' );
92
+		$manager = \Aimeos\MShop::create($this->context, 'attribute');
93 93
 
94
-		$length = $manager->findItem( '30', [], 'product', 'length' )->getId();
95
-		$width = $manager->findItem( '29', [], 'product', 'width' )->getId();
94
+		$length = $manager->findItem('30', [], 'product', 'length')->getId();
95
+		$width = $manager->findItem('29', [], 'product', 'width')->getId();
96 96
 
97
-		$this->assertEquals( 4, count( $this->object->oneOf( [$length, $width] )->search() ) );
97
+		$this->assertEquals(4, count($this->object->oneOf([$length, $width])->search()));
98 98
 	}
99 99
 
100 100
 
101 101
 	public function testOneOfList()
102 102
 	{
103
-		$manager = \Aimeos\MShop::create( $this->context, 'attribute' );
103
+		$manager = \Aimeos\MShop::create($this->context, 'attribute');
104 104
 
105
-		$length = $manager->findItem( '30', [], 'product', 'length' )->getId();
106
-		$width = $manager->findItem( '29', [], 'product', 'width' )->getId();
105
+		$length = $manager->findItem('30', [], 'product', 'length')->getId();
106
+		$width = $manager->findItem('29', [], 'product', 'width')->getId();
107 107
 
108
-		$this->assertEquals( 4, count( $this->object->oneOf( [[$length, $width]] )->search() ) );
108
+		$this->assertEquals(4, count($this->object->oneOf([[$length, $width]])->search()));
109 109
 	}
110 110
 
111 111
 
112 112
 	public function testParse()
113 113
 	{
114 114
 		$cond = ['&&' => [['>' => ['product.status' => 0]], ['==' => ['product.type' => 'default']]]];
115
-		$this->assertEquals( 4, count( $this->object->parse( $cond )->search() ) );
115
+		$this->assertEquals(4, count($this->object->parse($cond)->search()));
116 116
 	}
117 117
 
118 118
 
119 119
 	public function testProduct()
120 120
 	{
121
-		$manager = \Aimeos\MShop::create( $this->context, 'product' );
121
+		$manager = \Aimeos\MShop::create($this->context, 'product');
122 122
 
123
-		$cncId = $manager->findItem( 'CNC' )->getId();
124
-		$cneId = $manager->findItem( 'CNE' )->getId();
123
+		$cncId = $manager->findItem('CNC')->getId();
124
+		$cneId = $manager->findItem('CNE')->getId();
125 125
 
126
-		$this->assertEquals( 2, count( $this->object->product( [$cncId, $cneId] )->search() ) );
126
+		$this->assertEquals(2, count($this->object->product([$cncId, $cneId])->search()));
127 127
 	}
128 128
 
129 129
 
130 130
 	public function testSearch()
131 131
 	{
132
-		$this->assertEquals( 8, count( $this->object->search() ) );
132
+		$this->assertEquals(8, count($this->object->search()));
133 133
 	}
134 134
 
135 135
 
136 136
 	public function testSlice()
137 137
 	{
138
-		$this->assertEquals( 2, count( $this->object->slice( 0, 2 )->search() ) );
138
+		$this->assertEquals(2, count($this->object->slice(0, 2)->search()));
139 139
 	}
140 140
 
141 141
 
142 142
 	public function testSort()
143 143
 	{
144
-		$this->assertEquals( 8, count( $this->object->sort( 'relevance' )->search() ) );
144
+		$this->assertEquals(8, count($this->object->sort('relevance')->search()));
145 145
 	}
146 146
 
147 147
 
148 148
 	public function testSortCode()
149 149
 	{
150
-		$result = $this->object->sort( 'code' )->search( [] );
151
-		$this->assertEquals( 'CNC', reset( $result )->getCode() );
150
+		$result = $this->object->sort('code')->search([]);
151
+		$this->assertEquals('CNC', reset($result)->getCode());
152 152
 	}
153 153
 
154 154
 
155 155
 	public function testSortCodeDesc()
156 156
 	{
157
-		$result = $this->object->sort( '-code' )->search( [] );
158
-		$this->assertStringStartsWith( 'U:', reset( $result )->getCode() );
157
+		$result = $this->object->sort('-code')->search([]);
158
+		$this->assertStringStartsWith('U:', reset($result)->getCode());
159 159
 	}
160 160
 
161 161
 
162 162
 	public function testSortCtime()
163 163
 	{
164
-		$this->assertEquals( 8, count( $this->object->sort( 'ctime' )->search( [] ) ) );
164
+		$this->assertEquals(8, count($this->object->sort('ctime')->search([])));
165 165
 	}
166 166
 
167 167
 
168 168
 	public function testSortCtimeDesc()
169 169
 	{
170
-		$this->assertEquals( 8, count( $this->object->sort( '-ctime' )->search( [] ) ) );
170
+		$this->assertEquals(8, count($this->object->sort('-ctime')->search([])));
171 171
 	}
172 172
 
173 173
 
174 174
 	public function testSortName()
175 175
 	{
176
-		$result = $this->object->sort( 'name' )->search( ['text'] );
177
-		$this->assertEquals( 'Cafe Noire Cappuccino', reset( $result )->getName() );
176
+		$result = $this->object->sort('name')->search(['text']);
177
+		$this->assertEquals('Cafe Noire Cappuccino', reset($result)->getName());
178 178
 	}
179 179
 
180 180
 
181 181
 	public function testSortNameDesc()
182 182
 	{
183
-		$result = $this->object->sort( '-name' )->search( ['text'] );
184
-		$this->assertEquals( 'Unterproduct 3', reset( $result )->getName() );
183
+		$result = $this->object->sort('-name')->search(['text']);
184
+		$this->assertEquals('Unterproduct 3', reset($result)->getName());
185 185
 	}
186 186
 
187 187
 
188 188
 	public function testSortPrice()
189 189
 	{
190
-		$result = $this->object->sort( 'price' )->search( [] );
191
-		$this->assertEquals( 'IJKL', reset( $result )->getCode() );
190
+		$result = $this->object->sort('price')->search([]);
191
+		$this->assertEquals('IJKL', reset($result)->getCode());
192 192
 	}
193 193
 
194 194
 
195 195
 	public function testSortPriceDesc()
196 196
 	{
197
-		$result = $this->object->sort( '-price' )->search( [] );
198
-		$this->assertTrue( in_array( reset( $result )->getCode(), ['CNC', 'U:BUNDLE'] ) );
197
+		$result = $this->object->sort('-price')->search([]);
198
+		$this->assertTrue(in_array(reset($result)->getCode(), ['CNC', 'U:BUNDLE']));
199 199
 	}
200 200
 
201 201
 
202 202
 	public function testSortRelevanceCategory()
203 203
 	{
204
-		$manager = \Aimeos\MShop::create( $this->context, 'catalog' );
205
-		$catId = $manager->findItem( 'new' )->getId();
204
+		$manager = \Aimeos\MShop::create($this->context, 'catalog');
205
+		$catId = $manager->findItem('new')->getId();
206 206
 
207
-		$result = $this->object->category( $catId )->sort( 'relevance' )->search( [] );
207
+		$result = $this->object->category($catId)->sort('relevance')->search([]);
208 208
 
209
-		$this->assertEquals( 3, count( $result ) );
210
-		$this->assertEquals( 'CNE', reset( $result )->getCode() );
211
-		$this->assertEquals( 'U:BUNDLE', end( $result )->getCode() );
209
+		$this->assertEquals(3, count($result));
210
+		$this->assertEquals('CNE', reset($result)->getCode());
211
+		$this->assertEquals('U:BUNDLE', end($result)->getCode());
212 212
 	}
213 213
 
214 214
 
215 215
 	public function testSortRelevanceSupplier()
216 216
 	{
217
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
218
-		$supId = $manager->findItem( 'unitCode001' )->getId();
217
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
218
+		$supId = $manager->findItem('unitCode001')->getId();
219 219
 
220
-		$result = $this->object->supplier( $supId )->sort( 'relevance' )->search( [] );
220
+		$result = $this->object->supplier($supId)->sort('relevance')->search([]);
221 221
 
222
-		$this->assertEquals( 2, count( $result ) );
223
-		$this->assertEquals( 'CNC', reset( $result )->getCode() );
224
-		$this->assertEquals( 'CNE', end( $result )->getCode() );
222
+		$this->assertEquals(2, count($result));
223
+		$this->assertEquals('CNC', reset($result)->getCode());
224
+		$this->assertEquals('CNE', end($result)->getCode());
225 225
 	}
226 226
 
227 227
 
228 228
 	public function testSupplier()
229 229
 	{
230
-		$manager = \Aimeos\MShop::create( $this->context, 'supplier' );
231
-		$supId = $manager->findItem( 'unitCode001' )->getId();
230
+		$manager = \Aimeos\MShop::create($this->context, 'supplier');
231
+		$supId = $manager->findItem('unitCode001')->getId();
232 232
 
233
-		$this->assertEquals( 2, count( $this->object->supplier( $supId )->search( [] ) ) );
233
+		$this->assertEquals(2, count($this->object->supplier($supId)->search([])));
234 234
 	}
235 235
 
236 236
 
237 237
 	public function testText()
238 238
 	{
239
-		$this->assertEquals( 3, count( $this->object->text( 'Cafe' )->search( [] ) ) );
239
+		$this->assertEquals(3, count($this->object->text('Cafe')->search([])));
240 240
 	}
241 241
 }
Please login to merge, or discard this patch.