silverstripe-userforms/tests/Model/EditableFormField/EditableTextFieldTest.php

24 lines
772 B
PHP

<?php
namespace SilverStripe\UserForms\Tests\Model\EditableFormField;
use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\DropdownField;
use SilverStripe\UserForms\Model\EditableFormField\EditableTextField;
class EditableTextFieldTest extends SapphireTest
{
public function testGetCmsFields()
{
Config::modify()->set(EditableTextField::class, 'autocomplete_options', ['foo' => 'foo']);
$field = new EditableTextField;
$result = $field->getCMSFields();
$autocompleteField = $result->fieldByName('Root.Main.Autocomplete');
$this->assertInstanceOf(DropdownField::class, $autocompleteField);
$this->assertEquals(['foo' => 'foo'], $autocompleteField->getSource());
}
}