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

ImmutableAssetTypeTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 16
c 2
b 0
f 0
dl 0
loc 23
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFromArray() 0 21 1
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