ProjectNamespaceTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A tearDown() 0 4 1
A testWithNamespacedClass() 0 14 1
1
<?php
2
/**
3
 * This file is part of phpDocumentor.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @copyright 2010-2018 Mike van Riel<[email protected]>
9
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
10
 * @link      http://phpdoc.org
11
 */
12
13
namespace phpDocumentor\Reflection;
14
15
use Mockery as m;
16
use phpDocumentor\Reflection\File\LocalFile;
17
use phpDocumentor\Reflection\Php\Factory\File;
18
use phpDocumentor\Reflection\Php\ProjectFactory;
19
use PHPUnit\Framework\TestCase;
20
21
/**
22
 * Intergration tests to check the correct working of processing a namespace into a project.
23
 *
24
 * @coversNothing
25
 */
26
class ProjectNamespaceTest extends TestCase
27
{
28
    /**
29
     * @var ProjectFactory
30
     */
31
    private $fixture;
32
33
    protected function setUp()
34
    {
35
        $this->fixture = $this->fixture = ProjectFactory::createInstance();
36
    }
37
38
    protected function tearDown()
39
    {
40
        m::close();
41
    }
42
43
    public function testWithNamespacedClass()
44
    {
45
        $fileName = __DIR__ . '/project/Luigi/Pizza.php';
46
        $project = $this->fixture->create('My Project', [
47
            new LocalFile($fileName),
48
        ]);
49
50
        $this->assertArrayHasKey($fileName, $project->getFiles());
51
        $this->assertArrayHasKey('\\Luigi', $project->getNamespaces());
52
        $this->assertEquals(
53
            ['\\Luigi\\Pizza' => new Fqsen('\\Luigi\\Pizza')],
54
            $project->getNamespaces()['\\Luigi']->getClasses()
55
        );
56
    }
57
}
58