Completed
Push — master ( 6d2813...e4e2c9 )
by Gabriel
04:30
created

ColorsTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 5
eloc 13
c 1
b 0
f 1
dl 0
loc 44
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A test_colors() 0 5 1
A data_name() 0 5 1
A test_rgb() 0 3 1
A test_name() 0 4 1
A data_rgb() 0 5 1
1
<?php
2
3
namespace Nip\Utility\Tests;
4
5
use Nip\Utility\Colors;
6
7
/**
8
 * Class ColorsTest
9
 * @package Nip\Utility\Tests
10
 */
11
class ColorsTest extends AbstractTest
12
{
13
    public function test_colors()
14
    {
15
        $colors = Colors::colors();
16
        self::assertIsArray($colors);
17
        self::assertCount(1567, $colors);
18
    }
19
20
21
    /**
22
     * @param $color
23
     * @param $output
24
     * @dataProvider data_rgb
25
     */
26
    public function test_rgb($color, $output)
27
    {
28
        self::assertSame($output, Colors::rgb($color));
29
    }
30
31
    public function data_rgb(): array
32
    {
33
        return [
34
            ['fff', [255, 0, 0]],
35
            ['0D0E0F', [208, 224, 15]],
36
        ];
37
    }
38
39
    /**
40
     * @param $color
41
     * @param $output
42
     * @dataProvider data_name
43
     */
44
    public function test_name($color, $output)
45
    {
46
        $return = Colors::name($color);
47
        self::assertSame($output, $return[1]);
48
    }
49
50
    public function data_name(): array
51
    {
52
        return [
53
            ['fff', 'White'],
54
            ['00F', 'Blue'],
55
        ];
56
    }
57
}