styles = $styles; } /** * @param string $html Raw html. * * @return CssAsserter */ public static function createFromHtml($html) { $matches = []; preg_match('##i', $html, $matches); array_shift($matches); return new CssAsserter(implode("\n", $matches)); } /** * @param string $selector Css selector. * * @return CssAsserter */ public function hasSelector($selector) { TestCase::assertRegExp('/'.$selector.'/i', $this->styles); return $this; } /** * @param string $selector Css selector. * * @return CssPropertiesAsserter */ public function with($selector) { $this->hasSelector($selector); return new CssPropertiesAsserter(preg_replace('/%s[^\{]*?\{([^\}]*?)\}/i', '$1', $this->styles), $this); } }