/** * @covers ::__construct */ public function testConstruct() { $filename = __DIR__ . '/../html/index.html'; $html = new Html(file_get_contents($filename)); $content = new DOMDocument(); $content->loadHtmlFile($filename); $this->assertEquals($content->saveHtml(), $html->get()); }
/** * Save the HTML of the session into a file * Optionally resolve all the links with a base uri * * @param string $filename * @throws InvalidArgumentException if directory doesnt exist or is not writable * @param UriInterface|string $base */ public function saveHtml($filename, $base = null) { $this->ensureWritableDirectory(dirname($filename)); $html = new Html($this->getHtml()); if (null !== $base) { $html->resolveLinks(\GuzzleHttp\Psr7\uri_for($base)); } file_put_contents($filename, $html->get()); return $this; }