You are here

public function ColorTest::testHexToRgb in Drupal 8

Same name and namespace in other branches
  1. 9 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 81

Class

ColorTest
Tests Color utility class conversions.

Namespace

Drupal\Tests\Component\Utility

Code

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