mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
TEST: additional test for ViewableData not wrapping cached strings
This commit is contained in:
parent
761eec7736
commit
e6bfabfd6c
@ -81,6 +81,19 @@ class ViewableDataTest extends SapphireTest {
|
||||
$this->assertEquals('casted', $newViewableData->forTemplate());
|
||||
}
|
||||
|
||||
public function testDefaultValueWrapping() {
|
||||
$data = new ArrayData(array('Title' => 'SomeTitleValue'));
|
||||
// this results in a cached raw string in ViewableData:
|
||||
$this->assertTrue($data->hasValue('Title'));
|
||||
$this->assertFalse($data->hasValue('SomethingElse'));
|
||||
// this should cast the raw string to a StringField since we are
|
||||
// passing true as the third argument:
|
||||
$obj = $data->obj('Title', null, true);
|
||||
$this->assertTrue(is_object($obj));
|
||||
// and the string field should have the value of the raw string:
|
||||
$this->assertEquals('SomeTitleValue', $obj->forTemplate());
|
||||
}
|
||||
|
||||
public function testRAWVal() {
|
||||
$data = new ViewableDataTest_Castable();
|
||||
$data->test = 'This & This';
|
||||
|
Loading…
Reference in New Issue
Block a user