/** * Test htmlToRGB() */ public function testHtmlToRGB() { // Prepare test values [ original, expected ] $values[] = array('#FF99DD', array(255, 153, 221)); // With # $values[] = array('FF99DD', array(255, 153, 221)); // 6 characters $values[] = array('F9D', array(255, 153, 221)); // 3 characters $values[] = array('0F9D', false); // 4 characters // Conduct test foreach ($values as $value) { $result = Converter::htmlToRGB($value[0]); $this->assertEquals($value[1], $result); } }