Passed
Push — master ( 8bad73...c5d158 )
by David
57s queued 11s
created

ImmutableAssetTypeTest::testFromArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 15
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 21
rs 9.7666
1
<?php
2
3
4
namespace TheCodingMachine\Discovery;
5
6
use PHPUnit\Framework\TestCase;
7
8
class ImmutableAssetTypeTest extends TestCase
9
{
10
    public function testFromArray()
11
    {
12
        $array = [
13
            [
14
                'value' => 'a1',
15
                'package' => 'package/a',
16
                'packageDir' => 'vendor/package/a',
17
                'priority' => 0.0,
18
                'metadata' => []
19
            ]
20
        ];
21
        $assetType = ImmutableAssetType::fromArray('name', $array);
22
23
        $this->assertSame($assetType->getName(), 'name');
24
        $this->assertCount(1, $assetType->getAssets());
25
        $asset = $assetType->getAssets()[0];
26
        $this->assertSame('a1', $asset->getValue());
27
        $this->assertSame('package/a', $asset->getPackage());
28
        $this->assertSame('vendor/package/a', $asset->getPackageDir());
29
        $this->assertSame(0.0, $asset->getPriority());
30
        $this->assertSame([], $asset->getMetadata());
31
    }
32
}
33