GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

FixtureAttachedTrait::getFixtureNameForTestCase()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Adrien\FixturesForTests;
6
7
use LogicException;
8
use Doctrine\Common\Persistence\ManagerRegistry;
9
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
10
11
trait FixtureAttachedTrait
12
{
13
    use FixtureLoaderTrait;
14
15 3
    public function setUp(): void
16
    {
17 3
        if (!$this instanceof KernelTestCase) {
18 1
            throw new LogicException('The "FixtureAttachedTrait" should only be used on objects extending the symfony/framework-bundle KernelTestCase.');
19
        }
20
21 2
        self::bootKernel();
22
23 2
        if (!self::$container->has(ManagerRegistry::class)) {
24 1
            throw new LogicException('No Doctrine ManagerRegistry service has been found in the service container. Please provide an implementation.');
25
        }
26
27
        /** @var ManagerRegistry $registry */
28 1
        $registry = self::$container->get(ManagerRegistry::class);
29 1
        $fixtureName = static::getFixtureNameForTestCase(get_class($this));
30 1
        $this->loadFixture(
31 1
            $registry->getManager(),
32 1
            new $fixtureName()
33
        );
34 1
    }
35
36 1
    private static function getFixtureNameForTestCase(string $testCaseName)
37
    {
38 1
        return $testCaseName.'Fixture';
39
    }
40
}
41