silverstripe-framework/tests/php/Model/ModelDataTest/Castable.php

58 lines
1.0 KiB
PHP
Raw Normal View History

2016-10-14 03:30:05 +02:00
<?php
namespace SilverStripe\Model\Tests\ModelDataTest;
2016-10-14 03:30:05 +02:00
use SilverStripe\Dev\TestOnly;
use SilverStripe\Model\ModelData;
2016-10-14 03:30:05 +02:00
class Castable extends ModelData implements TestOnly
2016-10-14 03:30:05 +02:00
{
private static $default_cast = Caster::class;
private static $casting = [
'alwaysCasted' => RequiresCasting::class,
'castedUnsafeXML' => UnescapedCaster::class,
'test' => 'Text',
'arrayOne' => 'Text',
];
public $test = 'test';
public $uncastedZeroValue = 0;
public function alwaysCasted()
{
return 'alwaysCasted';
}
public function arrayOne()
{
return ['value1', 'value2'];
}
public function arrayTwo()
{
return ['value1', 'value2'];
}
public function noCastingInformation()
{
return 'noCastingInformation';
}
public function unsafeXML()
{
return '<foo>';
}
public function castedUnsafeXML()
{
return $this->unsafeXML();
}
public function forTemplate(): string
{
return 'castable';
}
2016-10-14 03:30:05 +02:00
}