public function format($format = true) { if (!is_bool($format)) { throw new InvalidArgumentException(sprintf('%s expects parameter 1 to be boolean, %s given', __METHOD__, gettype($format))); } $this->document->formatOutput = $format; return $this; }
public function testFormat() { $html = $this->loadFixture('posts.html'); $document = new Document($html, false); $domDocument = $document->getDocument(); $this->assertFalse($domDocument->formatOutput); $document->format(); $domDocument = $document->getDocument(); $this->assertTrue($domDocument->formatOutput); }