silverstripe-framework/tests/php/View/SSViewerTest/TestViewableData.php
dominik face94371e FIX Passing 0 as first argument breaks template
Replace !empty with explicit string test
Added test for falseish first parameter arguments
2023-06-09 08:55:20 +02:00

42 lines
897 B
PHP

<?php
namespace SilverStripe\View\Tests\SSViewerTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData;
/**
* @property string $TextValue
* @property string $HTMLValue
*/
class TestViewableData extends ViewableData implements TestOnly
{
private static $default_cast = 'Text';
private static $casting = [
'TextValue' => 'Text',
'HTMLValue' => 'HTMLFragment'
];
public function methodWithOneArgument($arg1)
{
return "arg1:{$arg1}";
}
public function methodWithTwoArguments($arg1, $arg2)
{
return "arg1:{$arg1},arg2:{$arg2}";
}
public function methodWithTypedArguments($arg1, $arg2, $arg3)
{
return 'arg1:' . json_encode($arg1) . ',arg2:' . json_encode($arg2) . ',arg3:' . json_encode($arg3);
}
public function Type($arg)
{
return gettype($arg) . ':' . $arg;
}
}