mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
68c3279fd9
Removed legacy entwine dead code Added soft-deprecation to label field
32 lines
1.0 KiB
PHP
32 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\Forms\Tests;
|
|
|
|
use SilverStripe\Assets\File;
|
|
use SilverStripe\Dev\SapphireTest;
|
|
use SilverStripe\Forms\TreeMultiselectField;
|
|
|
|
class TreeMultiselectFieldTest extends SapphireTest
|
|
{
|
|
protected static $fixture_file = 'TreeDropdownFieldTest.yml';
|
|
|
|
public function testReadonly()
|
|
{
|
|
$field = new TreeMultiselectField('TestTree', 'Test tree', File::class);
|
|
$asdf = $this->objFromFixture(File::class, 'asdf');
|
|
$subfolderfile1 = $this->objFromFixture(File::class, 'subfolderfile1');
|
|
$field->setValue(implode(',', [$asdf->ID, $subfolderfile1->ID]));
|
|
|
|
$readonlyField = $field->performReadonlyTransformation();
|
|
$this->assertEquals(
|
|
<<<"HTML"
|
|
<span id="TestTree_ReadonlyValue" class="readonly">
|
|
<Special & characters>, TestFile1InSubfolder
|
|
</span><input type="hidden" name="TestTree" value="{$asdf->ID},{$subfolderfile1->ID}" class="hidden" id="TestTree" />
|
|
HTML
|
|
,
|
|
(string)$readonlyField->Field()
|
|
);
|
|
}
|
|
}
|