Passed
Pull Request — main (#4)
by Peter
06:44 queued 03:43
created

CssTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toStylesProvider() 0 8 1
A testToStyles() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Framework\Html\Helper;
6
7
use PHPUnit\Framework\TestCase;
8
9
class CssTest extends TestCase
10
{
11
    /**
12
     * @return array[]
13
     */
14
    public function toStylesProvider(): array
15
    {
16
        return [
17
            'empty' => [[], ''],
18
            'one'   => [['color' => 'red'], 'color: red'],
19
            'three' => [
20
                ['color' => 'red', 'background' => 'none', 'font-weight' => 'bold'],
21
                'color: red; background: none; font-weight: bold',
22
            ],
23
        ];
24
    }
25
26
    /**
27
     * @dataProvider toStylesProvider
28
     *
29
     * @param array  $styles
30
     * @param string $expectedResult
31
     */
32
    public function testToStyles(array $styles, string $expectedResult): void
33
    {
34
        $actualResult = Css::toStyles($styles);
35
36
        $this->assertEquals($expectedResult, $actualResult);
37
    }
38
}
39