objFromFixture(File::class, 'asdf');
$subfolderfile1 = $this->objFromFixture(File::class, 'subfolderfile1');
$schemaStateDefaults = $field->getSchemaStateDefaults();
$this->assertArraySubset(['id' => 'TestTree', 'name' => 'TestTree', 'value' => 'unchanged'], $schemaStateDefaults, $strict = true);
$html = $field->performReadonlyTransformation()->Field();
$this->assertEquals(
<<<"HTML"
('none')
HTML
,
$html
);
}
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]));
$schemaStateDefaults = $field->getSchemaStateDefaults();
$this->assertArraySubset(['id' => 'TestTree', 'name' => 'TestTree', 'value' => [$asdf->ID, $subfolderfile1->ID]], $schemaStateDefaults, $strict = true);
$html = (string)$field->performReadonlyTransformation()->Field();
$this->assertEquals(
<<<"HTML"
<Special & characters>, TestFile1InSubfolder
HTML
,
$html
);
}
}