Passed
Push — master ( 921d79...2a6d51 )
by Aimeos
17:12 queued 12s
created

tests/Controller/CatalogControllerTest.php (1 issue)

Labels
Severity
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\CatalogController@countAction', ['site' => 'unittest'] );
10
11
		$this->assertResponseOk();
12
		$this->assertStringContainsString( '.catalog-filter-count', $response->getContent() );
13
		$this->assertStringContainsString( '.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\CatalogController@detailAction', ['site' => 'unittest', 'd_name' => 'Cafe_Noire_Cappuccino'] );
22
23
		$this->assertResponseOk();
24
		$this->assertStringContainsString( '<div class="section aimeos catalog-stage', $response->getContent() );
25
		$this->assertStringContainsString( '<div class="aimeos catalog-detail', $response->getContent() );
26
	}
27
28
29
	public function testListAction()
30
	{
31
		View::addLocation( dirname( __DIR__ ) . '/fixtures/views' );
32
33
		$response = $this->action( 'GET', '\Aimeos\Shop\Controller\CatalogController@listAction', ['site' => 'unittest'] );
34
35
		$this->assertResponseOk();
36
		$this->assertStringContainsString( '<div class="section aimeos catalog-filter', $response->getContent() );
37
		$this->assertStringContainsString( '<div class="section aimeos catalog-list', $response->getContent() );
38
	}
39
40
41
	public function testSessionAction()
42
	{
43
		View::addLocation( dirname( __DIR__ ) . '/fixtures/views' );
44
45
		$response = $this->action( 'GET', '\Aimeos\Shop\Controller\CatalogController@sessionAction', ['site' => 'unittest'] );
46
47
		$this->assertResponseOk();
48
		$this->assertStringContainsString( '<div class="section aimeos catalog-session', $response->getContent() );
49
		$this->assertStringContainsString( '<div class="section catalog-session-pinned', $response->getContent() );
50
		$this->assertStringContainsString( '<div class="section catalog-session-seen', $response->getContent() );
51
	}
52
53
54
	public function testStockAction()
55
	{
56
		View::addLocation( dirname( __DIR__ ) . '/fixtures/views' );
57
58
		$response = $this->action( 'GET', '\Aimeos\Shop\Controller\CatalogController@stockAction', ['site' => 'unittest'] );
59
60
		$this->assertResponseOk();
61
		$this->assertStringContainsString( '.aimeos .product .stock', $response->getContent() );
62
	}
63
64
65
	public function testSuggestAction()
66
	{
67
		View::addLocation( dirname( __DIR__ ) . '/fixtures/views' );
68
69
		$response = $this->action( 'GET', '\Aimeos\Shop\Controller\CatalogController@suggestAction', ['site' => 'unittest'], ['f_search' => 'Cafe'] );
70
71
		$this->assertResponseOk();
72
		$this->assertRegexp( '/[{.*}]/', $response->getContent() );
73
	}
74
75
76
	public function testTreeAction()
77
	{
78
		$root = \Aimeos\Controller\Frontend::create( app( 'aimeos.context' )->get(), 'catalog' )->getTree( \Aimeos\Controller\Frontend\Catalog\Iface::TREE );
0 ignored issues
show
The method getTree() does not exist on Aimeos\Controller\Frontend\Iface. It seems like you code against a sub-type of said class. However, the method does not exist in Aimeos\Controller\Frontend\Common\Iface or Aimeos\Controller\Frontend\Common\Decorator\Iface or Aimeos\Controller\Fronte...ommon\Decorator\Example. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

78
		$root = \Aimeos\Controller\Frontend::create( app( 'aimeos.context' )->get(), 'catalog' )->/** @scrutinizer ignore-call */ getTree( \Aimeos\Controller\Frontend\Catalog\Iface::TREE );
Loading history...
79
80
		View::addLocation( dirname( __DIR__ ) . '/fixtures/views' );
81
82
		$response = $this->action( 'GET', '\Aimeos\Shop\Controller\CatalogController@treeAction', ['site' => 'unittest', 'f_catid' => $root->getId(), 'f_name' => 'test'] );
83
84
		$this->assertResponseOk();
85
		$this->assertStringContainsString( '<div class="section aimeos catalog-filter', $response->getContent() );
86
		$this->assertStringContainsString( '<div class="section aimeos catalog-list', $response->getContent() );
87
	}
88
}