|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class CatalogTest extends \LocalWebTestCase |
|
4
|
|
|
{ |
|
5
|
|
|
public function testCountAction() |
|
6
|
|
|
{ |
|
7
|
|
|
$response = $this->call( 'GET', '/unittest/count' ); |
|
8
|
|
|
|
|
9
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
|
10
|
|
|
$this->assertContains( 'application/javascript', $response->getHeader( 'Content-Type' ) ); |
|
11
|
|
|
$this->assertStringStartsWith( '// <!--', (string) $response->getBody() ); |
|
12
|
|
|
} |
|
13
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
public function testDetailAction() |
|
16
|
|
|
{ |
|
17
|
|
|
$response = $this->call( 'GET', '/unittest/d/test/0' ); |
|
18
|
|
|
|
|
19
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
|
20
|
|
|
$this->assertContains( 'catalog-detail', (string) $response->getBody() ); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
public function testDetailActionPin() |
|
25
|
|
|
{ |
|
26
|
|
|
$response = $this->call( 'GET', '/unittest/d/pin' ); |
|
27
|
|
|
|
|
28
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
|
29
|
|
|
$this->assertContains( 'catalog-detail', (string) $response->getBody() ); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
|
|
33
|
|
|
public function testListAction() |
|
34
|
|
|
{ |
|
35
|
|
|
$response = $this->call( 'GET', '/unittest/list' ); |
|
36
|
|
|
|
|
37
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
|
38
|
|
|
$this->assertContains( 'catalog-list', (string) $response->getBody() ); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
|
|
42
|
|
|
public function testStockAction() |
|
43
|
|
|
{ |
|
44
|
|
|
$response = $this->call( 'GET', '/unittest/stock' ); |
|
45
|
|
|
|
|
46
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
|
47
|
|
|
$this->assertContains( 'application/javascript', $response->getHeader( 'Content-Type' ) ); |
|
48
|
|
|
$this->assertStringStartsWith( '// <!--', (string) $response->getBody() ); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
|
|
52
|
|
|
public function testSuggestAction() |
|
53
|
|
|
{ |
|
54
|
|
|
$response = $this->call( 'GET', '/unittest/suggest' ); |
|
55
|
|
|
|
|
56
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
|
57
|
|
|
$this->assertContains( 'application/json', $response->getHeader( 'Content-Type' ) ); |
|
58
|
|
|
$this->assertStringStartsWith( '[', (string) $response->getBody() ); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
|
|
62
|
|
|
public function testTreeAction() |
|
63
|
|
|
{ |
|
64
|
|
|
$response = $this->call( 'GET', '/unittest/c/name/0' ); |
|
65
|
|
|
|
|
66
|
|
|
$this->assertEquals( 200, $response->getStatusCode() ); |
|
67
|
|
|
$this->assertContains( 'catalog-list', (string) $response->getBody() ); |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|