| @@ 37-59 (lines=23) @@ | ||
| 34 | ->count()); |
|
| 35 | } |
|
| 36 | ||
| 37 | public function testSurveyCreate() |
|
| 38 | { |
|
| 39 | $client = static::createClient(); |
|
| 40 | ||
| 41 | $crawler = $client->request('GET', '/survey/create/internship', array(), array(), array( |
|
| 42 | 'PHP_AUTH_USER' => '[email protected]', |
|
| 43 | 'PHP_AUTH_PW' => 'admin', |
|
| 44 | )); |
|
| 45 | ||
| 46 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
| 47 | ||
| 48 | $form = $crawler->selectButton('Create survey')->form(); |
|
| 49 | ||
| 50 | $form['survey[user]']->select('3'); |
|
| 51 | ||
| 52 | $client->submit($form); |
|
| 53 | $client->followRedirects(); |
|
| 54 | ||
| 55 | $this->assertTrue( |
|
| 56 | $client->getResponse()->isRedirect('/'), |
|
| 57 | 'response is a redirect to homepage' |
|
| 58 | ); |
|
| 59 | } |
|
| 60 | ||
| 61 | public function testSurveyDelete() |
|
| 62 | { |
|
| @@ 61-81 (lines=21) @@ | ||
| 58 | ); |
|
| 59 | } |
|
| 60 | ||
| 61 | public function testSurveyDelete() |
|
| 62 | { |
|
| 63 | $client = static::createClient(); |
|
| 64 | ||
| 65 | $crawler = $client->request('GET', '/survey/delete/4', array(), array(), array( |
|
| 66 | 'PHP_AUTH_USER' => '[email protected]', |
|
| 67 | 'PHP_AUTH_PW' => 'admin', |
|
| 68 | )); |
|
| 69 | ||
| 70 | $this->assertEquals(200, $client->getResponse()->getStatusCode()); |
|
| 71 | ||
| 72 | $form = $crawler->selectButton('Delete survey')->form(); |
|
| 73 | ||
| 74 | $client->submit($form); |
|
| 75 | $client->followRedirects(); |
|
| 76 | ||
| 77 | $this->assertTrue( |
|
| 78 | $client->getResponse()->isRedirect('/'), |
|
| 79 | 'response is a redirect to homepage' |
|
| 80 | ); |
|
| 81 | } |
|
| 82 | } |
|
| 83 | ||