silverstripe-framework/tests/php/Dev/ViewableDataContainsTest/TestObject.php
Guy Sartorelli e2e32317d6
API Move various classes to more appropriate namespaces (#11370)
Also rename ViewableData to ModelData ahead of the template layer
lift-and-shift
2024-09-23 14:31:50 +12:00

32 lines
611 B
PHP

<?php
namespace SilverStripe\Dev\Tests\ModelDataContainsTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Model\ModelData;
class TestObject extends ModelData 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';
}
}