Test Failed
Pull Request — master (#11)
by recca
07:11
created

ImmutableAssetTypeTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFromArray() 0 21 1
1
<?php
2
3
4
namespace TheCodingMachine\Discovery\Tests;
5
6
use PHPUnit\Framework\TestCase;
7
use TheCodingMachine\Discovery\ImmutableAssetType;
8
9
class ImmutableAssetTypeTest extends TestCase
10
{
11
    public function testFromArray()
12
    {
13
        $array = [
14
            [
15
                'value' => 'a1',
16
                'package' => 'package/a',
17
                'packageDir' => 'vendor/package/a',
18
                'priority' => 0.0,
19
                'metadata' => []
20
            ]
21
        ];
22
        $assetType = ImmutableAssetType::fromArray('name', $array);
23
24
        $this->assertSame($assetType->getName(), 'name');
25
        $this->assertCount(1, $assetType->getAssets());
26
        $asset = $assetType->getAssets()[0];
27
        $this->assertSame('a1', $asset->getValue());
28
        $this->assertSame('package/a', $asset->getPackage());
29
        $this->assertSame('vendor/package/a', $asset->getPackageDir());
30
        $this->assertSame(0.0, $asset->getPriority());
31
        $this->assertSame([], $asset->getMetadata());
32
    }
33
}
34