Completed
Pull Request — master (#30)
by
unknown
05:34
created

SurveyControllerTest::testSurveyCreate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 11

Duplication

Lines 20
Ratio 100 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 20
loc 20
rs 9.4285
cc 1
eloc 11
nc 1
nop 0
1
<?php
2
3
namespace Tests\AppBundle\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6
7
class SurveyControllerTest extends WebTestCase
8
{
9
    public function testSurvey()
10
    {
11
        exec('./bin/console d:d:c --env=test');
12
        exec('./bin/console d:s:c --env=test');
13
        exec('./bin/console h:f:l -n --env=test');
14
15
        $client = static::createClient();
16
17
        $crawler = $client->request('GET', '/surveys/1', array(), array(), array(
18
            'PHP_AUTH_USER' => '[email protected]',
19
            'PHP_AUTH_PW' => 'admin',
20
        ));
21
22
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
23
24
        $this->assertEquals(1, $crawler
25
            ->filter('h3:contains("Internship survey")')
26
            ->count());
27
    }
28
29 View Code Duplication
    public function testSurveyCreate()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
    {
31
        $client = static::createClient();
32
33
        $crawler = $client->request('GET', '/surveys/create/internship', array(), array(), array(
34
            'PHP_AUTH_USER' => '[email protected]',
35
            'PHP_AUTH_PW' => 'admin',
36
        ));
37
38
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
39
40
        $form = $crawler->selectButton('Create survey')->form();
41
42
        $form['survey[user]']->select('2');
43
44
        $client->followRedirects();
45
        $client->submit($form);
46
47
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
48
    }
49
50 View Code Duplication
    public function testSurveyDelete()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
51
    {
52
        $client = static::createClient();
53
54
        $crawler = $client->request('GET', '/surveys/delete/1', array(), array(), array(
55
            'PHP_AUTH_USER' => '[email protected]',
56
            'PHP_AUTH_PW' => 'admin',
57
        ));
58
59
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
60
61
        $form = $crawler->selectButton('Delete survey')->form();
62
63
        $client->followRedirects();
64
        $client->submit($form);
65
66
        $this->assertEquals(200, $client->getResponse()->getStatusCode());
67
        exec('./bin/console d:d:d --force --env=test');
68
    }
69
}
70