forked from chibimagic/WebDriver-PHP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWebDriverColorTest.php
47 lines (42 loc) · 1.18 KB
/
WebDriverColorTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
require_once 'WebDriver.php';
class WebDriverColorTest extends PHPUnit_Framework_TestCase {
public function valid_colors() {
return array(
array("white", "FFFFFF"),
array("rgb(255,255,255)", "FFFFFF"),
array("#ffFFff", "FFFFFF"),
array("#fff", "FFFFFF"),
array("black", "000000"),
array("rgb(0,0,0)", "000000"),
array("000", "000000"),
array("#000", "000000"),
array("RGB(0, 100, 200)", "0064C8"),
array('yellow', 'FFFF00'),
);
}
/**
* @dataProvider valid_colors
*/
public function test_valid_colors($input, $expected_output) {
$actual_output = WebDriver::CanonicalizeCSSColor($input);
$this->assertTrue($expected_output === $actual_output, "Expected: <$expected_output>. Actual: <$actual_output>.");
}
public function invalid_colors() {
return array(
array("somecolor"),
array("#fffffg"),
array("#ff"),
array("rgb(-1, 0 0)"),
array("rgb(255, 256, 200)"),
array("12345"),
);
}
/**
* @dataProvider invalid_colors
* @expectedException Exception
*/
public function test_invalid_colors($input) {
WebDriver::CanonicalizeCSSColor($input);
}
}