setOptions([
'strict' => true,
]);
$dom->load('
');
$this->assertEquals(' ', $dom->getElementById('hey')->nextSibling()->text);
}
public function testConfigStrictMissingSelfClosing()
{
$dom = new Dom;
$dom->setOptions([
'strict' => true,
]);
try
{
// should throw an exception
$dom->load('');
// we should not get here
$this->assertTrue(false);
}
catch (StrictException $e)
{
$this->assertEquals("Tag 'br' is not self closing! (character #31)", $e->getMessage());
}
}
public function testConfigStrictMissingAttribute()
{
$dom = new Dom;
$dom->setOptions([
'strict' => true,
]);
try
{
// should throw an exception
$dom->load('');
// we should not get here
$this->assertTrue(false);
}
catch (StrictException $e)
{
$this->assertEquals("Tag 'p' has an attribute 'block' with out a value! (character #22)", $e->getMessage());
}
}
}