ComponentSpecificationTest::testGetExtra()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
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