@@ 9-33 (lines=25) @@ | ||
6 | ||
7 | class SurveyControllerTest extends WebTestCase |
|
8 | { |
|
9 | public function testApiSurveys() |
|
10 | { |
|
11 | $client = static::createClient(); |
|
12 | ||
13 | $client->request('GET', '/api/surveys'); |
|
14 | ||
15 | $this->assertEquals(401, $client->getResponse()->getStatusCode()); |
|
16 | ||
17 | $client->request( |
|
18 | 'GET', |
|
19 | '/api/surveys', |
|
20 | array(), |
|
21 | array(), |
|
22 | array('HTTP_X-AUTH-TOKEN' => '1') |
|
23 | ||
24 | ); |
|
25 | $this->assertTrue( |
|
26 | $client->getResponse()->headers->contains( |
|
27 | 'Content-Type', |
|
28 | 'application/json' |
|
29 | ), |
|
30 | 'the "Content-Type" header is "application/json"' |
|
31 | ); |
|
32 | $this->assertTrue($client->getResponse()->isSuccessful(), 'response status is 2xx'); |
|
33 | } |
|
34 | ||
35 | public function testApiSurvey() |
|
36 | { |
|
@@ 35-59 (lines=25) @@ | ||
32 | $this->assertTrue($client->getResponse()->isSuccessful(), 'response status is 2xx'); |
|
33 | } |
|
34 | ||
35 | public function testApiSurvey() |
|
36 | { |
|
37 | $client = static::createClient(); |
|
38 | ||
39 | $client->request('GET', '/api/survey/1'); |
|
40 | ||
41 | $this->assertEquals(401, $client->getResponse()->getStatusCode()); |
|
42 | ||
43 | $client->request( |
|
44 | 'GET', |
|
45 | '/api/surveys', |
|
46 | array(), |
|
47 | array(), |
|
48 | array('HTTP_X-AUTH-TOKEN' => '1') |
|
49 | ||
50 | ); |
|
51 | $this->assertTrue( |
|
52 | $client->getResponse()->headers->contains( |
|
53 | 'Content-Type', |
|
54 | 'application/json' |
|
55 | ), |
|
56 | 'the "Content-Type" header is "application/json"' |
|
57 | ); |
|
58 | $this->assertTrue($client->getResponse()->isSuccessful(), 'response status is 2xx'); |
|
59 | } |
|
60 | ||
61 | public function testApiSurveyUpdate() |
|
62 | { |