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
|
|
|
|