From df31edf8b6d7793f179a3e7bcf503d9ed6a8dc30 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Fri, 21 Aug 2009 04:16:21 +0000 Subject: [PATCH] MINOR Added unit test for DropdownField::performReadonlyTransformation() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84978 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/forms/DropdownFieldTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/forms/DropdownFieldTest.php b/tests/forms/DropdownFieldTest.php index 74249989f..45ffab61b 100644 --- a/tests/forms/DropdownFieldTest.php +++ b/tests/forms/DropdownFieldTest.php @@ -24,6 +24,14 @@ class DropdownFieldTest extends SapphireTest { ); } + function testReadonlyField() { + $dropdownField = new DropdownField('FeelingOk', 'Are you feeling ok?', array(0 => 'No', 1 => 'Yes'), '', null, '(Select one)'); + $dropdownField->setValue(1); + $readonlyDropdownField = $dropdownField->performReadonlyTransformation(); + preg_match('/Yes/', $dropdownField->Field(), $matches); + $this->assertEquals($matches[0], 'Yes'); + } + function testEmptyStringAsBooleanConstructorArgument() { $source = array(1=>'one'); $field = new DropdownField('Field', null, $source, null, null, true);