N°6414 Disable Field validation for untouched attcodes

This commit is contained in:
Pierre Goiffon
2023-06-27 17:08:15 +02:00
parent f40674ec85
commit 52049b7837
5 changed files with 136 additions and 26 deletions

View File

@@ -181,4 +181,17 @@ PHP
],
];
}
public function testMakeFormField(): void
{
$oPerson = $this->CreatePerson(1);
$oPerson->Set('email', 'toto@tutu.com');
$oAttDef = MetaModel::GetAttributeDef(get_class($oPerson), 'email');
$oFormFieldWithTouchedAtt = $oAttDef->MakeFormField($oPerson);
$this->assertFalse($oFormFieldWithTouchedAtt->IsValidationDisabled(), 'email is part of modified fields, we must have field validation');
$oPerson->DBUpdate(); // reset list of changed attributes
$oFormFieldNoTouchedAtt = $oAttDef->MakeFormField($oPerson);
$this->assertTrue($oFormFieldNoTouchedAtt->IsValidationDisabled(), 'email wasn\'t modified, we must not validate the corresponding field');
}
}