silverstripe-framework/tests/php/Forms/GridField/GridFieldLevelupTest.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

30 lines
837 B
PHP

<?php
namespace SilverStripe\Forms\Tests\GridField;
use LogicException;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldLevelup;
use SilverStripe\Model\ArrayData;
class GridFieldLevelupTest extends SapphireTest
{
protected $usesDatabase = false;
public function testGetHTMLFragmentsThrowsException()
{
$component = new GridFieldLevelup(0);
$gridField = new GridField('dummy');
$modelClass = ArrayData::class;
$gridField->setModelClass($modelClass);
$this->expectException(LogicException::class);
$this->expectExceptionMessage(
GridFieldLevelup::class . " must be used with DataObject subclasses. Found '$modelClass'"
);
$component->getHTMLFragments($gridField);
}
}