Passed
Push — master ( 68f44f...66b79c )
by Luke
02:45
created

ComponentSpecificationTest::testGetExtra()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
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
use ComponentManager\ComponentSpecification;
12
use ComponentManager\MoodleVersion;
13
use PHPUnit\Framework\TestCase;
14
15
/**
16
 * @coversDefaultClass \ComponentManager\ComponentSpecification
17
 */
18
class ComponentSpecificationTest extends TestCase {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
19
    public function testGetExtra() {
20
        $extra = (object) [
21
            'defined' => 'obviously',
22
        ];
23
        $componentSpecification = new ComponentSpecification(
24
                'type_name', '2015021800', null, null, $extra);
25
        $this->assertEquals(
26
                'obviously', $componentSpecification->getExtra('defined'));
27
28
        $this->expectException(OutOfBoundsException::class);
29
        $componentSpecification->getExtra('definitelyUndefined');
30
    }
31
}
32