function ColorTest::testHexToRgb

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/ColorTest.php \Drupal\Tests\Component\Utility\ColorTest::testHexToRgb()
  2. 8.9.x core/tests/Drupal/Tests/Component/Utility/ColorTest.php \Drupal\Tests\Component\Utility\ColorTest::testHexToRgb()
  3. 11.x core/tests/Drupal/Tests/Component/Utility/ColorTest.php \Drupal\Tests\Component\Utility\ColorTest::testHexToRgb()

Tests Color::hexToRgb().

@dataProvider providerTestHexToRgb

Parameters

string $value: The hex color value.

string $expected: The expected rgb color value.

bool $invalid: Whether this value is invalid and exception should be expected.

File

core/tests/Drupal/Tests/Component/Utility/ColorTest.php, line 83

Class

ColorTest
Tests Color utility class conversions.

Namespace

Drupal\Tests\Component\Utility

Code

public function testHexToRgb($value, $expected, $invalid = FALSE) : void {
    if ($invalid) {
        $this->expectException('InvalidArgumentException');
    }
    $this->assertSame($expected, Color::hexToRgb($value));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.