@@ -17,22 +17,22 @@ discard block |
||
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 | 32 | $filter = $this->object->createFilter(); |
33 | - $list = $this->object->aggregate( $filter, 'index.attribute.id' ); |
|
33 | + $list = $this->object->aggregate($filter, 'index.attribute.id'); |
|
34 | 34 | |
35 | - $this->assertGreaterThan( 0, count( $list ) ); |
|
35 | + $this->assertGreaterThan(0, count($list)); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -40,137 +40,137 @@ discard block |
||
40 | 40 | { |
41 | 41 | $filter = $this->object->createFilter(); |
42 | 42 | |
43 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
44 | - $this->assertEquals( [], $filter->getSortations() ); |
|
45 | - $this->assertEquals( 0, $filter->getSliceStart() ); |
|
46 | - $this->assertEquals( 100, $filter->getSliceSize() ); |
|
43 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
44 | + $this->assertEquals([], $filter->getSortations()); |
|
45 | + $this->assertEquals(0, $filter->getSliceStart()); |
|
46 | + $this->assertEquals(100, $filter->getSliceSize()); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | public function testCreateFilterIgnoreDates() |
51 | 51 | { |
52 | - $this->context->getConfig()->set( 'controller/frontend/product/ignore-dates', true ); |
|
52 | + $this->context->getConfig()->set('controller/frontend/product/ignore-dates', true); |
|
53 | 53 | |
54 | 54 | $filter = $this->object->createFilter(); |
55 | 55 | |
56 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
56 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | 60 | public function testAddFilterAttribute() |
61 | 61 | { |
62 | 62 | $filter = $this->object->createFilter(); |
63 | - $filter = $this->object->addFilterAttribute( $filter, array( 1, 2 ), [], [] ); |
|
63 | + $filter = $this->object->addFilterAttribute($filter, array(1, 2), [], []); |
|
64 | 64 | |
65 | 65 | $list = $filter->getConditions()->getExpressions(); |
66 | 66 | |
67 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
68 | - throw new \RuntimeException( 'Wrong expression' ); |
|
67 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
68 | + throw new \RuntimeException('Wrong expression'); |
|
69 | 69 | } |
70 | 70 | |
71 | - $this->assertEquals( 'index.attribute:all(["1","2"])', $list[0]->getName() ); |
|
71 | + $this->assertEquals('index.attribute:all(["1","2"])', $list[0]->getName()); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
75 | 75 | public function testAddFilterAttributeOptions() |
76 | 76 | { |
77 | 77 | $filter = $this->object->createFilter(); |
78 | - $filter = $this->object->addFilterAttribute( $filter, [], array( 1 ), [] ); |
|
78 | + $filter = $this->object->addFilterAttribute($filter, [], array(1), []); |
|
79 | 79 | |
80 | 80 | $list = $filter->getConditions()->getExpressions(); |
81 | 81 | |
82 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
83 | - throw new \RuntimeException( 'Wrong expression' ); |
|
82 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
83 | + throw new \RuntimeException('Wrong expression'); |
|
84 | 84 | } |
85 | 85 | |
86 | - $this->assertEquals( 'index.attribute.id', $list[0]->getName() ); |
|
87 | - $this->assertEquals( [1], $list[0]->getValue() ); |
|
86 | + $this->assertEquals('index.attribute.id', $list[0]->getName()); |
|
87 | + $this->assertEquals([1], $list[0]->getValue()); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | 91 | public function testAddFilterAttributeOne() |
92 | 92 | { |
93 | 93 | $filter = $this->object->createFilter(); |
94 | - $filter = $this->object->addFilterAttribute( $filter, [], [], array( 'test' => array( 2 ) ) ); |
|
94 | + $filter = $this->object->addFilterAttribute($filter, [], [], array('test' => array(2))); |
|
95 | 95 | |
96 | 96 | $list = $filter->getConditions()->getExpressions(); |
97 | 97 | |
98 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
99 | - throw new \RuntimeException( 'Wrong expression' ); |
|
98 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
99 | + throw new \RuntimeException('Wrong expression'); |
|
100 | 100 | } |
101 | 101 | |
102 | - $this->assertEquals( 'index.attribute.id', $list[0]->getName() ); |
|
103 | - $this->assertEquals( [2], $list[0]->getValue() ); |
|
102 | + $this->assertEquals('index.attribute.id', $list[0]->getName()); |
|
103 | + $this->assertEquals([2], $list[0]->getValue()); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
107 | 107 | public function testAddFilterCategory() |
108 | 108 | { |
109 | 109 | $context = \TestHelperFrontend::getContext(); |
110 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'catalog' ); |
|
110 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'catalog'); |
|
111 | 111 | |
112 | - $catId = $manager->findItem( 'root' )->getId(); |
|
112 | + $catId = $manager->findItem('root')->getId(); |
|
113 | 113 | $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_LIST; |
114 | 114 | |
115 | 115 | $filter = $this->object->createFilter(); |
116 | - $filter = $this->object->addFilterCategory( $filter, [$catId], 'default', $level ); |
|
116 | + $filter = $this->object->addFilterCategory($filter, [$catId], 'default', $level); |
|
117 | 117 | |
118 | 118 | $list = $filter->getConditions()->getExpressions(); |
119 | 119 | |
120 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Combine\Iface ) ) { |
|
121 | - throw new \RuntimeException( 'Not a "combine" expression' ); |
|
120 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Combine\Iface)) { |
|
121 | + throw new \RuntimeException('Not a "combine" expression'); |
|
122 | 122 | } |
123 | 123 | |
124 | - if( !isset( $list[1] ) || !( $list[1] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
125 | - throw new \RuntimeException( 'Not a "compare" expression' ); |
|
124 | + if (!isset($list[1]) || !($list[1] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
125 | + throw new \RuntimeException('Not a "compare" expression'); |
|
126 | 126 | } |
127 | 127 | |
128 | - $this->assertEquals( 'index.catalog.id', $list[1]->getName() ); |
|
129 | - $this->assertEquals( 3, count( $list[1]->getValue() ) ); |
|
130 | - $this->assertEquals( [], $filter->getSortations() ); |
|
128 | + $this->assertEquals('index.catalog.id', $list[1]->getName()); |
|
129 | + $this->assertEquals(3, count($list[1]->getValue())); |
|
130 | + $this->assertEquals([], $filter->getSortations()); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
134 | 134 | public function testAddFilterSupplier() |
135 | 135 | { |
136 | 136 | $filter = $this->object->createFilter(); |
137 | - $filter = $this->object->addFilterSupplier( $filter, [1, 2] ); |
|
137 | + $filter = $this->object->addFilterSupplier($filter, [1, 2]); |
|
138 | 138 | |
139 | 139 | $list = $filter->getConditions()->getExpressions(); |
140 | 140 | |
141 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Combine\Iface ) ) { |
|
142 | - throw new \RuntimeException( 'Not a "combine" expression' ); |
|
141 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Combine\Iface)) { |
|
142 | + throw new \RuntimeException('Not a "combine" expression'); |
|
143 | 143 | } |
144 | 144 | |
145 | - if( !isset( $list[1] ) || !( $list[1] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
146 | - throw new \RuntimeException( 'Not a "compare" expression' ); |
|
145 | + if (!isset($list[1]) || !($list[1] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
146 | + throw new \RuntimeException('Not a "compare" expression'); |
|
147 | 147 | } |
148 | 148 | |
149 | - $this->assertEquals( 'index.supplier.id', $list[1]->getName() ); |
|
150 | - $this->assertEquals( 2, count( $list[1]->getValue() ) ); |
|
151 | - $this->assertEquals( [], $filter->getSortations() ); |
|
149 | + $this->assertEquals('index.supplier.id', $list[1]->getName()); |
|
150 | + $this->assertEquals(2, count($list[1]->getValue())); |
|
151 | + $this->assertEquals([], $filter->getSortations()); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
155 | 155 | public function testAddFilterText() |
156 | 156 | { |
157 | 157 | $filter = $this->object->createFilter(); |
158 | - $filter = $this->object->addFilterText( $filter, 'Espresso' ); |
|
158 | + $filter = $this->object->addFilterText($filter, 'Espresso'); |
|
159 | 159 | |
160 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
160 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
161 | 161 | |
162 | 162 | $list = $filter->getConditions()->getExpressions(); |
163 | 163 | |
164 | 164 | |
165 | - if( !isset( $list[0] ) || !( $list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface ) ) { |
|
166 | - throw new \RuntimeException( 'Wrong expression' ); |
|
165 | + if (!isset($list[0]) || !($list[0] instanceof \Aimeos\MW\Criteria\Expression\Compare\Iface)) { |
|
166 | + throw new \RuntimeException('Wrong expression'); |
|
167 | 167 | } |
168 | - $this->assertEquals( 'index.text:relevance("de","Espresso")', $list[0]->getName() ); |
|
169 | - $this->assertEquals( 0, $list[0]->getValue() ); |
|
168 | + $this->assertEquals('index.text:relevance("de","Espresso")', $list[0]->getName()); |
|
169 | + $this->assertEquals(0, $list[0]->getValue()); |
|
170 | 170 | |
171 | - $this->assertEquals( [], $filter->getSortations() ); |
|
172 | - $this->assertEquals( 0, $filter->getSliceStart() ); |
|
173 | - $this->assertEquals( 100, $filter->getSliceSize() ); |
|
171 | + $this->assertEquals([], $filter->getSortations()); |
|
172 | + $this->assertEquals(0, $filter->getSliceStart()); |
|
173 | + $this->assertEquals(100, $filter->getSliceSize()); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -178,194 +178,194 @@ discard block |
||
178 | 178 | { |
179 | 179 | $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE; |
180 | 180 | |
181 | - $filter = $this->object->createFilter( 'relevance', '-' ); |
|
182 | - $filter = $this->object->addFilterCategory( $filter, [-1], 'test', $level ); |
|
181 | + $filter = $this->object->createFilter('relevance', '-'); |
|
182 | + $filter = $this->object->addFilterCategory($filter, [-1], 'test', $level); |
|
183 | 183 | |
184 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
184 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
185 | 185 | |
186 | 186 | $sort = $filter->getSortations(); |
187 | - if( ( $item = reset( $sort ) ) === false ) { |
|
188 | - throw new \RuntimeException( 'Sortation not set' ); |
|
187 | + if (($item = reset($sort)) === false) { |
|
188 | + throw new \RuntimeException('Sortation not set'); |
|
189 | 189 | } |
190 | 190 | |
191 | - $this->assertEquals( 'sort:index.catalog:position("test",["-1"])', $item->getName() ); |
|
192 | - $this->assertEquals( '-', $item->getOperator() ); |
|
191 | + $this->assertEquals('sort:index.catalog:position("test",["-1"])', $item->getName()); |
|
192 | + $this->assertEquals('-', $item->getOperator()); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | |
196 | 196 | public function testCreateFilterSortRelevanceSupplier() |
197 | 197 | { |
198 | - $filter = $this->object->createFilter( 'relevance', '-' ); |
|
199 | - $filter = $this->object->addFilterSupplier( $filter, [-1], 'test' ); |
|
198 | + $filter = $this->object->createFilter('relevance', '-'); |
|
199 | + $filter = $this->object->addFilterSupplier($filter, [-1], 'test'); |
|
200 | 200 | |
201 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
201 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
202 | 202 | |
203 | 203 | $sort = $filter->getSortations(); |
204 | - if( ( $item = reset( $sort ) ) === false ) { |
|
205 | - throw new \RuntimeException( 'Sortation not set' ); |
|
204 | + if (($item = reset($sort)) === false) { |
|
205 | + throw new \RuntimeException('Sortation not set'); |
|
206 | 206 | } |
207 | 207 | |
208 | - $this->assertEquals( 'sort:index.supplier:position("test",["-1"])', $item->getName() ); |
|
209 | - $this->assertEquals( '-', $item->getOperator() ); |
|
208 | + $this->assertEquals('sort:index.supplier:position("test",["-1"])', $item->getName()); |
|
209 | + $this->assertEquals('-', $item->getOperator()); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
213 | 213 | public function testCreateFilterSortRelevanceText() |
214 | 214 | { |
215 | - $filter = $this->object->createFilter( 'relevance', '-', 1, 2 ); |
|
216 | - $filter = $this->object->addFilterText( $filter, 'Espresso' ); |
|
215 | + $filter = $this->object->createFilter('relevance', '-', 1, 2); |
|
216 | + $filter = $this->object->addFilterText($filter, 'Espresso'); |
|
217 | 217 | |
218 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
219 | - $this->assertEquals( [], $filter->getSortations() ); |
|
220 | - $this->assertEquals( 1, $filter->getSliceStart() ); |
|
221 | - $this->assertEquals( 2, $filter->getSliceSize() ); |
|
218 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
219 | + $this->assertEquals([], $filter->getSortations()); |
|
220 | + $this->assertEquals(1, $filter->getSliceStart()); |
|
221 | + $this->assertEquals(2, $filter->getSliceSize()); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
225 | 225 | public function testCreateFilterSortCode() |
226 | 226 | { |
227 | - $filter = $this->object->createFilter( 'code' ); |
|
227 | + $filter = $this->object->createFilter('code'); |
|
228 | 228 | |
229 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
229 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
230 | 230 | |
231 | 231 | $sort = $filter->getSortations(); |
232 | - if( ( $item = reset( $sort ) ) === false ) { |
|
233 | - throw new \RuntimeException( 'Sortation not set' ); |
|
232 | + if (($item = reset($sort)) === false) { |
|
233 | + throw new \RuntimeException('Sortation not set'); |
|
234 | 234 | } |
235 | 235 | |
236 | - $this->assertEquals( 'product.code', $item->getName() ); |
|
236 | + $this->assertEquals('product.code', $item->getName()); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | |
240 | 240 | public function testCreateFilterSortCtime() |
241 | 241 | { |
242 | - $filter = $this->object->createFilter( 'ctime' ); |
|
242 | + $filter = $this->object->createFilter('ctime'); |
|
243 | 243 | |
244 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
244 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
245 | 245 | |
246 | 246 | $sort = $filter->getSortations(); |
247 | - if( ( $item = reset( $sort ) ) === false ) { |
|
248 | - throw new \RuntimeException( 'Sortation not set' ); |
|
247 | + if (($item = reset($sort)) === false) { |
|
248 | + throw new \RuntimeException('Sortation not set'); |
|
249 | 249 | } |
250 | 250 | |
251 | - $this->assertEquals( 'product.ctime', $item->getName() ); |
|
251 | + $this->assertEquals('product.ctime', $item->getName()); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | |
255 | 255 | public function testCreateFilterSortName() |
256 | 256 | { |
257 | - $filter = $this->object->createFilter( 'name' ); |
|
257 | + $filter = $this->object->createFilter('name'); |
|
258 | 258 | |
259 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
259 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
260 | 260 | |
261 | 261 | $sort = $filter->getSortations(); |
262 | - if( ( $item = reset( $sort ) ) === false ) { |
|
263 | - throw new \RuntimeException( 'Sortation not set' ); |
|
262 | + if (($item = reset($sort)) === false) { |
|
263 | + throw new \RuntimeException('Sortation not set'); |
|
264 | 264 | } |
265 | 265 | |
266 | - $this->assertEquals( 'sort:index.text:name("de")', $item->getName() ); |
|
266 | + $this->assertEquals('sort:index.text:name("de")', $item->getName()); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
270 | 270 | public function testCreateFilterSortPrice() |
271 | 271 | { |
272 | - $filter = $this->object->createFilter( 'price' ); |
|
272 | + $filter = $this->object->createFilter('price'); |
|
273 | 273 | |
274 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
274 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
275 | 275 | |
276 | 276 | $sort = $filter->getSortations(); |
277 | - if( ( $item = reset( $sort ) ) === false ) { |
|
278 | - throw new \RuntimeException( 'Sortation not set' ); |
|
277 | + if (($item = reset($sort)) === false) { |
|
278 | + throw new \RuntimeException('Sortation not set'); |
|
279 | 279 | } |
280 | 280 | |
281 | - $this->assertStringStartsWith( 'sort:index.price:value("EUR")', $item->getName() ); |
|
281 | + $this->assertStringStartsWith('sort:index.price:value("EUR")', $item->getName()); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
285 | 285 | public function testCreateFilterSortInvalid() |
286 | 286 | { |
287 | - $filter = $this->object->createFilter( '', 'failure' ); |
|
287 | + $filter = $this->object->createFilter('', 'failure'); |
|
288 | 288 | |
289 | - $this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter ); |
|
290 | - $this->assertEquals( [], $filter->getSortations() ); |
|
289 | + $this->assertInstanceOf('\\Aimeos\\MW\\Criteria\\Iface', $filter); |
|
290 | + $this->assertEquals([], $filter->getSortations()); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | |
294 | 294 | public function testGetItem() |
295 | 295 | { |
296 | 296 | $context = \TestHelperFrontend::getContext(); |
297 | - $id = \Aimeos\MShop\Factory::createManager( $context, 'product' )->findItem( 'CNC' )->getId(); |
|
297 | + $id = \Aimeos\MShop\Factory::createManager($context, 'product')->findItem('CNC')->getId(); |
|
298 | 298 | |
299 | - $result = $this->object->getItem( $id ); |
|
299 | + $result = $this->object->getItem($id); |
|
300 | 300 | |
301 | - $this->assertInstanceOf( \Aimeos\MShop\Product\Item\Iface::class, $result ); |
|
302 | - $this->assertGreaterThan( 0, $result->getPropertyItems() ); |
|
303 | - $this->assertGreaterThan( 0, $result->getRefItems( 'attribute' ) ); |
|
304 | - $this->assertGreaterThan( 0, $result->getRefItems( 'media' ) ); |
|
305 | - $this->assertGreaterThan( 0, $result->getRefItems( 'price' ) ); |
|
306 | - $this->assertGreaterThan( 0, $result->getRefItems( 'product' ) ); |
|
307 | - $this->assertGreaterThan( 0, $result->getRefItems( 'text' ) ); |
|
301 | + $this->assertInstanceOf(\Aimeos\MShop\Product\Item\Iface::class, $result); |
|
302 | + $this->assertGreaterThan(0, $result->getPropertyItems()); |
|
303 | + $this->assertGreaterThan(0, $result->getRefItems('attribute')); |
|
304 | + $this->assertGreaterThan(0, $result->getRefItems('media')); |
|
305 | + $this->assertGreaterThan(0, $result->getRefItems('price')); |
|
306 | + $this->assertGreaterThan(0, $result->getRefItems('product')); |
|
307 | + $this->assertGreaterThan(0, $result->getRefItems('text')); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | |
311 | 311 | public function testGetItems() |
312 | 312 | { |
313 | 313 | $context = \TestHelperFrontend::getContext(); |
314 | - $context->getConfig()->set( 'controller/frontend/product/ignore-dates', true ); |
|
314 | + $context->getConfig()->set('controller/frontend/product/ignore-dates', true); |
|
315 | 315 | |
316 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
316 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
317 | 317 | |
318 | 318 | $search = $manager->createSearch(); |
319 | - $search->setConditions( $search->compare( '==', 'product.code', array( 'CNC', 'CNE' ) ) ); |
|
319 | + $search->setConditions($search->compare('==', 'product.code', array('CNC', 'CNE'))); |
|
320 | 320 | |
321 | 321 | $ids = []; |
322 | - foreach( $manager->searchItems( $search ) as $productItem ) { |
|
322 | + foreach ($manager->searchItems($search) as $productItem) { |
|
323 | 323 | $ids[] = $productItem->getId(); |
324 | 324 | } |
325 | 325 | |
326 | 326 | |
327 | - $result = $this->object->getItems( $ids ); |
|
327 | + $result = $this->object->getItems($ids); |
|
328 | 328 | |
329 | - $this->assertEquals( 2, count( $result ) ); |
|
329 | + $this->assertEquals(2, count($result)); |
|
330 | 330 | |
331 | - foreach( $result as $productItem ) { |
|
332 | - $this->assertInstanceOf( \Aimeos\MShop\Product\Item\Iface::class, $productItem ); |
|
331 | + foreach ($result as $productItem) { |
|
332 | + $this->assertInstanceOf(\Aimeos\MShop\Product\Item\Iface::class, $productItem); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
336 | 336 | |
337 | 337 | public function testSearchItemsCategory() |
338 | 338 | { |
339 | - $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
339 | + $catalogManager = \Aimeos\MShop\Catalog\Manager\Factory::createManager(\TestHelperFrontend::getContext()); |
|
340 | 340 | |
341 | - $search = $catalogManager->createSearch()->setSlice( 0, 1 ); |
|
342 | - $search->setConditions( $search->compare( '==', 'catalog.code', 'new' ) ); |
|
343 | - $items = $catalogManager->searchItems( $search ); |
|
341 | + $search = $catalogManager->createSearch()->setSlice(0, 1); |
|
342 | + $search->setConditions($search->compare('==', 'catalog.code', 'new')); |
|
343 | + $items = $catalogManager->searchItems($search); |
|
344 | 344 | |
345 | - if( ( $item = reset( $items ) ) === false ) { |
|
346 | - throw new \RuntimeException( 'Product item not found' ); |
|
345 | + if (($item = reset($items)) === false) { |
|
346 | + throw new \RuntimeException('Product item not found'); |
|
347 | 347 | } |
348 | 348 | |
349 | - $filter = $this->object->createFilter( 'position', '+', 1, 1 ); |
|
350 | - $filter = $this->object->addFilterCategory( $filter, [$item->getId()] ); |
|
349 | + $filter = $this->object->createFilter('position', '+', 1, 1); |
|
350 | + $filter = $this->object->addFilterCategory($filter, [$item->getId()]); |
|
351 | 351 | |
352 | 352 | $total = 0; |
353 | - $results = $this->object->searchItems( $filter, [], $total ); |
|
353 | + $results = $this->object->searchItems($filter, [], $total); |
|
354 | 354 | |
355 | - $this->assertEquals( 3, $total ); |
|
356 | - $this->assertEquals( 1, count( $results ) ); |
|
355 | + $this->assertEquals(3, $total); |
|
356 | + $this->assertEquals(1, count($results)); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | |
360 | 360 | public function testSearchItemsText() |
361 | 361 | { |
362 | - $filter = $this->object->createFilter( 'relevance', '+', 0, 1 ); |
|
363 | - $filter = $this->object->addFilterText( $filter, 'Expresso' ); |
|
362 | + $filter = $this->object->createFilter('relevance', '+', 0, 1); |
|
363 | + $filter = $this->object->addFilterText($filter, 'Expresso'); |
|
364 | 364 | |
365 | 365 | $total = 0; |
366 | - $results = $this->object->searchItems( $filter, [], $total ); |
|
366 | + $results = $this->object->searchItems($filter, [], $total); |
|
367 | 367 | |
368 | - $this->assertEquals( 2, $total ); |
|
369 | - $this->assertEquals( 1, count( $results ) ); |
|
368 | + $this->assertEquals(2, $total); |
|
369 | + $this->assertEquals(1, count($results)); |
|
370 | 370 | } |
371 | 371 | } |