silverstripe-framework/tests/php/Dev/ViewableDataContainsTest/TestObject.php
2024-08-28 10:54:31 +12:00

32 lines
619 B
PHP

<?php
namespace SilverStripe\Dev\Tests\ViewableDataContainsTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\View\ViewableData;
class TestObject extends ViewableData implements TestOnly
{
protected $data = null;
public function __construct($data)
{
$this->data = $data;
}
public function hasField(string $fieldName): bool
{
return isset($this->data[$fieldName]);
}
public function getField(string $fieldName): mixed
{
return isset($this->data[$fieldName]) ?: null;
}
public function getSomething()
{
return 'something';
}
}