13 require_once
'PU_testcase_dcp_commonfamily.php';
18 private static $ids = array();
23 return "PU_data_dcp_newdoc.ods";
28 parent::setUpBeforeClass();
30 $d->setAttributeValue(\Dcp\AttributeIdentifiers\Base::ba_title,
"x1-" .
$d->revision);
33 $d->setLogicalName(
"TST_X1");
34 self::$ids[
$d->name][
$d->revision] = array(
36 "title" =>
$d->getTitle()
40 $d->setAttributeValue(\Dcp\AttributeIdentifiers\Base::ba_title,
"x2-" . $d->revision);
42 $d->setLogicalName(
"TST_X2");
43 self::$ids[$d->name][$d->revision] = array(
45 "title" => $d->getTitle()
49 $d->setAttributeValue(\Dcp\AttributeIdentifiers\Base::ba_title,
"x2-" . $d->revision);
51 self::$ids[$d->name][$d->revision] = array(
53 "title" => $d->getTitle()
57 $d->setAttributeValue(\Dcp\AttributeIdentifiers\Base::ba_title,
"x3-" . $d->revision);
59 $d->setLogicalName(
"TST_X3");
60 self::$ids[$d->name][$d->revision] = array(
62 "title" => $d->getTitle()
66 $d->setAttributeValue(\Dcp\AttributeIdentifiers\Base::ba_title,
"x3-" . $d->revision);
68 self::$ids[$d->name][$d->revision] = array(
70 "title" => $d->getTitle()
73 $d->setAttributeValue(\Dcp\AttributeIdentifiers\Base::ba_title,
"x3-" . $d->revision);
74 self::$ids[$d->name][$d->revision] = array(
76 "title" => $d->getTitle()
81 $d->setAttributeValue(\Dcp\AttributeIdentifiers\Base::ba_title,
"x4-" . $d->revision);
83 $d->setLogicalName(
"TST_X4");
84 self::$ids[$d->name][$d->revision] = array(
86 "title" => $d->getTitle()
89 $d->setAttributeValue(\Dcp\AttributeIdentifiers\Base::ba_title,
"x4-" . $d->revision);
91 self::$ids[$d->name][$d->revision] = array(
93 "title" => $d->getTitle()
96 $d->setAttributeValue(\Dcp\AttributeIdentifiers\Base::ba_title,
"x4-" . $d->revision);
97 self::$ids[$d->name][$d->revision] = array(
99 "title" => $d->getTitle()
107 $dM->initid = $d->initid;
108 $dM->name = $d->name;
109 $dM->revision = $d->revision + 1;
110 $dM->setAttributeValue(\Dcp\AttributeIdentifiers\Dir::ba_title,
"x4M-" . $dM->revision);
111 $dM->setAttributeValue(\Dcp\AttributeIdentifiers\Dir::fld_allbut,
"1");
113 self::$ids[$dM->name][$dM->revision] = array(
115 "title" => $d->getTitle()
118 $dM->setAttributeValue(\Dcp\AttributeIdentifiers\Dir::ba_title,
"x4M-" . $dM->revision);
119 $dM->setAttributeValue(\Dcp\AttributeIdentifiers\Dir::fld_allbut,
"2");
121 self::$ids[$dM->name][$dM->revision] = array(
123 "title" => $dM->getTitle()
126 self::resetDocumentCache();
134 $this->assertTrue(
$d->isAffected() ,
"document $docName not found");
135 $this->assertTrue(
$d->isAlive() ,
"document $docName not last revision\n" . print_r(self::$ids[$docName],
true));
136 $this->assertEquals($expectedTitle,
$d->getTitle() ,
"wrong title for $docName\n" . print_r(self::$ids[$docName],
true));
146 $this->assertEquals(
"no",
$nd->getrawValue(
"tst_shared"));
148 $this->assertEquals(
"yes",
$nd->getrawValue(
"tst_shared"));
151 $this->assertEquals(
"yes", $d1->getrawValue(
"tst_shared"));
152 $this->assertTrue($d1->isAffected() ,
"document $docName not found");
153 $this->assertTrue($d1->isAlive() ,
"document $docName not last revision");
154 $this->assertEquals($expectedTitle, $d1->getTitle() ,
"wrong title for $docName");
156 $d1->setAttributeValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title, $someValues[0]);
158 $this->assertEquals($someValues[0],
$d2->getRawValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title));
159 $d2->setAttributeValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title, $someValues[1]);
160 $this->assertEquals($someValues[1],
$d2->getRawValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title));
162 $this->assertEquals(
"yes",
$d2->getrawValue(
"tst_shared"));
165 $this->assertEquals(
"yes",
$d2->getrawValue(
"tst_shared"));
166 $d2->setAttributeValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title, $someValues[2]);
168 $this->assertEquals($someValues[2], $d3->getRawValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title));
171 $this->assertEquals($someValues[2], $d4->getRawValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title));
174 $this->assertEquals($someValues[1], $d5->getRawValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title));
175 $d5->setAttributeValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title, $someValues[3]);
179 $this->assertEquals($someValues[3], $d6->getRawValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title));
180 $this->assertEquals($someValues[3], $d5->getRawValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title));
181 $this->assertEquals($someValues[2], $d4->getRawValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title));
182 $this->assertEquals($someValues[2], $d3->getRawValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title));
183 $this->assertEquals($someValues[2],
$d2->getRawValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title));
184 $this->assertEquals($someValues[2], $d1->getRawValue(\Dcp\AttributeIdentifiers\Tst_nd::tst_title));
191 $id = self::$ids[$docName][
$revision][
"id"];
193 $this->assertTrue(
$d->isAffected() ,
"document $docName not found");
194 $this->assertEquals(
$d->id, $id,
"document $docName (rev $revision) not match id");
195 $this->assertEquals($expectedTitle,
$d->getTitle() ,
"wrong title for $docName");
202 $id = self::$ids[$docName][
$revision][
"id"];
204 $this->assertTrue(
$d->isAffected() ,
"document $docName not found");
205 $this->assertTrue(
$d->isAlive() ,
"document $docName #$id not last revision" . print_r(self::$ids[$docName],
true));
206 $this->assertEquals($expectedTitle,
$d->getTitle() ,
"wrong title for $docName");
214 foreach ($expectedValues as $attrid => $expectedValue) {
215 $this->assertTrue(isset(
$d[strtolower($attrid) ]) , sprintf(
"attribut %s not found", $attrid));
216 $this->assertEquals($expectedValue,
$d[strtolower($attrid) ], sprintf(
"wrong value %s : %s", $attrid, print_r(
$d,
true)));
219 foreach ($expectedValues as $attrid => $expectedValue) {
220 $this->assertTrue(isset(
$d[strtolower($attrid) ]) , sprintf(
"attribut for latest %s not found", $attrid));
221 $this->assertEquals($expectedValue,
$d[strtolower($attrid) ], sprintf(
"wrong value for latest %s : %s", $attrid, print_r(
$d,
true)));
240 foreach ($expectedValues as $attrid => $expectedValue) {
241 $this->assertTrue(isset(
$d[strtolower($attrid) ]) , sprintf(
"attribut for latest %s not found", $attrid));
242 $this->assertEquals($expectedValue,
$d[strtolower($attrid) ], sprintf(
"wrong value for latest %s : %s", $attrid, print_r(
$d,
true)));
438 "ba_title" =>
"x4M-3",
447 "ba_title" =>
"x4M-4",
getTDoc($dbaccess, $id, $sqlfilters=array(), $result=array())
dataGetLatestRevisionNumber()
testLatestNewDoc($docName, $revision, $expectedTitle)
testSimpleGetTDoc($docName, $expectedValues)
static getCommonImportFile()
getLatestTDoc($dbaccess, $initid, $sqlfilters=array(), $fromid=false)
testReviseNewDoc($docName, $revision, $expectedTitle)
testSimpleNewDoc($docName, $expectedTitle)
static setUpBeforeClass()
testSharedNewDoc($docName, $expectedTitle, $someValues)
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
getRevTDoc($dbaccess, $initid, $rev)
getLatestRevisionNumber($dbaccess, $initid, $fromid=0)
testGetLatestRevisionNumber($docName, $expectedValues)
testGetRevTDoc($docName, $revision, $expectedValues)