Passed
Pull Request — master (#9)
by Pavel
11:27
created

SecurityControllerTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 29.17 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 70%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 3
c 1
b 1
f 0
lcom 1
cbo 2
dl 7
loc 24
ccs 7
cts 10
cp 0.7
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testPublicAction() 7 7 1
A testPrivateAction() 0 4 1
A getKernelClass() 0 4 1

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
namespace Bankiru\Api\Rpc\Test\Tests;
4
5
use Bankiru\Api\Rpc\Test\Kernel;
6
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
7
8
final class SecurityControllerTest extends WebTestCase
9
{
10 1 View Code Duplication
    public function testPublicAction()
11
    {
12 1
        $client = self::createClient();
13 1
        $client->request('POST', '/test/', ['method' => 'security/public']);
14
15 1
        self::assertTrue($client->getResponse()->isSuccessful());
16 1
    }
17
18
    /**
19
     * @expectedException \Symfony\Component\Security\Core\Exception\InsufficientAuthenticationException
20
     * @expectedExceptionMessage Full authentication is required to access this resource.
21
     */
22 1
    public function testPrivateAction()
23
    {
24 1
        self::createClient()->request('POST', '/test/', ['method' => 'security/private']);
25
    }
26
27
    protected static function getKernelClass()
28
    {
29
        return Kernel::class;
30
    }
31
}
32