1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Aimeos\ShopBundle\Tests\Controller; |
4
|
|
|
|
5
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
6
|
|
|
|
7
|
|
|
|
8
|
|
|
class JqadmControllerTest extends WebTestCase |
9
|
|
|
{ |
10
|
|
|
public function testFileCss() |
11
|
|
|
{ |
12
|
|
|
$client = static::createClient(array(), array( |
13
|
|
|
'PHP_AUTH_USER' => 'admin', |
14
|
|
|
'PHP_AUTH_PW' => 'adminpass', |
15
|
|
|
) ); |
16
|
|
|
|
17
|
|
|
$client->request( 'GET', '/unittest/jqadm/file/css' ); |
18
|
|
|
|
19
|
|
|
$this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
20
|
|
|
$this->assertContains( '.aimeos', $client->getResponse()->getContent() ); |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
|
24
|
|
|
public function testFileJs() |
25
|
|
|
{ |
26
|
|
|
$client = static::createClient(array(), array( |
27
|
|
|
'PHP_AUTH_USER' => 'admin', |
28
|
|
|
'PHP_AUTH_PW' => 'adminpass', |
29
|
|
|
) ); |
30
|
|
|
|
31
|
|
|
$client->request( 'GET', '/unittest/jqadm/file/js' ); |
32
|
|
|
|
33
|
|
|
$this->assertEquals( 200, $client->getResponse()->getStatusCode() ); |
34
|
|
|
$this->assertContains( 'Aimeos = {', $client->getResponse()->getContent() ); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
|
38
|
|
|
public function testCopyAction() |
39
|
|
|
{ |
40
|
|
|
$client = static::createClient(array(), array( |
41
|
|
|
'PHP_AUTH_USER' => 'admin', |
42
|
|
|
'PHP_AUTH_PW' => 'adminpass', |
43
|
|
|
) ); |
44
|
|
|
|
45
|
|
|
$client->request( 'GET', '/unittest/jqadm/copy/product/0' ); |
46
|
|
|
$response = $client->getResponse(); |
47
|
|
|
|
48
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
49
|
|
|
$this->assertContains( 'item-product', $response->getContent() ); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
|
53
|
|
|
public function testCreateAction() |
54
|
|
|
{ |
55
|
|
|
$client = static::createClient(array(), array( |
56
|
|
|
'PHP_AUTH_USER' => 'admin', |
57
|
|
|
'PHP_AUTH_PW' => 'adminpass', |
58
|
|
|
) ); |
59
|
|
|
|
60
|
|
|
$client->request( 'GET', '/unittest/jqadm/create/product' ); |
61
|
|
|
$response = $client->getResponse(); |
62
|
|
|
|
63
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
64
|
|
|
$this->assertContains( 'item-product', $response->getContent() ); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
public function testDeleteAction() |
69
|
|
|
{ |
70
|
|
|
$client = static::createClient(array(), array( |
71
|
|
|
'PHP_AUTH_USER' => 'admin', |
72
|
|
|
'PHP_AUTH_PW' => 'adminpass', |
73
|
|
|
) ); |
74
|
|
|
|
75
|
|
|
$client->request( 'GET', '/unittest/jqadm/delete/product/0' ); |
76
|
|
|
$response = $client->getResponse(); |
77
|
|
|
|
78
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
79
|
|
|
$this->assertContains( 'list-items', $response->getContent() ); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
|
83
|
|
|
public function testExportAction() |
84
|
|
|
{ |
85
|
|
|
$client = static::createClient(array(), array( |
86
|
|
|
'PHP_AUTH_USER' => 'admin', |
87
|
|
|
'PHP_AUTH_PW' => 'adminpass', |
88
|
|
|
) ); |
89
|
|
|
|
90
|
|
|
$client->request( 'GET', '/unittest/jqadm/export/order' ); |
91
|
|
|
$response = $client->getResponse(); |
92
|
|
|
|
93
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
94
|
|
|
$this->assertContains( 'list-items', $response->getContent() ); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
|
98
|
|
|
public function testGetAction() |
99
|
|
|
{ |
100
|
|
|
$client = static::createClient(array(), array( |
101
|
|
|
'PHP_AUTH_USER' => 'admin', |
102
|
|
|
'PHP_AUTH_PW' => 'adminpass', |
103
|
|
|
) ); |
104
|
|
|
|
105
|
|
|
$client->request( 'GET', '/unittest/jqadm/get/product/0' ); |
106
|
|
|
$response = $client->getResponse(); |
107
|
|
|
|
108
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
109
|
|
|
$this->assertContains( 'item-product', $response->getContent() ); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
|
113
|
|
|
public function testSaveAction() |
114
|
|
|
{ |
115
|
|
|
$client = static::createClient(array(), array( |
116
|
|
|
'PHP_AUTH_USER' => 'admin', |
117
|
|
|
'PHP_AUTH_PW' => 'adminpass', |
118
|
|
|
) ); |
119
|
|
|
|
120
|
|
|
$client->request( 'POST', '/unittest/jqadm/save/product/0' ); |
121
|
|
|
$response = $client->getResponse(); |
122
|
|
|
|
123
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
124
|
|
|
$this->assertContains( 'item-product', $response->getContent() ); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
|
128
|
|
|
public function testSearchAction() |
129
|
|
|
{ |
130
|
|
|
$client = static::createClient(array(), array( |
131
|
|
|
'PHP_AUTH_USER' => 'admin', |
132
|
|
|
'PHP_AUTH_PW' => 'adminpass', |
133
|
|
|
) ); |
134
|
|
|
|
135
|
|
|
$client->request( 'GET', '/unittest/jqadm/search/product' ); |
136
|
|
|
$response = $client->getResponse(); |
137
|
|
|
|
138
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
139
|
|
|
$this->assertContains( 'list-items', $response->getContent() ); |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
|
143
|
|
|
public function testSearchActionSite() |
144
|
|
|
{ |
145
|
|
|
$client = static::createClient(array(), array( |
146
|
|
|
'PHP_AUTH_USER' => 'admin', |
147
|
|
|
'PHP_AUTH_PW' => 'adminpass', |
148
|
|
|
) ); |
149
|
|
|
|
150
|
|
|
$client->request( 'GET', '/invalid/jqadm/search/product' ); |
151
|
|
|
$response = $client->getResponse(); |
152
|
|
|
|
153
|
|
|
$this->assertEquals( 500, $response->getStatusCode() ); |
154
|
|
|
} |
155
|
|
|
} |
156
|
|
|
|