Completed
Push — master ( e32202...083db4 )
by Alex
08:17
created

GeneratorControllerFunctionalTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 53.85 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 21
loc 39
rs 10
c 1
b 0
f 0

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
/**
4
 * This file is part of the PierstovalCharacterManagerBundle package.
5
 *
6
 * (c) Alexandre Rock Ancelet <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Pierstoval\Bundle\CharacterManagerBundle\Tests\Controller;
13
14
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
15
use Tests\WebTestCase as PiersTestCase;
16
17
class GeneratorControllerFunctionalTest extends WebTestCase
18
{
19
    use PiersTestCase;
20
21
    public function test generate redirects to first step()
22
    {
23
        $client = $this->getClient();
24
25
        $client->getKernel()->boot();
26
27
        $client->request('GET', '/generate');
28
29
        static::assertSame(302, $client->getResponse()->getStatusCode());
30
        static::assertSame('/generate/step_01', $client->getResponse()->headers->get('Location'));
31
    }
32
33
    public function test base step route renders correctly()
34
    {
35
        $client = $this->getClient();
36
37
        $client->getKernel()->boot();
38
39
        $client->request('GET', '/generate/step_01');
40
41
        static::assertSame(200, $client->getResponse()->getStatusCode());
42
        static::assertSame('Stub response based on abstract class', $client->getResponse()->getContent());
43
    }
44
45
    public function test non existent step route throws 404()
46
    {
47
        $client = $this->getClient();
48
49
        $client->getKernel()->boot();
50
51
        $client->request('GET', '/generate/non-existent-step');
52
53
        static::assertSame(404, $client->getResponse()->getStatusCode());
54
    }
55
}
56