13 require_once
'PU_testcase_dcp_document.php';
31 parent::setUpBeforeClass();
34 self::beginTransaction();
36 self::importDocument(
"testTag.ods");
40 self::rollbackTransaction();
51 $this->assertTrue($df->isAlive() ,
"document $docName is not alive");
53 $this->assertEmpty($err, sprintf(
"utag error"));
55 $utag = $df->getUTag($tag);
57 $this->assertTrue($utag !==
false, sprintf(
"utag %s not retrieved", $tag));
58 $this->assertEquals(
$value, $utag->comment);
62 $this->
sudo($otherLogin);
66 $this->assertTrue($df->isAlive() ,
"document $docName is not alive");
67 $utag = $df->getUTag($tag);
69 $this->assertTrue($utag ===
false, sprintf(
"utag %s of other user is retrieved", $tag));
84 $this->assertTrue($df->isAlive() ,
"document $docName is not alive");
86 $this->assertEmpty($err, sprintf(
"utag error"));
89 $this->assertEmpty($err, sprintf(
"utag error"));
91 $utag = $df->getUTag($tag);
93 $this->assertTrue($utag !==
false, sprintf(
"utag %s not retrieved", $tag));
94 $this->assertEquals(
$value, $utag->comment);
109 $this->assertTrue($df->isAlive() ,
"document $docName is not alive");
111 $this->assertEmpty($err, sprintf(
"utag error"));
113 $utag = $df->getUTag($tag);
115 $this->assertTrue($utag !==
false, sprintf(
"utag %s not retrieved", $tag));
116 $this->assertEquals(
$value, $utag->comment);
119 $this->assertEmpty($err, sprintf(
"utag del error"));
120 $utag = $df->getUTag($tag);
122 $this->assertTrue($utag ===
false, sprintf(
"utag %s not deleted", $tag));
137 $this->assertTrue($df->isAlive() ,
"document $docName is not alive");
139 $this->assertEmpty($err, sprintf(
"utag error"));
141 $utag = $df->getUTag($tag);
143 $this->assertTrue($utag !==
false, sprintf(
"utag %s not retrieved", $tag));
144 $this->assertEquals(
$value, $utag->comment);
147 $this->assertEmpty($err, sprintf(
"utag del error"));
148 $utag = $df->getUTag($tag);
150 $this->assertTrue($utag ===
false, sprintf(
"utag %s not deleted", $tag));
162 $this->assertTrue($df->isAlive() ,
"document $docName is not alive");
163 foreach ($tags as $tag) {
164 $err = $df->addATag($tag);
165 $this->assertEmpty(
$err, sprintf(
"utag error"));
168 foreach ($tags as $tag) {
169 $atag = $df->getATag($tag);
171 $this->assertTrue($atag, sprintf(
"atag %s not retrieved : \n found [%s]", $tag, $df->atags));
176 $this->assertTrue($df->isAlive() ,
"document $docName is not alive");
177 foreach ($tags as $tag) {
178 $atag = $df->getATag($tag);
179 $this->assertTrue($atag, sprintf(
"atag %s from new is not retrieved", $tag));
185 public function testDeleteATag($docName, array $addTags, array $delTags, array $expectedTags)
190 $this->assertTrue($df->isAlive() ,
"document $docName is not alive");
191 foreach ($addTags as $tag) {
192 $err = $df->addATag($tag);
193 $this->assertEmpty(
$err, sprintf(
"utag error"));
196 foreach ($addTags as $tag) {
197 $atag = $df->getATag($tag);
198 $this->assertTrue($atag, sprintf(
"atag %s not retrieved : \n found [%s]", $tag, $df->atags));
201 foreach ($delTags as $tag) {
202 $err = $df->delATag($tag);
203 $this->assertEmpty(
$err, sprintf(
"utag delete error : $err"));
208 $this->assertTrue($df->isAlive() ,
"document $docName is not alive");
210 $nbTags = (!$df->atags) ? 0 : count(explode(
"\n", $df->atags));
211 $this->assertEquals(count($expectedTags) , $nbTags, sprintf(
" found [%s]", $df->atags));
213 foreach ($expectedTags as $tag) {
214 $atag = $df->getATag($tag);
215 $this->assertTrue($atag, sprintf(
"atag %s from new is not retrieved", $tag));
226 $this->assertTrue($df->isAlive() ,
"document $docName is not alive");
228 $err = $df->addATag($tag);
229 $this->assertContains($error, $err, sprintf(
"atag error"));
237 $this->assertTrue($df->isAlive() ,
"document $docName is not alive");
239 foreach ($expectedTags as $tag) {
240 $atag = $df->getATag($tag);
241 $this->assertTrue($atag, sprintf(
"atag %s not retrieved : \n found [%s]", $tag, $df->atags));
245 $tags = explode(
"\n", $df->atags);
247 $this->assertEquals(count($tags) , count($expectedTags) , sprintf(
"wrong count for [%s]", $df->atags));
static tearDownAfterClass()
static setUpBeforeClass()
testImportATag($docName, array $expectedTags)
testAddUTag($docName, $login, $otherLogin, $tag, $value)
testDelUTags($docName, $login, $otherLogin, $tag, $value)
testDelUTag($docName, $login, $otherLogin, $tag, $value)
static resetDocumentCache()
testAddAErrorTag($docName, $tag, $error)
testDeleteATag($docName, array $addTags, array $delTags, array $expectedTags)
testChangeUTag($docName, $login, $otherLogin, $tag, $value)
testAddATag($docName, array $tags)
simpleQuery($dbaccess, $query, &$result=array(), $singlecolumn=false, $singleresult=false, $useStrict=null)
if($file) if($subject==""&&$file) if($subject=="") $err