コード例 #1
0
 /**
  * Testing the bulk actions - checkout and cancel check out
  */
 public function testApiBulkImmute()
 {
     // Create folder and documents
     $doc1 = $this->createDocument('Test Doc One', 'testdoc1.txt');
     $doc2 = $this->createDocument('Test Doc Two', 'testdoc2.txt');
     $folder1 = $this->root->add_folder("New test folder");
     $this->assertNotError($newFolder);
     if (PEAR::isError($newFolder)) {
         return;
     }
     $doc4 = $this->createDocument('Test Doc Four', 'testdoc4.txt', $folder1);
     $doc1_id = $doc1->get_documentid();
     $doc2_id = $doc2->get_documentid();
     $aItems = array();
     $aItems['documents'][] = $doc1_id;
     $aItems['documents'][] = $doc2_id;
     $aItems['folders'][] = $folder1->get_folderid();
     // Call bulk action - checkout
     $response = $this->ktapi->performBulkAction('immute', $aItems);
     $this->assertEqual($response['status_code'], 0);
     $this->assertTrue(empty($response['results']));
     // update document object
     $doc1 = $this->ktapi->get_document_by_id($doc1_id);
     $this->assertTrue($doc1->isImmutable());
     // remove immutability for deletion
     $doc1->unimmute();
     $doc2->unimmute();
     $doc4->unimmute();
     // delete items
     $response = $this->ktapi->performBulkAction('delete', $aItems, 'Testing API');
     $this->assertEqual($response['status_code'], 0);
 }