N°6228 - CheckToWrite() propagation to target objects based on with_php_constraint property

This commit is contained in:
Pierre Goiffon
2023-11-14 12:02:45 +01:00
committed by Eric Espie
parent 9a59bc7890
commit ea845dc6eb
17 changed files with 703 additions and 465 deletions

View File

@@ -208,4 +208,33 @@ PHP
$oFormFieldNoTouchedAtt = $oAttDef->MakeFormField($oPerson);
$this->assertTrue($oFormFieldNoTouchedAtt->IsValidationDisabled(), 'email wasn\'t modified, we must not validate the corresponding field');
}
/**
* @dataProvider WithConstraintParameterProvider
*
* @param string $sClass
* @param string $sAttCode
* @param bool $bConstraintExpected
* @param bool $bComputationExpected
*
* @return void
* @throws \Exception
*/
public function testWithConstraintAndComputationParameters(string $sClass, string $sAttCode, bool $bConstraintExpected, bool $bComputationExpected)
{
$oAttDef = \MetaModel::GetAttributeDef($sClass, $sAttCode);
$this->assertTrue(method_exists($oAttDef, 'GetHasConstraint'));
$this->assertEquals($bConstraintExpected, $oAttDef->GetHasConstraint());
$this->assertEquals($bComputationExpected, $oAttDef->GetHasComputation());
}
public function WithConstraintParameterProvider()
{
return [
['User', 'profile_list', true, false],
['User', 'allowed_org_list', true, false],
['Person', 'team_list', false, false],
['Ticket', 'functionalcis_list', false, true],
];
}
}