Total Complexity | 52 |
Total Lines | 647 |
Duplicated Lines | 0 % |
Changes | 0 |
Complex classes like StandardTest often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use StandardTest, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
12 | class StandardTest extends \PHPUnit\Framework\TestCase |
||
|
|||
13 | { |
||
14 | private $object; |
||
15 | private $context; |
||
16 | private static $testItem; |
||
17 | |||
18 | |||
19 | public static function setUpBeforeClass() |
||
20 | { |
||
21 | $context = \TestHelperFrontend::getContext(); |
||
22 | self::$testItem = \Aimeos\MShop::create( $context, 'product' )->findItem( 'U:TESTP' ); |
||
23 | } |
||
24 | |||
25 | |||
26 | protected function setUp() |
||
27 | { |
||
28 | \Aimeos\MShop::cache( true ); |
||
29 | |||
30 | $this->context = \TestHelperFrontend::getContext(); |
||
31 | $this->object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context ); |
||
32 | } |
||
33 | |||
34 | |||
35 | protected function tearDown() |
||
43 | } |
||
44 | |||
45 | |||
46 | public function testClear() |
||
47 | { |
||
48 | $this->object->addProduct( self::$testItem->getId(), 2 ); |
||
49 | $this->object->clear(); |
||
50 | |||
51 | $this->assertEquals( 0, count( $this->object->get()->getProducts() ) ); |
||
52 | } |
||
53 | |||
54 | |||
55 | public function testGet() |
||
56 | { |
||
57 | $this->assertInstanceOf( \Aimeos\MShop\Order\Item\Base\Iface::class, $this->object->get() ); |
||
58 | } |
||
59 | |||
60 | |||
61 | public function testSave() |
||
62 | { |
||
63 | $stub = $this->getMockBuilder( \Aimeos\MShop\Order\Manager\Base\Standard::class ) |
||
64 | ->setConstructorArgs( [$this->context] ) |
||
65 | ->setMethods( ['setSession'] ) |
||
66 | ->getMock(); |
||
67 | |||
68 | \Aimeos\MShop::inject( 'order/base', $stub ); |
||
69 | |||
70 | $stub->expects( $this->exactly( 2 ) )->method( 'setSession' ); |
||
71 | |||
72 | $object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context ); |
||
73 | $object->addProduct( self::$testItem->getId(), 2 ); |
||
74 | $object->save(); |
||
75 | } |
||
76 | |||
77 | |||
78 | public function testSetType() |
||
79 | { |
||
80 | $this->assertInstanceOf( \Aimeos\Controller\Frontend\Basket\Iface::class, $this->object->setType( 'test' ) ); |
||
81 | } |
||
82 | |||
83 | |||
84 | public function testStore() |
||
85 | { |
||
86 | $stub = $this->getMockBuilder( \Aimeos\MShop\Order\Manager\Base\Standard::class ) |
||
87 | ->setConstructorArgs( [$this->context] ) |
||
88 | ->setMethods( ['store'] ) |
||
89 | ->getMock(); |
||
90 | |||
91 | \Aimeos\MShop::inject( 'order/base', $stub ); |
||
92 | |||
93 | $stub->expects( $this->once() )->method( 'store' ); |
||
94 | |||
95 | $object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context ); |
||
96 | $object->store(); |
||
97 | } |
||
98 | |||
99 | |||
100 | public function testStoreLimit() |
||
101 | { |
||
102 | $this->context->setEditor( 'core:unittest' ); |
||
103 | $config = $this->context->getConfig(); |
||
104 | $config->set( 'controller/frontend/basket/limit-count', 0 ); |
||
105 | $config->set( 'controller/frontend/basket/limit-seconds', 86400 * 365 ); |
||
106 | |||
107 | $object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context ); |
||
108 | |||
109 | $this->setExpectedException( \Aimeos\Controller\Frontend\Basket\Exception::class ); |
||
110 | $object->store(); |
||
111 | } |
||
112 | |||
113 | |||
114 | public function testLoad() |
||
115 | { |
||
116 | $stub = $this->getMockBuilder( \Aimeos\MShop\Order\Manager\Base\Standard::class ) |
||
117 | ->setConstructorArgs( [$this->context] ) |
||
118 | ->setMethods( ['load'] ) |
||
119 | ->getMock(); |
||
120 | |||
121 | \Aimeos\MShop::inject( 'order/base', $stub ); |
||
122 | |||
123 | $stub->expects( $this->once() )->method( 'load' ) |
||
124 | ->will( $this->returnValue( $stub->createItem() ) ); |
||
125 | |||
126 | $object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context ); |
||
127 | $object->load( -1 ); |
||
128 | } |
||
129 | |||
130 | |||
131 | public function testAddDeleteProduct() |
||
132 | { |
||
133 | $basket = $this->object->get(); |
||
134 | $item = \Aimeos\MShop::create( $this->context, 'product' )->findItem( 'CNC' ); |
||
135 | |||
136 | $this->object->addProduct( $item->getId(), 2, 'default', [], [], [], [] ); |
||
137 | $item2 = $this->object->get()->getProduct( 0 ); |
||
138 | $this->object->deleteProduct( 0 ); |
||
139 | |||
140 | $this->assertEquals( 0, count( $basket->getProducts() ) ); |
||
141 | $this->assertEquals( 'CNC', $item2->getProductCode() ); |
||
142 | } |
||
143 | |||
144 | |||
145 | public function testAddProductCustomAttribute() |
||
146 | { |
||
147 | $attributeManager = \Aimeos\MShop::create( $this->context, 'attribute' ); |
||
148 | |||
149 | $search = $attributeManager->createSearch(); |
||
150 | $expr = array( |
||
151 | $search->compare( '==', 'attribute.code', 'custom' ), |
||
152 | $search->compare( '==', 'attribute.type', 'date' ), |
||
153 | ); |
||
154 | $search->setConditions( $search->combine( '&&', $expr ) ); |
||
155 | |||
156 | $attributes = $attributeManager->searchItems( $search ); |
||
157 | |||
158 | if( ( $attrItem = reset( $attributes ) ) === false ) { |
||
159 | throw new \RuntimeException( 'Attribute not found' ); |
||
160 | } |
||
161 | |||
162 | $attrValues = array( $attrItem->getId() => '2000-01-01' ); |
||
163 | |||
164 | $this->object->addProduct( self::$testItem->getId(), 1, 'default', [], [], [], $attrValues ); |
||
165 | $basket = $this->object->get(); |
||
166 | |||
167 | $this->assertEquals( 1, count( $basket->getProducts() ) ); |
||
168 | $this->assertEquals( '2000-01-01', $basket->getProduct( 0 )->getAttribute( 'date', 'custom' ) ); |
||
169 | } |
||
170 | |||
171 | |||
172 | public function testAddProductCustomPrice() |
||
173 | { |
||
174 | $attributeManager = \Aimeos\MShop::create( $this->context, 'attribute' ); |
||
175 | |||
176 | $search = $attributeManager->createSearch(); |
||
177 | $expr = array( |
||
178 | $search->compare( '==', 'attribute.code', 'custom' ), |
||
179 | $search->compare( '==', 'attribute.type', 'price' ), |
||
180 | ); |
||
181 | $search->setConditions( $search->combine( '&&', $expr ) ); |
||
182 | |||
183 | $attributes = $attributeManager->searchItems( $search ); |
||
184 | |||
185 | if( ( $attrItem = reset( $attributes ) ) === false ) { |
||
186 | throw new \RuntimeException( 'Attribute not found' ); |
||
187 | } |
||
188 | |||
189 | $attrValues = array( $attrItem->getId() => '0.01' ); |
||
190 | |||
191 | $this->object->addProduct( self::$testItem->getId(), 1, 'default', [], [], [], $attrValues ); |
||
192 | $basket = $this->object->get(); |
||
193 | |||
194 | $this->assertEquals( 1, count( $basket->getProducts() ) ); |
||
195 | $this->assertEquals( '0.01', $basket->getProduct( 0 )->getPrice()->getValue() ); |
||
196 | } |
||
197 | |||
198 | |||
199 | public function testAddProductCustomPriceException() |
||
200 | { |
||
201 | $attributeManager = \Aimeos\MShop::create( $this->context, 'attribute' ); |
||
202 | |||
203 | $search = $attributeManager->createSearch(); |
||
204 | $expr = array( |
||
205 | $search->compare( '==', 'attribute.code', 'custom' ), |
||
206 | $search->compare( '==', 'attribute.type', 'price' ), |
||
207 | ); |
||
208 | $search->setConditions( $search->combine( '&&', $expr ) ); |
||
209 | |||
210 | $attributes = $attributeManager->searchItems( $search ); |
||
211 | |||
212 | if( ( $attrItem = reset( $attributes ) ) === false ) { |
||
213 | throw new \RuntimeException( 'Attribute not found' ); |
||
214 | } |
||
215 | |||
216 | $attrValues = array( $attrItem->getId() => ',' ); |
||
217 | |||
218 | $this->setExpectedException( \Aimeos\Controller\Frontend\Basket\Exception::class ); |
||
219 | $this->object->addProduct( self::$testItem->getId(), 1, 'default', [], [], [], $attrValues ); |
||
220 | } |
||
221 | |||
222 | |||
223 | public function testAddProductAttributePrice() |
||
224 | { |
||
225 | $attributeManager = \Aimeos\MShop::create( $this->context, 'attribute' ); |
||
226 | |||
227 | $search = $attributeManager->createSearch(); |
||
228 | $expr = array( |
||
229 | $search->compare( '==', 'attribute.code', 'xs' ), |
||
230 | $search->compare( '==', 'attribute.type', 'size' ), |
||
231 | ); |
||
232 | $search->setConditions( $search->combine( '&&', $expr ) ); |
||
233 | |||
234 | $attributes = $attributeManager->searchItems( $search ); |
||
235 | |||
236 | if( ( $attribute = reset( $attributes ) ) === false ) { |
||
237 | throw new \RuntimeException( 'Attribute not found' ); |
||
238 | } |
||
239 | |||
240 | $this->object->addProduct( self::$testItem->getId(), 1, 'default', [], [$attribute->getId() => 2] ); |
||
241 | |||
242 | $this->assertEquals( '43.90', $this->object->get()->getPrice()->getValue() ); |
||
243 | } |
||
244 | |||
245 | |||
246 | public function testAddProductAttributeNotAssigned() |
||
247 | { |
||
248 | $attributeManager = \Aimeos\MShop::create( $this->context, 'attribute' ); |
||
249 | |||
250 | $search = $attributeManager->createSearch(); |
||
251 | $expr = array( |
||
252 | $search->compare( '==', 'attribute.code', '30' ), |
||
253 | $search->compare( '==', 'attribute.type', 'width' ), |
||
254 | ); |
||
255 | $search->setConditions( $search->combine( '&&', $expr ) ); |
||
256 | |||
257 | $attribute = $attributeManager->searchItems( $search ); |
||
258 | |||
259 | if( empty( $attribute ) ) { |
||
260 | throw new \RuntimeException( 'Attribute not found' ); |
||
261 | } |
||
262 | |||
263 | $hiddenAttrIds = array_keys( $attribute ); |
||
264 | $configAttrIds = array_keys( $attribute ); |
||
265 | |||
266 | $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
||
267 | $this->object->addProduct( self::$testItem->getId(), 1, 'default', [], $configAttrIds, $hiddenAttrIds ); |
||
268 | } |
||
269 | |||
270 | |||
271 | public function testAddProductNegativeQuantityException() |
||
272 | { |
||
273 | $this->setExpectedException( '\\Aimeos\\MShop\\Order\\Exception' ); |
||
274 | $this->object->addProduct( self::$testItem->getId(), -1 ); |
||
275 | } |
||
276 | |||
277 | |||
278 | public function testAddProductNoPriceException() |
||
279 | { |
||
280 | $item = \Aimeos\MShop::create( $this->context, 'product' )->findItem( 'MNOP' ); |
||
281 | |||
282 | $this->setExpectedException( '\\Aimeos\\MShop\\Price\\Exception' ); |
||
283 | $this->object->addProduct( $item->getId(), 1 ); |
||
284 | } |
||
285 | |||
286 | |||
287 | public function testAddProductConfigAttributeException() |
||
291 | } |
||
292 | |||
293 | |||
294 | public function testAddProductLowQuantityPriceException() |
||
295 | { |
||
296 | $item = \Aimeos\MShop::create( $this->context, 'product' )->findItem( 'IJKL' ); |
||
297 | |||
298 | $this->setExpectedException( '\\Aimeos\\MShop\\Price\\Exception' ); |
||
299 | $this->object->addProduct( $item->getId(), 1 ); |
||
300 | } |
||
301 | |||
302 | |||
303 | public function testAddProductHigherQuantities() |
||
304 | { |
||
305 | $item = \Aimeos\MShop::create( $this->context, 'product' )->findItem( 'IJKL' ); |
||
306 | |||
307 | $this->object->addProduct( $item->getId(), 2, 'default', [], [], [], [], 'unit_type3' ); |
||
308 | |||
309 | $this->assertEquals( 2, $this->object->get()->getProduct( 0 )->getQuantity() ); |
||
310 | $this->assertEquals( 'IJKL', $this->object->get()->getProduct( 0 )->getProductCode() ); |
||
311 | } |
||
312 | |||
313 | |||
314 | public function testDeleteProductFlagError() |
||
315 | { |
||
316 | $this->object->addProduct( self::$testItem->getId(), 2 ); |
||
317 | |||
318 | $item = $this->object->get()->getProduct( 0 ); |
||
319 | $item->setFlags( \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ); |
||
320 | |||
321 | $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
||
322 | $this->object->deleteProduct( 0 ); |
||
323 | } |
||
324 | |||
325 | |||
326 | public function testEditProduct() |
||
327 | { |
||
328 | $this->object->addProduct( self::$testItem->getId(), 1 ); |
||
329 | |||
330 | $item = $this->object->get()->getProduct( 0 ); |
||
331 | $this->assertEquals( 1, $item->getQuantity() ); |
||
332 | |||
333 | $this->object->editProduct( 0, 4 ); |
||
334 | |||
335 | $item = $this->object->get()->getProduct( 0 ); |
||
336 | $this->assertEquals( 4, $item->getQuantity() ); |
||
337 | $this->assertEquals( 'U:TESTP', $item->getProductCode() ); |
||
338 | } |
||
339 | |||
340 | |||
341 | public function testEditProductAttributes() |
||
342 | { |
||
343 | $configAttrIds = []; |
||
344 | $attributeManager = \Aimeos\MShop::create( $this->context, 'attribute' ); |
||
345 | |||
346 | $search = $attributeManager->createSearch(); |
||
347 | $conditions = array( |
||
348 | $search->compare( '==', 'attribute.domain', 'product' ), |
||
349 | $search->combine( '||', array( |
||
350 | $search->combine( '&&', array( |
||
351 | $search->compare( '==', 'attribute.code', 'xs' ), |
||
352 | $search->compare( '==', 'attribute.type', 'size' ), |
||
353 | ) ), |
||
354 | $search->combine( '&&', array( |
||
355 | $search->compare( '==', 'attribute.code', 'white' ), |
||
356 | $search->compare( '==', 'attribute.type', 'color' ), |
||
357 | ) ), |
||
358 | ) ) |
||
359 | ); |
||
360 | $search->setConditions( $search->combine( '&&', $conditions ) ); |
||
361 | $attributes = $attributeManager->searchItems( $search ); |
||
362 | |||
363 | if( empty( $attributes ) ) { |
||
364 | throw new \RuntimeException( 'No attributes available' ); |
||
365 | } |
||
366 | |||
367 | foreach( $attributes as $id => $attribute ) { |
||
368 | $configAttrIds[$id] = 1; |
||
369 | } |
||
370 | |||
371 | $item = \Aimeos\MShop::create( $this->context, 'product' )->findItem( 'U:TESTP' ); |
||
372 | |||
373 | $this->object->addProduct( $item->getId(), 1, 'default', [], $configAttrIds ); |
||
374 | $this->object->editProduct( 0, 4 ); |
||
375 | |||
376 | $item = $this->object->get()->getProduct( 0 ); |
||
377 | $this->assertEquals( 3, count( $item->getAttributeItems() ) ); |
||
378 | $this->assertEquals( 4, $item->getQuantity() ); |
||
379 | |||
380 | |||
381 | $this->object->editProduct( 0, 3, array( reset( $attributes )->getType() ) ); |
||
382 | |||
383 | $item = $this->object->get()->getProduct( 0 ); |
||
384 | $this->assertEquals( 3, $item->getQuantity() ); |
||
385 | $this->assertEquals( 2, count( $item->getAttributeItems() ) ); |
||
386 | $this->assertEquals( 'U:TESTP', $item->getProductCode() ); |
||
387 | } |
||
388 | |||
389 | |||
390 | public function testEditProductFlagError() |
||
391 | { |
||
392 | $this->object->addProduct( self::$testItem->getId(), 2 ); |
||
393 | |||
394 | $item = $this->object->get()->getProduct( 0 ); |
||
395 | $item->setFlags( \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ); |
||
396 | |||
397 | $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
||
398 | $this->object->editProduct( 0, 4 ); |
||
399 | } |
||
400 | |||
401 | |||
402 | public function testAddCoupon() |
||
403 | { |
||
404 | $this->object->addProduct( self::$testItem->getId(), 2 ); |
||
405 | $this->object->addCoupon( 'GHIJ' ); |
||
406 | |||
407 | $basket = $this->object->get(); |
||
408 | |||
409 | $this->assertEquals( 1, count( $basket->getCoupons() ) ); |
||
410 | } |
||
411 | |||
412 | |||
413 | public function testAddCouponExceedCount() |
||
414 | { |
||
415 | $this->object->addProduct( self::$testItem->getId(), 2 ); |
||
416 | $this->object->addCoupon( 'GHIJ' ); |
||
417 | |||
418 | $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
||
419 | $this->object->addCoupon( 'GHIJ' ); |
||
420 | } |
||
421 | |||
422 | |||
423 | public function testAddCouponInvalidCode() |
||
427 | } |
||
428 | |||
429 | |||
430 | public function testDeleteCoupon() |
||
431 | { |
||
432 | $this->object->addProduct( self::$testItem->getId(), 2 ); |
||
433 | $this->object->addCoupon( '90AB' ); |
||
434 | $this->object->deleteCoupon( '90AB' ); |
||
435 | |||
436 | $basket = $this->object->get(); |
||
437 | |||
438 | $this->assertEquals( 0, count( $basket->getCoupons() ) ); |
||
439 | } |
||
440 | |||
441 | |||
442 | public function testSetAddressDelete() |
||
443 | { |
||
444 | $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, null ); |
||
445 | |||
446 | $this->setExpectedException( \Aimeos\MShop\Order\Exception::class ); |
||
447 | $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
||
448 | } |
||
449 | |||
450 | |||
451 | public function testSetBillingAddressByItem() |
||
452 | { |
||
453 | $item = $this->getAddress( 'Example company' ); |
||
454 | |||
455 | $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $item ); |
||
456 | |||
457 | $address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
||
458 | $this->assertEquals( 'Example company', $address->getCompany() ); |
||
459 | } |
||
460 | |||
461 | |||
462 | public function testSetBillingAddressByArray() |
||
463 | { |
||
464 | $fixture = array( |
||
465 | 'order.base.address.company' => '<p onclick="javascript: alert(\'gotcha\');">Example company</p>', |
||
466 | 'order.base.address.vatid' => 'DE999999999', |
||
467 | 'order.base.address.title' => '<br/>Dr.', |
||
468 | 'order.base.address.salutation' => \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR, |
||
469 | 'order.base.address.firstname' => 'firstunit', |
||
470 | 'order.base.address.lastname' => 'lastunit', |
||
471 | 'order.base.address.address1' => 'unit str.', |
||
472 | 'order.base.address.address2' => ' 166', |
||
473 | 'order.base.address.address3' => '4.OG', |
||
474 | 'order.base.address.postal' => '22769', |
||
475 | 'order.base.address.city' => 'Hamburg', |
||
476 | 'order.base.address.state' => 'Hamburg', |
||
477 | 'order.base.address.countryid' => 'de', |
||
478 | 'order.base.address.languageid' => 'de', |
||
479 | 'order.base.address.telephone' => '05554433221', |
||
480 | 'order.base.address.email' => '[email protected]', |
||
481 | 'order.base.address.telefax' => '05554433222', |
||
482 | 'order.base.address.website' => 'www.example.com', |
||
483 | ); |
||
484 | |||
485 | $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, $fixture ); |
||
486 | |||
487 | $address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
||
488 | $this->assertEquals( 'Example company', $address->getCompany() ); |
||
489 | $this->assertEquals( 'Dr.', $address->getTitle() ); |
||
490 | $this->assertEquals( 'firstunit', $address->getFirstname() ); |
||
491 | } |
||
492 | |||
493 | |||
494 | public function testSetBillingAddressByArrayError() |
||
498 | } |
||
499 | |||
500 | |||
501 | public function testSetBillingAddressParameterError() |
||
502 | { |
||
503 | $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
||
504 | $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT, 'error' ); |
||
505 | } |
||
506 | |||
507 | |||
508 | public function testSetDeliveryAddressByItem() |
||
509 | { |
||
510 | $item = $this->getAddress( 'Example company' ); |
||
511 | |||
512 | $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $item ); |
||
513 | |||
514 | $address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY ); |
||
515 | $this->assertEquals( 'Example company', $address->getCompany() ); |
||
516 | } |
||
517 | |||
518 | |||
519 | public function testSetDeliveryAddressByArray() |
||
520 | { |
||
521 | $fixture = array( |
||
522 | 'order.base.address.company' => '<p onclick="javascript: alert(\'gotcha\');">Example company</p>', |
||
523 | 'order.base.address.vatid' => 'DE999999999', |
||
524 | 'order.base.address.title' => '<br/>Dr.', |
||
525 | 'order.base.address.salutation' => \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR, |
||
526 | 'order.base.address.firstname' => 'firstunit', |
||
527 | 'order.base.address.lastname' => 'lastunit', |
||
528 | 'order.base.address.address1' => 'unit str.', |
||
529 | 'order.base.address.address2' => ' 166', |
||
530 | 'order.base.address.address3' => '4.OG', |
||
531 | 'order.base.address.postal' => '22769', |
||
532 | 'order.base.address.city' => 'Hamburg', |
||
533 | 'order.base.address.state' => 'Hamburg', |
||
534 | 'order.base.address.countryid' => 'de', |
||
535 | 'order.base.address.languageid' => 'de', |
||
536 | 'order.base.address.telephone' => '05554433221', |
||
537 | 'order.base.address.email' => '[email protected]', |
||
538 | 'order.base.address.telefax' => '05554433222', |
||
539 | 'order.base.address.website' => 'www.example.com', |
||
540 | ); |
||
541 | $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, $fixture ); |
||
542 | |||
543 | $address = $this->object->get()->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY ); |
||
544 | $this->assertEquals( 'Example company', $address->getCompany() ); |
||
545 | $this->assertEquals( 'Dr.', $address->getTitle() ); |
||
546 | $this->assertEquals( 'firstunit', $address->getFirstname() ); |
||
547 | } |
||
548 | |||
549 | |||
550 | public function testSetDeliveryAddressByArrayError() |
||
551 | { |
||
552 | $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
||
553 | $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, array( 'error' => false ) ); |
||
554 | } |
||
555 | |||
556 | |||
557 | public function testSetDeliveryAddressTypeError() |
||
558 | { |
||
559 | $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
||
560 | $this->object->setAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY, 'error' ); |
||
561 | } |
||
562 | |||
563 | |||
564 | public function testSetServicePayment() |
||
565 | { |
||
566 | $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
||
567 | $service = $manager->findItem( 'unitpaymentcode', [], 'service', 'payment' ); |
||
568 | |||
569 | $this->object->addService( 'payment', $service->getId(), [] ); |
||
570 | $item = $this->object->get()->getService( 'payment', 'unitpaymentcode' )->getCode(); |
||
571 | $this->assertEquals( 'unitpaymentcode', $item ); |
||
572 | |||
573 | $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
||
574 | $this->object->addService( 'payment', $service->getId(), array( 'prepay' => true ) ); |
||
575 | } |
||
576 | |||
577 | |||
578 | public function testSetDeliveryOption() |
||
579 | { |
||
580 | $manager = \Aimeos\MShop::create( $this->context, 'service' ); |
||
581 | $service = $manager->findItem( 'unitcode', [], 'service', 'delivery' ); |
||
582 | |||
583 | $this->object->addService( 'delivery', $service->getId(), [] ); |
||
584 | $item = $this->object->get()->getService( 'delivery', 'unitcode' ); |
||
585 | $this->assertEquals( 'unitcode', $item->getCode() ); |
||
586 | |||
587 | $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
||
588 | $this->object->addService( 'delivery', $service->getId(), array( 'fast shipping' => true, 'air shipping' => false ) ); |
||
589 | } |
||
590 | |||
591 | |||
592 | public function testCheckLocale() |
||
639 | } |
||
640 | |||
641 | |||
642 | /** |
||
643 | * @param string $company |
||
644 | */ |
||
645 | protected function getAddress( $company ) |
||
659 | } |
||
660 | } |
||
661 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths