/** * Get regular expression matching the value. * * Return a regular sub expression, which matches all possible values of * this value type. The regular expression should NOT contain any named * sub-patterns, since it might be repeatedly embedded in some box parser. * * @return string */ public function getRegularExpression() { $widthParser = new ezcDocumentPcssStyleMeasureValue(); $styleParser = new ezcDocumentPcssStyleLineValue(); $colorParser = new ezcDocumentPcssStyleColorValue(); return '(?:' . '(?:' . $widthParser->getRegularExpression() . '\\s*)?' . '(?:' . $styleParser->getRegularExpression() . '\\s*)?' . '(?:' . $colorParser->getRegularExpression() . ')?' . ')'; }
public function testInvalidColorSpecification() { try { $value = new ezcDocumentPcssStyleColorValue(); $value->parse('something invalid'); $this->fail('Expected ezcDocumentParserException.'); } catch (ezcDocumentParserException $e) { /* Expected */ } }
public function testRenderLayeredPolygons() { $driver = $this->getDriver(); $driver->createPage(210, 297); $color = new ezcDocumentPcssStyleColorValue(); $color->parse('#204a87'); $driver->drawPolygon(array(array(10, 10), array(200, 10), array(105, 287)), $color->value); $color = new ezcDocumentPcssStyleColorValue(); $color->parse('#2e3436'); $driver->drawPolyline(array(array(200, 287), array(105, 10), array(10, 287)), $color->value, 1, false); $pdf = $driver->save(); $this->assertPdfDocumentsSimilar($pdf, get_class($driver) . '_' . __FUNCTION__); }