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.

StructureTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 88
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 88
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
B testStructure() 0 33 1
A testDirectoryFileMix() 0 8 1
B testParameterDefinition() 0 30 1
1
<?php
2
namespace Naneau\FileGen\Test\Structure;
3
4
use Naneau\FileGen\Structure;
5
use Naneau\FileGen\Directory;
6
use Naneau\FileGen\File;
7
8
/**
9
 * Test structure generation
10
 */
11
class StructureTest extends \PHPUnit\Framework\TestCase
12
{
13
    /**
14
     * @return void
15
     **/
16
    public function testStructure()
17
    {
18
        // Note leading slashes in some
19
        $structure = new Structure;
20
        $structure
21
            ->directory('foo')
22
            ->directory('/bar')
23
            ->file('foo/bar', 'bar contents')
24
            ->file('foo/baz', 'baz contents')
25
            ->link('/from/this/file', 'to/this')
26
            ->link('/from/another/file', '/to/that');
27
28
        $this->assertInstanceOf(
29
            'Naneau\FileGen\Directory',
30
            $structure->scan('foo')
31
        );
32
        $this->assertInstanceOf(
33
            'Naneau\FileGen\Directory',
34
            $structure->scan('bar')
35
        );
36
        $this->assertInstanceOf(
37
            'Naneau\FileGen\File',
38
            $structure->scan('foo/bar')
39
        );
40
        $this->assertInstanceOf(
41
            'Naneau\FileGen\SymLink',
42
            $structure->scan('to/this')
43
        );
44
        $this->assertInstanceOf(
45
            'Naneau\FileGen\SymLink',
46
            $structure->scan('to/that')
47
        );
48
    }
49
50
    /**
51
     * test invalid structure
52
     *
53
     * @expectedException Naneau\FileGen\Structure\Exception
54
     * @return void
55
     **/
56
    public function testDirectoryFileMix()
57
    {
58
        // Can't add file under a node that's a file already
59
        $structure = new Structure;
60
        $structure
61
            ->file('foo', 'bar contents')
62
            ->file('foo/baz', 'baz contents');
63
    }
64
65
    /**
66
     * @return void
67
     **/
68
    public function testParameterDefinition()
69
    {
70
        // Note leading slashes in some
71
        $structure = new Structure;
72
        $structure
73
            // Throw in a file and directory
74
            ->directory('foo')
75
            ->file('bar')
76
77
            // Simple parameters
78
            ->parameter('foo', 'The foo parameter')
79
            ->parameter('bar', 'The bar parameter');
80
81
        $this->assertInstanceOf(
82
            'Naneau\FileGen\Directory',
83
            $structure->scan('foo')
84
        );
85
        $this->assertInstanceOf(
86
            'Naneau\FileGen\File',
87
            $structure->scan('bar')
88
        );
89
        $this->assertInstanceOf(
90
            'Naneau\FileGen\Parameter\Parameter',
91
            $structure->getParameterDefinition()->get('foo')
92
        );
93
        $this->assertInstanceOf(
94
            'Naneau\FileGen\Parameter\Parameter',
95
            $structure->getParameterDefinition()->get('bar')
96
        );
97
    }
98
}
99