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->assertStringStartsWith( '{"', $response->getContent() ); |
||
13 | } |
||
14 | |||
15 | |||
16 | public function testDetailAction() |
||
17 | { |
||
18 | View::addLocation( dirname( __DIR__ ) . '/fixtures/views' ); |
||
19 | |||
20 | $response = $this->action( 'GET', '\Aimeos\Shop\Controller\CatalogController@detailAction', ['site' => 'unittest', 'd_name' => 'Cafe_Noire_Cappuccino'] ); |
||
21 | |||
22 | $this->assertResponseOk(); |
||
23 | $this->assertStringContainsString( '<div class="section aimeos catalog-stage', $response->getContent() ); |
||
24 | $this->assertStringContainsString( '<div class="aimeos catalog-detail', $response->getContent() ); |
||
25 | } |
||
26 | |||
27 | |||
28 | public function testListAction() |
||
29 | { |
||
30 | View::addLocation( dirname( __DIR__ ) . '/fixtures/views' ); |
||
31 | |||
32 | $response = $this->action( 'GET', '\Aimeos\Shop\Controller\CatalogController@listAction', ['site' => 'unittest'] ); |
||
33 | |||
34 | $this->assertResponseOk(); |
||
35 | $this->assertStringContainsString( '<div class="section aimeos catalog-filter', $response->getContent() ); |
||
36 | $this->assertStringContainsString( '<div class="section aimeos catalog-list', $response->getContent() ); |
||
37 | } |
||
38 | |||
39 | |||
40 | public function testSessionAction() |
||
41 | { |
||
42 | View::addLocation( dirname( __DIR__ ) . '/fixtures/views' ); |
||
43 | |||
44 | $response = $this->action( 'GET', '\Aimeos\Shop\Controller\CatalogController@sessionAction', ['site' => 'unittest'] ); |
||
45 | |||
46 | $this->assertResponseOk(); |
||
47 | $this->assertStringContainsString( '<div class="section aimeos catalog-session', $response->getContent() ); |
||
48 | $this->assertStringContainsString( '<div class="section catalog-session-pinned', $response->getContent() ); |
||
49 | $this->assertStringContainsString( '<div class="section catalog-session-seen', $response->getContent() ); |
||
50 | } |
||
51 | |||
52 | |||
53 | public function testStockAction() |
||
54 | { |
||
55 | View::addLocation( dirname( __DIR__ ) . '/fixtures/views' ); |
||
56 | |||
57 | $response = $this->action( 'GET', '\Aimeos\Shop\Controller\CatalogController@stockAction', ['site' => 'unittest'] ); |
||
58 | |||
59 | $this->assertResponseOk(); |
||
60 | $this->assertStringContainsString( '.aimeos .product .stock', $response->getContent() ); |
||
61 | } |
||
62 | |||
63 | |||
64 | public function testSuggestAction() |
||
65 | { |
||
66 | View::addLocation( dirname( __DIR__ ) . '/fixtures/views' ); |
||
67 | |||
68 | $response = $this->action( 'GET', '\Aimeos\Shop\Controller\CatalogController@suggestAction', ['site' => 'unittest'], ['f_search' => 'Cafe'] ); |
||
69 | |||
70 | $this->assertResponseOk(); |
||
71 | $this->assertMatchesRegularExpression( '/[{.*}]/', $response->getContent() ); |
||
72 | } |
||
73 | |||
74 | |||
75 | public function testTreeAction() |
||
76 | { |
||
77 | $root = \Aimeos\Controller\Frontend::create( app( 'aimeos.context' )->get(), 'catalog' )->getTree( \Aimeos\Controller\Frontend\Catalog\Iface::TREE ); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
78 | |||
79 | View::addLocation( dirname( __DIR__ ) . '/fixtures/views' ); |
||
80 | |||
81 | $response = $this->action( 'GET', '\Aimeos\Shop\Controller\CatalogController@treeAction', ['site' => 'unittest', 'f_catid' => $root->getId(), 'f_name' => 'test'] ); |
||
82 | |||
83 | $this->assertResponseOk(); |
||
84 | $this->assertStringContainsString( '<div class="section aimeos catalog-filter', $response->getContent() ); |
||
85 | $this->assertStringContainsString( '<div class="section aimeos catalog-list', $response->getContent() ); |
||
86 | } |
||
87 | } |