CatalogControllerTest   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 6
eloc 31
c 3
b 0
f 0
dl 0
loc 71
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testSuggestAction() 0 8 1
A testCountAction() 0 9 1
A testStockAction() 0 8 1
A testDetailAction() 0 10 1
A testListAction() 0 9 1
A testTreeAction() 0 10 1
1
<?php
2
3
class CatalogControllerTest extends AimeosTestAbstract
4
{
5
	public function testCountAction()
6
	{
7
		View::addLocation(dirname(__DIR__).'/fixtures/views');
8
9
		$response = $this->action('GET', '\Aimeos\Shop\Controller\[email protected]', ['site' => 'unittest']);
10
11
		$this->assertResponseOk();
12
		$this->assertContains('.catalog-filter-count', $response->getContent());
13
		$this->assertContains('.catalog-filter-attribute', $response->getContent());
14
	}
15
16
17
	public function testDetailAction()
18
	{
19
		View::addLocation(dirname(__DIR__).'/fixtures/views');
20
21
		$response = $this->action('GET', '\Aimeos\Shop\Controller\[email protected]', ['site' => 'unittest', 'd_name' => 'Cafe_Noire_Cappuccino']);
22
23
		$this->assertResponseOk();
24
		$this->assertContains('<section class="aimeos catalog-stage"', $response->getContent());
25
		$this->assertContains('<section class="aimeos catalog-detail"', $response->getContent());
26
		$this->assertContains('<section class="aimeos catalog-session"', $response->getContent());
27
	}
28
29
30
	public function testListAction()
31
	{
32
		View::addLocation(dirname(__DIR__).'/fixtures/views');
33
34
		$response = $this->action('GET', '\Aimeos\Shop\Controller\[email protected]', ['site' => 'unittest']);
35
36
		$this->assertResponseOk();
37
		$this->assertContains('<section class="aimeos catalog-filter"', $response->getContent());
38
		$this->assertContains('<section class="aimeos catalog-list"', $response->getContent());
39
	}
40
41
42
	public function testStockAction()
43
	{
44
		View::addLocation(dirname(__DIR__).'/fixtures/views');
45
46
		$response = $this->action('GET', '\Aimeos\Shop\Controller\[email protected]', ['site' => 'unittest']);
47
48
		$this->assertResponseOk();
49
		$this->assertContains('.aimeos .product .stock', $response->getContent());
50
	}
51
52
53
	public function testSuggestAction()
54
	{
55
		View::addLocation(dirname(__DIR__).'/fixtures/views');
56
57
		$response = $this->action('GET', '\Aimeos\Shop\Controller\[email protected]', ['site' => 'unittest'], ['f_search' => 'Cafe']);
58
59
		$this->assertResponseOk();
60
		$this->assertRegexp('/[{.*}]/', $response->getContent());
61
	}
62
63
64
	public function testTreeAction()
65
	{
66
		View::addLocation(dirname(__DIR__).'/fixtures/views');
67
68
		$response = $this->action('GET', '\Aimeos\Shop\Controller\[email protected]', ['site' => 'unittest', 'f_catid' => 1, 'f_name' => 'test']);
69
70
		$this->assertResponseOk();
71
		$this->assertContains('<section class="aimeos catalog-filter', $response->getContent());
72
		$this->assertContains('<section class="aimeos catalog-stage', $response->getContent());
73
		$this->assertContains('<section class="aimeos catalog-list', $response->getContent());
74
	}
75
}