ComponentSpecificationTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 14
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGetExtra() 0 12 1
1
<?php
2
3
/**
4
 * Moodle component manager.
5
 *
6
 * @author Luke Carrier <[email protected]>
7
 * @copyright 2016 Luke Carrier
8
 * @license GPL-3.0+
9
 */
10
11
namespace ComponentManager\Test;
12
13
use ComponentManager\ComponentSpecification;
14
use OutOfBoundsException;
15
use PHPUnit\Framework\TestCase;
16
17
/**
18
 * @coversDefaultClass \ComponentManager\ComponentSpecification
19
 */
20
class ComponentSpecificationTest extends TestCase {
21
    public function testGetExtra() {
22
        $extra = (object) [
23
            'defined' => 'obviously',
24
        ];
25
        $componentSpecification = new ComponentSpecification(
26
                'type_name', '2015021800', null, null, $extra);
27
        $this->assertEquals(
28
                'obviously', $componentSpecification->getExtra('defined'));
29
30
        $this->expectException(OutOfBoundsException::class);
31
        $componentSpecification->getExtra('definitelyUndefined');
32
    }
33
}
34