FileLocatorTestCase::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 17

Duplication

Lines 21
Ratio 100 %

Importance

Changes 0
Metric Value
dl 21
loc 21
c 0
b 0
f 0
rs 9.3142
cc 1
eloc 17
nc 1
nop 7
1
<?php
2
3
/**
4
 * This file is part of the Cubiche/Metadata component.
5
 *
6
 * Copyright (c) Cubiche
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 Cubiche\Core\Metadata\Tests\Units\Locator;
13
14
use Cubiche\Core\Metadata\Locator\FileLocatorInterface;
15
use Cubiche\Core\Metadata\Tests\Fixtures\Address;
16
use Cubiche\Core\Metadata\Tests\Fixtures\User;
17
use Cubiche\Core\Metadata\Tests\Units\TestCase;
18
use mageekguy\atoum\adapter as Adapter;
19
use mageekguy\atoum\annotations\extractor as Extractor;
20
use mageekguy\atoum\asserter\generator as Generator;
21
use mageekguy\atoum\test\assertion\manager as Manager;
22
use mageekguy\atoum\tools\variable\analyzer as Analyzer;
23
24
/**
25
 * FileLocatorTestCase class.
26
 *
27
 * Generated by TestGenerator on 2017-05-16 at 13:17:21.
28
 */
29
abstract class FileLocatorTestCase extends TestCase
30
{
31
    /**
32
     * @var string
33
     */
34
    protected $mappingDirectory;
35
36
    /**
37
     * @param Adapter   $adapter
38
     * @param Extractor $annotationExtractor
39
     * @param Generator $asserterGenerator
40
     * @param Manager   $assertionManager
41
     * @param \Closure  $reflectionClassFactory
42
     * @param \Closure  $phpExtensionFactory
43
     * @param Analyzer  $analyzer
44
     */
45 View Code Duplication
    public function __construct(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
46
        Adapter $adapter = null,
47
        Extractor $annotationExtractor = null,
48
        Generator $asserterGenerator = null,
49
        Manager $assertionManager = null,
50
        \Closure $reflectionClassFactory = null,
51
        \Closure $phpExtensionFactory = null,
52
        Analyzer $analyzer = null
53
    ) {
54
        parent::__construct(
55
            $adapter,
56
            $annotationExtractor,
57
            $asserterGenerator,
58
            $assertionManager,
59
            $reflectionClassFactory,
60
            $phpExtensionFactory,
61
            $analyzer
62
        );
63
64
        $this->mappingDirectory = __DIR__.'/../../Fixtures/mapping';
65
    }
66
67
    /**
68
     * @return FileLocatorInterface
69
     */
70
    abstract protected function createLocator();
71
72
    /**
73
     * Test findMappingFile method.
74
     */
75
    public function testfindMappingFile()
76
    {
77
        $this
78
            ->given($locator = $this->createLocator())
79
            ->then()
80
                ->string($locator->findMappingFile(User::class, '.xml'))
81
                    ->isEqualTo($this->mappingDirectory.'/Fixtures.User.xml')
82
        ;
83
    }
84
85
    /**
86
     * Test getAllClassNames method.
87
     */
88 View Code Duplication
    public function testGetAllClassNames()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
89
    {
90
        $this
91
            ->given($locator = $this->createLocator())
92
            ->then()
93
                ->array($locator->getAllClassNames('.xml'))
94
                    ->contains(Address::class)
95
                    ->contains(User::class)
96
        ;
97
    }
98
}
99