Completed
Push — master ( 67d8e7...5e2903 )
by Aimeos
02:46
created

StandardTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 7
lcom 1
cbo 4
dl 0
loc 51
rs 10
c 2
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A tearDown() 0 4 1
A testCreateFilter() 0 6 1
A testGetPath() 0 11 2
A testGetTree() 0 10 2
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Metaways Infosystems GmbH, 2012
6
 * @copyright Aimeos (aimeos.org), 2015-2017
7
 */
8
9
10
namespace Aimeos\Controller\Frontend\Catalog;
11
12
13
class StandardTest extends \PHPUnit\Framework\TestCase
14
{
15
	private $context;
16
	private $object;
17
18
19
	protected function setUp()
20
	{
21
		$this->context = \TestHelperFrontend::getContext();
22
		$this->object = new \Aimeos\Controller\Frontend\Catalog\Standard( $this->context );
23
	}
24
25
26
	protected function tearDown()
27
	{
28
		unset( $this->object, $this->context );
29
	}
30
31
32
	public function testCreateFilter()
33
	{
34
		$filter = $this->object->createFilter();
35
36
		$this->assertInstanceOf( '\\Aimeos\\MW\\Criteria\\Iface', $filter );
37
	}
38
39
40
	public function testGetPath()
41
	{
42
		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'catalog' );
43
		$items = $this->object->getPath( $manager->findItem( 'cafe' )->getId() );
44
45
		$this->assertEquals( 3, count( $items ) );
46
47
		foreach( $items as $item ) {
48
			$this->assertInstanceOf( '\\Aimeos\\MShop\\Catalog\\Item\\Iface', $item );
49
		}
50
	}
51
52
53
	public function testGetTree()
54
	{
55
		$tree = $this->object->getTree();
56
57
		$this->assertEquals( 2, count( $tree->getChildren() ) );
58
59
		foreach( $tree->getChildren() as $item ) {
60
			$this->assertInstanceOf( '\\Aimeos\\MShop\\Catalog\\Item\\Iface', $item );
61
		}
62
	}
63
}
64