12 require_once
'PU_testcase_dcp_commonfamily.php';
19 'PU_data_dcp_groupaccount.ods'
27 public function testClearGroup($groupId, $expectedContents)
32 $group =
new_Doc(
'', $groupId,
true);
33 $this->assertTrue($group->isAlive() , sprintf(
"Could not get group with id '%s'.", $groupId));
34 $err = $group->Clear();
35 $this->assertEmpty($err, sprintf(
"Clear() on group with id '%s' returned unexpected error message: %s", $groupId, $err));
36 foreach ($expectedContents as $expectedContent) {
37 $subjectId = $expectedContent[
'subject'];
39 $this->assertTrue(
$subject->isAlive() , sprintf(
"Expected subject with id '%s' not found.", $subjectId));
40 $check = $expectedContent[
'check'];
41 $argv = isset($expectedContent[
'argv']) ? $expectedContent[
'argv'] : null;
47 $this->assertTrue(is_a(
$subject,
'\Dcp\Core\GroupAccount') , sprintf(
"Subject with id '%s' is not of expected class '\\Dcp\\Core\\GroupAccount'.", $subjectId));
48 $content =
$subject->getContent(
false);
49 $this->assertCount(0, $content, sprintf(
"Unexpected content's count (%s) for subject with id '%s'.", count($content) , $subjectId));
56 $this->assertTrue(is_a(
$subject,
'Dcp\Core\UserAccount') , sprintf(
"Subject with id '%s' is not of expected class 'Dcp\\Core\\UserAccount'.", $subjectId));
57 $parents =
$subject->getAllUserGroups();
58 $this->assertCount(0, $parents, sprintf(
"Unexpected parent's count (%s) for subject with id '%s'.", count($parents) , $subjectId));
61 case 'has-not-parent':
65 $this->assertTrue(is_a(
$subject,
'Dcp\Core\UserAccount') , sprintf(
"Subject with id '%s' is not of expected class 'Dcp\\Core\\UserAccount'.", $subjectId));
66 $parents =
$subject->getAllUserGroups();
68 foreach ($parents as $sysId => $docId) {
69 $group =
new_Doc(
'', $docId,
true);
70 if (!$group->isAlive()) {
73 if ($group->name == $argv) {
74 $hasNotParent =
false;
77 $this->assertTrue($hasNotParent, sprintf(
"User with id '%s' has unexpected parent '%s'.", $subjectId, $argv));
91 'check' =>
'is-empty',
95 'check' =>
'has-no-parents'
99 'check' =>
'has-no-parents'
102 'subject' =>
'U_BAR',
103 'check' =>
'has-not-parent',
static getCommonImportFile()
new_Doc($dbaccess, $id= '', $latest=false)
if($file) if($subject==""&&$file) if($subject=="") $err