1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
class JqadmControllerTest extends AimeosTestAbstract |
4
|
|
|
{ |
5
|
|
|
public function testFileActionCss() |
6
|
|
|
{ |
7
|
|
|
View::addLocation(dirname(__DIR__).'/fixtures/views'); |
8
|
|
|
|
9
|
|
|
$response = $this->action('GET', '\Aimeos\Shop\Controller\JqadmController@fileAction', ['site' => 'unittest', 'type' => 'css']); |
10
|
|
|
|
11
|
|
|
$this->assertResponseOk(); |
12
|
|
|
$this->assertContains('.aimeos', $response->getContent()); |
13
|
|
|
} |
14
|
|
|
|
15
|
|
|
|
16
|
|
|
public function testFileActionJs() |
17
|
|
|
{ |
18
|
|
|
View::addLocation(dirname(__DIR__).'/fixtures/views'); |
19
|
|
|
|
20
|
|
|
$response = $this->action('GET', '\Aimeos\Shop\Controller\JqadmController@fileAction', ['site' => 'unittest', 'type' => 'js']); |
21
|
|
|
|
22
|
|
|
$this->assertResponseOk(); |
23
|
|
|
$this->assertContains('Aimeos = {', $response->getContent()); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
|
27
|
|
|
public function testCopyAction() |
28
|
|
|
{ |
29
|
|
|
View::addLocation(dirname(__DIR__).'/fixtures/views'); |
30
|
|
|
|
31
|
|
|
$params = ['site' => 'unittest', 'resource' => 'product', 'id' => '0']; |
32
|
|
|
$response = $this->action('GET', '\Aimeos\Shop\Controller\JqadmController@copyAction', $params); |
33
|
|
|
|
34
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
35
|
|
|
$this->assertContains( 'item-product', $response->getContent() ); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
|
39
|
|
|
public function testCreateAction() |
40
|
|
|
{ |
41
|
|
|
View::addLocation(dirname(__DIR__).'/fixtures/views'); |
42
|
|
|
|
43
|
|
|
$params = ['site' => 'unittest', 'resource' => 'product']; |
44
|
|
|
$response = $this->action('GET', '\Aimeos\Shop\Controller\JqadmController@createAction', $params); |
45
|
|
|
|
46
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
47
|
|
|
$this->assertContains( 'item-product', $response->getContent() ); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
|
51
|
|
|
public function testDeleteAction() |
52
|
|
|
{ |
53
|
|
|
View::addLocation(dirname(__DIR__).'/fixtures/views'); |
54
|
|
|
|
55
|
|
|
$params = ['site' => 'unittest', 'resource' => 'product', 'id' => '0']; |
56
|
|
|
$response = $this->action('GET', '\Aimeos\Shop\Controller\JqadmController@deleteAction', $params); |
57
|
|
|
|
58
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
59
|
|
|
$this->assertContains( 'list-items', $response->getContent() ); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
|
63
|
|
|
public function testExportAction() |
64
|
|
|
{ |
65
|
|
|
View::addLocation(dirname(__DIR__).'/fixtures/views'); |
66
|
|
|
|
67
|
|
|
$params = ['site' => 'unittest', 'resource' => 'order']; |
68
|
|
|
$response = $this->action('GET', '\Aimeos\Shop\Controller\JqadmController@exportAction', $params); |
69
|
|
|
|
70
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
71
|
|
|
$this->assertContains( 'list-items', $response->getContent() ); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
|
75
|
|
|
public function testGetAction() |
76
|
|
|
{ |
77
|
|
|
View::addLocation(dirname(__DIR__).'/fixtures/views'); |
78
|
|
|
|
79
|
|
|
$params = ['site' => 'unittest', 'resource' => 'product', 'id' => '0']; |
80
|
|
|
$response = $this->action('GET', '\Aimeos\Shop\Controller\JqadmController@getAction', $params); |
81
|
|
|
|
82
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
83
|
|
|
$this->assertContains( 'item-product', $response->getContent() ); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
|
87
|
|
|
public function testSaveAction() |
88
|
|
|
{ |
89
|
|
|
View::addLocation(dirname(__DIR__).'/fixtures/views'); |
90
|
|
|
|
91
|
|
|
$params = ['site' => 'unittest', 'resource' => 'product', 'id' => '0']; |
92
|
|
|
$response = $this->action('POST', '\Aimeos\Shop\Controller\JqadmController@saveAction', $params); |
93
|
|
|
|
94
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
95
|
|
|
$this->assertContains( 'item-product', $response->getContent() ); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
|
99
|
|
|
public function testSearchAction() |
100
|
|
|
{ |
101
|
|
|
View::addLocation(dirname(__DIR__).'/fixtures/views'); |
102
|
|
|
|
103
|
|
|
$params = ['site' => 'unittest', 'resource' => 'product']; |
104
|
|
|
$response = $this->action('GET', '\Aimeos\Shop\Controller\JqadmController@searchAction', $params); |
105
|
|
|
|
106
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
107
|
|
|
$this->assertContains( 'list-items', $response->getContent() ); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
|
111
|
|
|
public function testSearchActionSite() |
112
|
|
|
{ |
113
|
|
|
View::addLocation(dirname(__DIR__).'/fixtures/views'); |
114
|
|
|
|
115
|
|
|
$params = ['site' => 'invalid', 'resource' => 'product']; |
116
|
|
|
$response = $this->action('GET', '\Aimeos\Shop\Controller\JqadmController@searchAction', $params); |
117
|
|
|
|
118
|
|
|
$this->assertEquals( 500, $response->getStatusCode() ); |
119
|
|
|
} |
120
|
|
|
} |
121
|
|
|
|