mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
48 lines
875 B
PHP
48 lines
875 B
PHP
<?php
|
|
|
|
namespace SilverStripe\View\Tests\ViewableDataTest;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
use SilverStripe\View\ViewableData;
|
|
|
|
class Castable extends ViewableData implements TestOnly
|
|
{
|
|
|
|
private static $default_cast = Caster::class;
|
|
|
|
private static $casting = [
|
|
'alwaysCasted' => RequiresCasting::class,
|
|
'castedUnsafeXML' => UnescapedCaster::class,
|
|
'test' => 'Text',
|
|
];
|
|
|
|
public $test = 'test';
|
|
|
|
public $uncastedZeroValue = 0;
|
|
|
|
public function alwaysCasted()
|
|
{
|
|
return 'alwaysCasted';
|
|
}
|
|
|
|
public function noCastingInformation()
|
|
{
|
|
return 'noCastingInformation';
|
|
}
|
|
|
|
public function unsafeXML()
|
|
{
|
|
return '<foo>';
|
|
}
|
|
|
|
public function castedUnsafeXML()
|
|
{
|
|
return $this->unsafeXML();
|
|
}
|
|
|
|
public function forTemplate()
|
|
{
|
|
return 'castable';
|
|
}
|
|
}
|