Completed
Branch master (136162)
by Aimeos
06:57
created

CatalogControllerTest::testTreeAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 8
rs 10
c 3
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
class CatalogControllerTest extends AimeosTestAbstract
4
{
5
	public function setUp()
6
	{
7
		parent::setUp();
8
		View::addLocation(dirname(__DIR__).'/fixtures/views');
9
	}
10
11
12
	public function testCountAction()
13
	{
14
		$response = $this->action('GET', '\Aimeos\Shop\Controller\CatalogController@countAction', ['site' => 'unittest']);
15
16
		$this->assertResponseOk();
17
		$this->assertContains('.catalog-filter-count', $response->getContent());
18
		$this->assertContains('.catalog-filter-attribute', $response->getContent());
19
	}
20
21
22
	public function testDetailAction()
23
	{
24
		$response = $this->action('GET', '\Aimeos\Shop\Controller\CatalogController@detailAction', ['site' => 'unittest']);
25
26
		$this->assertResponseOk();
27
		$this->assertContains('<section class="aimeos catalog-stage"', $response->getContent());
28
		$this->assertContains('<section class="aimeos catalog-detail"', $response->getContent());
29
		$this->assertContains('<section class="aimeos catalog-session"', $response->getContent());
30
	}
31
32
33
	public function testListAction()
34
	{
35
		$response = $this->action('GET', '\Aimeos\Shop\Controller\CatalogController@listAction', ['site' => 'unittest']);
36
37
		$this->assertResponseOk();
38
		$this->assertContains('<section class="aimeos catalog-filter"', $response->getContent());
39
		$this->assertContains('<section class="aimeos catalog-list"', $response->getContent());
40
	}
41
42
43
	public function testStockAction()
44
	{
45
		$response = $this->action('GET', '\Aimeos\Shop\Controller\CatalogController@stockAction', ['site' => 'unittest']);
46
47
		$this->assertResponseOk();
48
		$this->assertContains('.aimeos .product .stock', $response->getContent());
49
	}
50
51
52
	public function testSuggestAction()
53
	{
54
		$response = $this->action('GET', '\Aimeos\Shop\Controller\CatalogController@suggestAction', ['site' => 'unittest'], ['f_search' => 'Cafe']);
55
56
		$this->assertResponseOk();
57
		$this->assertRegexp('/[{.*}]/', $response->getContent());
58
	}
59
60
61
	public function testTreeAction()
62
	{
63
		$response = $this->action('GET', '\Aimeos\Shop\Controller\CatalogController@treeAction', ['site' => 'unittest', 'f_catid' => 1, 'f_name' => 'test']);
64
65
		$this->assertResponseOk();
66
		$this->assertContains('<section class="aimeos catalog-filter', $response->getContent());
67
		$this->assertContains('<section class="aimeos catalog-stage', $response->getContent());
68
		$this->assertContains('<section class="aimeos catalog-list', $response->getContent());
69
	}
70
}