# responsive-menu/4.1.0/tests/app/Validation/Validators/ColourTest.php

Responsive Menu – Create Mobile-Friendly Menu, version 4.1.0. 41 lines.

- Page: https://pluginprobe.com/plugins/responsive-menu/4.1.0/code/tests/app/Validation/Validators/ColourTest.php
- Raw: https://pluginprobe.com/plugins/responsive-menu/4.1.0/raw/tests/app/Validation/Validators/ColourTest.php
- Modified: 2021-02-26T08:52:00+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/responsive-menu/4.1.0/code/tests/app/Validation/Validators/ColourTest.php#L10-L20`.

```php
<?php

use PHPUnit\Framework\TestCase;
use ResponsiveMenu\Validation\Validators;

class ColourTest extends TestCase {

    public function testColourList() {
        return [

            // These should fail
            ['foo', false],
            ['bar', false],
            ['red', false],
            ['#f', false],
            ['#f', false],
            ['#ff', false],
            ['##fff', false],
            ['rgba(54,54,54)', false],

            // These should pass
            ['#fff', true],
            ['#ffffff', true],
            ['#333333', true],
            ['#7f7f7f', true],
            ['rgba(54,54,54,0.5)', true],
            ['rgba(54, 54, 54, 0.5)', true]

        ];
    }

    /**
     * @dataProvider testColourList
     */
    public function testHexIsValidated($colour, $expected) {
        $validator = new Validators\Colour($colour);
        $this->assertEquals($expected, $validator->validate());
    }

}

```
