Compare commits

..

2 Commits

Author SHA1 Message Date
Steve Boyd
211c9cb246
Merge 4631aa0067 into 6bb9a0b33d 2024-10-15 20:59:21 +00:00
Steve Boyd
4631aa0067 NEW Validate DBFields 2024-10-16 09:59:14 +13:00
3 changed files with 5 additions and 13 deletions

View File

@ -627,8 +627,9 @@ class Controller extends RequestHandler implements TemplateGlobalProvider
* Caution: All parameters are expected to be URI-encoded already.
*
* @param string|array $arg One or more link segments, or list of link segments as an array
* @return string
*/
public static function join_links($arg = null): string
public static function join_links($arg = null)
{
if (func_num_args() === 1 && is_array($arg)) {
$args = $arg;

View File

@ -179,18 +179,10 @@ class DBEnumTest extends SapphireTest
public function testSaveDefaultValue()
{
$obj = new FieldType\DBEnumTestObject();
$obj->Colour = null;
$id = $obj->write();
// Fetch the object from the database
$obj = FieldType\DBEnumTestObject::get()->byID($id);
$this->assertEquals('Red', $obj->Colour);
$this->assertEquals('Blue', $obj->ColourWithDefault);
// Set value to null and save
$obj->Colour = null;
$obj->ColourWithDefault = null;
$obj->write();
// Fetch the object from the database
$obj = FieldType\DBEnumTestObject::get()->byID($id);
$this->assertEquals(null, $obj->Colour);
$this->assertEquals(null, $obj->ColourWithDefault);
$colour = FieldType\DBEnumTestObject::get()->byID($id)->Colour;
$this->assertEquals('Red', $colour);
}
}

View File

@ -11,6 +11,5 @@ class DBEnumTestObject extends DataObject
private static $db = [
'Colour' => 'Enum("Red,Blue,Green")',
'ColourWithDefault' => 'Enum("Red,Blue,Green","Blue")',
];
}