13 require_once
'PU_testcase_dcp_commonfamily.php';
26 "PU_data_dcp_substitute_family.ods"
34 $names[] =
$doc->name;
46 foreach ($incumbents as $aIncumbent) {
48 $u->setLoginName($aIncumbent);
49 if (!$u->isAffected()) $this->markTestIncomplete(
"cannot find $aIncumbent account");
50 $err = $u->setSubstitute($nu->id);
51 $this->assertEmpty(
$err,
"substitute error: $err");
59 $this->assertEmpty(
$err,
"substitute search error: $err");
61 $names = $this->getSearchName($s);
63 $this->assertEquals(count($expectedDocNames) , $s->
count() , sprintf(
"not expected items:\n\tfound : %s \n\texpect : %s", implode(
',', $names) , implode(
',', $expectedDocNames)));
65 $this->assertEquals(count($expectedDocNames) , count(array_intersect($names, $expectedDocNames)) , sprintf(
"not expected items.\n\t found : %s\n\t expect : %s", implode(
',', $names) , implode(
',', $expectedDocNames)));
74 foreach ($substituts as $incumbent => $aSubstitute) {
76 $u->setLoginName($incumbent);
77 if (!$u->isAffected()) $this->markTestIncomplete(
"cannot find $incumbent account");
78 $err = $u->setSubstitute($aSubstitute);
79 $this->assertEmpty(
$err,
"substitute error : $err");
81 foreach ($expectedDocNamesByLogin as
$login => $expectNames) {
87 $this->assertEmpty(
$err,
"substitute search error");
89 $names = $this->getSearchName($s);
91 $this->assertEquals(count($expectNames) , $s->
count() , sprintf(
"not expected items:\n\tfound : %s \n\texpect : %s", implode(
',', $names) , implode(
',', $expectNames)));
93 $this->assertEquals(count($expectNames) , count(array_intersect($names, $expectNames)) , sprintf(
"not expected items.\n\t found : %s\n\t expect : %s", implode(
',', $names) , implode(
',', $expectNames)));
103 foreach ($previousSubstitues as $incumbent => $aSubstitute) {
105 $u->setLoginName($incumbent);
106 if (!$u->isAffected()) $this->markTestIncomplete(
"cannot find $incumbent account");
107 $err = $u->setSubstitute($aSubstitute);
108 $this->assertEmpty(
$err,
"substitute error : $err");
117 $nu = new \Account();
118 $nu->setLoginName(
$login);
119 foreach ($incumbents as $aIncumbent) {
121 $u->setLoginName($aIncumbent);
122 if (!$u->isAffected()) $this->markTestIncomplete(
"cannot find $aIncumbent account");
123 $err = $u->setSubstitute($nu->id);
124 $this->assertEmpty(
$err,
"substitute error : $err");
128 foreach ($expectedDocNames as $docName => $expectControl) {
130 $this->assertEquals($expectControl[
"normal"],
$d->control(
'view',
false) ==
"", sprintf(
"not correct normal control view for %s", $docName));
132 $this->assertEquals($expectControl[
"strict"],
$d->control(
'view',
true) ==
"", sprintf(
"not correct strict control view for %s", $docName));
142 "previousSubstitutes" => array(
146 "substitutes" => array(
180 "substitutes" => array(
209 "substitutes" => array(
238 "substitutes" => array(
272 "incumbent" => array() ,
281 "incumbent" => array() ,
290 "login" =>
"uyellow",
291 "incumbent" => array() ,
298 "login" =>
"uyellow",
299 "incumbent" => array(
311 "login" =>
"uyellow",
312 "incumbent" => array(
325 "login" =>
"uyellow",
326 "incumbent" => array(
349 "incumbent" => array() ,
386 "login" =>
"uyellow",
387 "incumbent" => array(
testControlStrict($login, array $incumbents, array $expectedDocNames)
testControlSubstitute(array $substituts, array $expectedDocNamesByLogin)
setObjectReturn($returnobject=true)
testControlIncumbent($login, array $incumbents, array $expectedDocNames)
static getCommonImportFile()
dataControlReSubstitute()
testControlReSubstitute(array $previousSubstitues, array $substituts, array $expectedDocNamesByLogin)
if($file) if($subject==""&&$file) if($subject=="") $err