Failed Conditions
Push — master ( 9eeb29...881d26 )
by Florent
16:44
created

DatabaseTestCase   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 13 1
A runCommand() 0 6 1
A tearDown() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * The MIT License (MIT)
7
 *
8
 * Copyright (c) 2014-2018 Spomky-Labs
9
 *
10
 * This software may be modified and distributed under the terms
11
 * of the MIT license.  See the LICENSE file for details.
12
 */
13
14
namespace OAuth2Framework\ServerBundle\Tests\Functional;
15
16
use Doctrine\Common\Persistence\ManagerRegistry;
17
use Symfony\Bundle\FrameworkBundle\Console\Application;
18
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
19
use Symfony\Component\Console\Input\StringInput;
20
use Symfony\Component\Console\Output\OutputInterface;
21
22
class DatabaseTestCase extends WebTestCase
23
{
24
    /**
25
     * @var Application
26
     */
27
    protected static $application;
28
29
    /**
30
     * @var ManagerRegistry
31
     */
32
    protected static $registryManager;
33
34
    protected function setUp()
35
    {
36
        self::bootKernel();
37
        self::$application = new Application(static::$kernel);
38
        self::$application->setAutoExit(false);
39
40
        self::runCommand('doctrine:database:drop --force');
41
        self::runCommand('doctrine:database:create');
42
        self::runCommand('doctrine:schema:create');
43
        self::runCommand('doctrine:fixtures:load --append --no-interaction');
44
45
        self::$registryManager = self::$kernel->getContainer()->get('doctrine');
46
    }
47
48
    protected static function runCommand(string $command, ?OutputInterface $output = null): void
49
    {
50
        $command = sprintf('%s --quiet', $command);
51
52
        self::$application->run(new StringInput($command), $output);
53
    }
54
55
    protected function tearDown()
56
    {
57
        //self::runCommand('doctrine:database:drop --force');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
58
        parent::tearDown();
59
    }
60
}
61