Completed
Push — master ( 6b2914...49adce )
by Aimeos
06:12
created

StandardTest::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Aimeos\Controller\Common\Product\Import\Csv\Cache\Stocktype;
4
5
6
/**
7
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
8
 * @copyright Aimeos (aimeos.org), 2015
9
 */
10
class StandardTest extends \PHPUnit_Framework_TestCase
11
{
12
	private $object;
13
14
15
	protected function setUp()
16
	{
17
		\Aimeos\MShop\Factory::setCache( true );
18
19
		$context = \TestHelperCntl::getContext();
20
		$this->object = new \Aimeos\Controller\Common\Product\Import\Csv\Cache\Stocktype\Standard( $context );
21
	}
22
23
24
	protected function tearDown()
25
	{
26
		\Aimeos\MShop\Factory::setCache( false );
27
		\Aimeos\MShop\Factory::clear();
28
	}
29
30
31
	public function testGet()
32
	{
33
		$result = $this->object->get( 'default' );
34
35
		$this->assertNotEquals( null, $result );
36
	}
37
38
39
	public function testGetUnknown()
40
	{
41
		$this->assertEquals( null, $this->object->get( 'cache-test' ) );
42
	}
43
44
45
	public function testSet()
46
	{
47
		$item = \Aimeos\MShop\Factory::createManager( \TestHelperCntl::getContext(), 'product/stock/type' )->createItem();
48
		$item->setCode( 'cache-test' );
49
		$item->setId( 1 );
50
51
		$this->object->set( $item );
52
		$id = $this->object->get( 'cache-test' );
53
54
		$this->assertEquals( $item->getId(), $id );
55
	}
56
}