BaseTestCase::createKernel()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 2
nc 1
nop 1
1
<?php
2
3
namespace Alpixel\Bundle\CMSBundle\Tests\Functional;
4
5
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
6
use Symfony\Component\DependencyInjection\Container;
7
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
8
9
/**
10
 * @author Benjamin HUBERT <[email protected]>
11
 */
12
class BaseTestCase extends WebTestCase
13
{
14
    protected function logIn($client)
15
    {
16
        /** @var Container $container */
17
        $container = $client->getContainer();
18
        $session = $container->get('session');
0 ignored issues
show
Unused Code introduced by
$session is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
19
20
        $token = new UsernamePasswordToken('jean josé', null, 'admin', ['ROLE_SUPER_ADMIN']);
21
        $container->get('security.token_storage')->setToken($token);
22
        $container->get('session')->set('_security_main', serialize($token));
23
    }
24
25
    protected static function createKernel(array $options = [])
26
    {
27
        return new AppKernel(
28
            isset($options['config']) ? $options['config'] : 'config.yml'
29
        );
30
    }
31
}
32