Completed
Push — master ( b46c0d...fe698d )
by Aimeos
06:27
created

BundleTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Aimeos\Controller\Frontend\Basket\Decorator;
4
5
6
class BundleTest extends \PHPUnit_Framework_TestCase
7
{
8
	private $object;
9
	private $context;
10
11
12
	protected function setUp()
13
	{
14
		$this->context = \TestHelperFrontend::getContext();
15
		$object = new \Aimeos\Controller\Frontend\Basket\Standard( $this->context );
16
		$this->object = new \Aimeos\Controller\Frontend\Basket\Decorator\Bundle( $object, $this->context );
17
	}
18
19
20
	protected function tearDown()
21
	{
22
		$this->object->clear();
23
		$this->context->getSession()->set( 'aimeos', array() );
24
25
		unset( $this->object );
26
	}
27
28
29
	public function testAddProductBundle()
30
	{
31
		$item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'U:BUNDLE' );
32
33
		$this->object->addProduct( $item->getId(), 1 );
34
35
		$this->assertEquals( 1, count( $this->object->get()->getProducts() ) );
36
		$this->assertEquals( 'U:BUNDLE', $this->object->get()->getProduct( 0 )->getProductCode() );
37
		$this->assertEquals( 2, count( $this->object->get()->getProduct( 0 )->getProducts() ) );
38
	}
39
}
40