@@ 396-410 (lines=15) @@ | ||
393 | } |
|
394 | ||
395 | ||
396 | public function testAddProductNoStockRequired() |
|
397 | { |
|
398 | $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
399 | ||
400 | $search = $productManager->createSearch(); |
|
401 | $search->setConditions( $search->compare( '==', 'product.code', 'IJKL' ) ); |
|
402 | ||
403 | $items = $productManager->searchItems( $search ); |
|
404 | ||
405 | if( ( $item = reset( $items ) ) === false ) { |
|
406 | throw new \Exception( 'Product not found' ); |
|
407 | } |
|
408 | ||
409 | $this->object->addProduct( $item->getId(), 5, array( 'stock' => false ) ); |
|
410 | } |
|
411 | ||
412 | ||
413 | public function testAddProductNoStockItem() |
|
@@ 413-428 (lines=16) @@ | ||
410 | } |
|
411 | ||
412 | ||
413 | public function testAddProductNoStockItem() |
|
414 | { |
|
415 | $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
416 | ||
417 | $search = $productManager->createSearch(); |
|
418 | $search->setConditions( $search->compare( '==', 'product.code', 'QRST' ) ); |
|
419 | ||
420 | $items = $productManager->searchItems( $search ); |
|
421 | ||
422 | if( ( $item = reset( $items ) ) === false ) { |
|
423 | throw new \Exception( 'Product not found' ); |
|
424 | } |
|
425 | ||
426 | $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
427 | $this->object->addProduct( $item->getId(), 1 ); |
|
428 | } |
|
429 | ||
430 | ||
431 | public function testAddProductNoPriceException() |
|
@@ 431-446 (lines=16) @@ | ||
428 | } |
|
429 | ||
430 | ||
431 | public function testAddProductNoPriceException() |
|
432 | { |
|
433 | $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
434 | ||
435 | $search = $productManager->createSearch(); |
|
436 | $search->setConditions( $search->compare( '==', 'product.code', 'MNOP' ) ); |
|
437 | ||
438 | $items = $productManager->searchItems( $search ); |
|
439 | ||
440 | if( ( $item = reset( $items ) ) === false ) { |
|
441 | throw new \Exception( 'Product not found' ); |
|
442 | } |
|
443 | ||
444 | $this->setExpectedException( '\\Aimeos\\MShop\\Price\\Exception' ); |
|
445 | $this->object->addProduct( $item->getId(), 1 ); |
|
446 | } |
|
447 | ||
448 | ||
449 | public function testAddProductConfigAttributeException() |
|
@@ 456-469 (lines=14) @@ | ||
453 | } |
|
454 | ||
455 | ||
456 | public function testAddProductEmptySelectionException() |
|
457 | { |
|
458 | $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
459 | $search = $productManager->createSearch(); |
|
460 | $search->setConditions( $search->compare( '==', 'product.code', 'U:noSel' ) ); |
|
461 | $items = $productManager->searchItems( $search ); |
|
462 | ||
463 | if( ( $item = reset( $items ) ) === false ) { |
|
464 | throw new \Exception( 'Product not found' ); |
|
465 | } |
|
466 | ||
467 | $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Basket\\Exception' ); |
|
468 | $this->object->addProduct( $item->getId(), 1 ); |
|
469 | } |
|
470 | ||
471 | ||
472 | public function testAddProductSelectionWithPricelessItem() |
|
@@ 490-503 (lines=14) @@ | ||
487 | } |
|
488 | ||
489 | ||
490 | public function testAddProductLowQuantityPriceException() |
|
491 | { |
|
492 | $productManager = \Aimeos\MShop\Product\Manager\Factory::createManager( \TestHelperFrontend::getContext() ); |
|
493 | $search = $productManager->createSearch(); |
|
494 | $search->setConditions( $search->compare( '==', 'product.code', 'IJKL' ) ); |
|
495 | $items = $productManager->searchItems( $search ); |
|
496 | ||
497 | if( ( $item = reset( $items ) ) === false ) { |
|
498 | throw new \Exception( 'Product not found' ); |
|
499 | } |
|
500 | ||
501 | $this->setExpectedException( '\\Aimeos\\MShop\\Price\\Exception' ); |
|
502 | $this->object->addProduct( $item->getId(), 1 ); |
|
503 | } |
|
504 | ||
505 | ||
506 | public function testAddProductHigherQuantities() |