mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Add unit test for an invalid HTMLValue
This commit is contained in:
parent
7ea218aa1c
commit
d28552915d
@ -80,4 +80,19 @@ class HTML4ValueTest extends SapphireTest
|
||||
$value->setContent('<a href="""></a>');
|
||||
$this->assertEquals('<a href="""></a>', $value->getContent(), "'\"' character is escaped");
|
||||
}
|
||||
|
||||
public function testGetContent()
|
||||
{
|
||||
$value = new HTML4Value();
|
||||
|
||||
$value->setContent('<p>This is valid</p>');
|
||||
$this->assertEquals('<p>This is valid</p>', $value->getContent(), "Valid content is returned");
|
||||
|
||||
$value->setContent('<p?< This is not really valid but it will get parsed into something valid');
|
||||
// can sometimes get a this state where HTMLValue->valid is false
|
||||
// for instance if a content editor saves something really weird in a LiteralField
|
||||
// we can manually get to this state via ->setInvalid()
|
||||
$value->setInvalid();
|
||||
$this->assertEquals('', $value->getContent(), "Blank string is returned when invalid");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user