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

ImmutableAssetTypeTest::testFromArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 15
nc 1
nop 0
dl 0
loc 21
rs 9.7666
c 0
b 0
f 0
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