2017-08-16 03:59:41 +02:00
|
|
|
<?php
|
|
|
|
|
2017-08-22 02:15:22 +02:00
|
|
|
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;
|
|
|
|
|
2017-08-16 03:59:41 +02:00
|
|
|
class EditableTextFieldTest extends SapphireTest
|
|
|
|
{
|
|
|
|
public function testGetCmsFields()
|
|
|
|
{
|
2017-08-22 02:15:22 +02:00
|
|
|
Config::modify()->set(EditableTextField::class, 'autocomplete_options', ['foo' => 'foo']);
|
2017-08-16 03:59:41 +02:00
|
|
|
|
|
|
|
$field = new EditableTextField;
|
|
|
|
$result = $field->getCMSFields();
|
|
|
|
|
|
|
|
$autocompleteField = $result->fieldByName('Root.Main.Autocomplete');
|
2017-08-22 02:15:22 +02:00
|
|
|
$this->assertInstanceOf(DropdownField::class, $autocompleteField);
|
|
|
|
$this->assertEquals(['foo' => 'foo'], $autocompleteField->getSource());
|
2017-08-16 03:59:41 +02:00
|
|
|
}
|
|
|
|
}
|