CatalogTest::testStockAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
rs 10
c 1
b 0
f 0
1
<?php
2
3
class CatalogTest extends \LocalWebTestCase
4
{
5
	public function testCountAction()
6
	{
7
		$response = $this->call( 'GET', '/unittest/shop/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/shop/test/0' );
18
19
		$this->assertEquals( 200, $response->getStatusCode() );
20
		$this->assertStringContainsString( 'catalog-detail', (string) $response->getBody() );
21
	}
22
23
24
	public function testDetailActionPin()
25
	{
26
		$response = $this->call( 'GET', '/unittest/shop/pin' );
27
28
		$this->assertEquals( 200, $response->getStatusCode() );
29
		$this->assertStringContainsString( 'catalog-detail', (string) $response->getBody() );
30
	}
31
32
33
	public function testListAction()
34
	{
35
		$response = $this->call( 'GET', '/unittest/shop' );
36
37
		$this->assertEquals( 200, $response->getStatusCode() );
38
		$this->assertStringContainsString( 'catalog-list', (string) $response->getBody() );
39
	}
40
41
42
	public function testStockAction()
43
	{
44
		$response = $this->call( 'GET', '/unittest/shop/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/shop/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/shop/name~0' );
65
66
		$this->assertEquals( 200, $response->getStatusCode() );
67
		$this->assertStringContainsString( 'catalog-list', (string) $response->getBody() );
68
	}
69
}
70