Commit 6aa159982caaf13c7f2d42167d15e573cfd50697
1 parent
5859c2c3
CMIS Repository config change. Fixed CMIS Unit Test breakage caused by moving an…
…d changing of core CMIS interface Committed by: Paul Barrett Reviewed by: Jarrett Jordaan
Showing
3 changed files
with
120 additions
and
38 deletions
lib/api/ktcmis/config/repositories.xml
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <vendorName>KnowledgeTree</vendorName> | 19 | <vendorName>KnowledgeTree</vendorName> |
| 20 | <productName>KnowledgeTree Document Management System</productName> | 20 | <productName>KnowledgeTree Document Management System</productName> |
| 21 | <productVersion>3.6.2</productVersion> | 21 | <productVersion>3.6.2</productVersion> |
| 22 | - <rootFolderId>Root%20Folder</rootFolderId> | 22 | + <rootFolderId>Root Folder</rootFolderId> |
| 23 | <cmisVersionsSupported>0.61c</cmisVersionsSupported> | 23 | <cmisVersionsSupported>0.61c</cmisVersionsSupported> |
| 24 | </repositoryInfo> | 24 | </repositoryInfo> |
| 25 | <repositoryCapabilities> | 25 | <repositoryCapabilities> |
lib/api/ktcmis/ktcmis.inc.php
| @@ -77,20 +77,11 @@ class KTCMISBase { | @@ -77,20 +77,11 @@ class KTCMISBase { | ||
| 77 | 77 | ||
| 78 | public function startSession($username, $password) | 78 | public function startSession($username, $password) |
| 79 | { | 79 | { |
| 80 | - global $default; | ||
| 81 | - $default->log->debug("attempt auth with $username :: $password"); | ||
| 82 | $this->session = null; | 80 | $this->session = null; |
| 83 | - // remove as soon as actual auth code is in place | ||
| 84 | - $username = 'admin'; | ||
| 85 | - $password = 'admin'; | 81 | + |
| 86 | $this->ktapi = new KTAPI(); | 82 | $this->ktapi = new KTAPI(); |
| 87 | $this->session =& $this->ktapi->start_session($username, $password); | 83 | $this->session =& $this->ktapi->start_session($username, $password); |
| 88 | 84 | ||
| 89 | - if (PEAR::isError($this->session)) | ||
| 90 | - { | ||
| 91 | - $default->log->debug("FAILED $username :: $password FAILED"); | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | return $this->session; | 85 | return $this->session; |
| 95 | } | 86 | } |
| 96 | 87 | ||
| @@ -358,6 +349,37 @@ class KTNavigationService extends KTCMISBase { | @@ -358,6 +349,37 @@ class KTNavigationService extends KTCMISBase { | ||
| 358 | ); | 349 | ); |
| 359 | } | 350 | } |
| 360 | 351 | ||
| 352 | + /** | ||
| 353 | + * Gets the parents for the selected object | ||
| 354 | + * | ||
| 355 | + * @param string $repositoryId | ||
| 356 | + * @param string $folderId | ||
| 357 | + * @param boolean $includeAllowableActions | ||
| 358 | + * @param boolean $includeRelationships | ||
| 359 | + * @param string $filter | ||
| 360 | + * @return ancestry[] | ||
| 361 | + */ | ||
| 362 | + function getObjectParents($repositoryId, $objectId, $includeAllowableActions, $includeRelationships, $filter = '') | ||
| 363 | + { | ||
| 364 | + $ancestryResult = $this->NavigationService->getObjectParents($repositoryId, $objectId, $includeAllowableActions, | ||
| 365 | + $includeRelationships); | ||
| 366 | + | ||
| 367 | + if (PEAR::isError($ancestryResult)) | ||
| 368 | + { | ||
| 369 | + return array( | ||
| 370 | + "status_code" => 1, | ||
| 371 | + "message" => "Failed getting ancestry for object" | ||
| 372 | + ); | ||
| 373 | + } | ||
| 374 | + | ||
| 375 | + $ancestry = CMISUtil::decodeObjectHierarchy($ancestryResult, 'child'); | ||
| 376 | + | ||
| 377 | + return array( | ||
| 378 | + "status_code" => 0, | ||
| 379 | + "results" => $ancestry | ||
| 380 | + ); | ||
| 381 | + } | ||
| 382 | + | ||
| 361 | } | 383 | } |
| 362 | 384 | ||
| 363 | /** | 385 | /** |
| @@ -411,6 +433,35 @@ class KTObjectService extends KTCMISBase { | @@ -411,6 +433,35 @@ class KTObjectService extends KTCMISBase { | ||
| 411 | ); | 433 | ); |
| 412 | } | 434 | } |
| 413 | 435 | ||
| 436 | + /** | ||
| 437 | + * Function to create a folder | ||
| 438 | + * | ||
| 439 | + * @param string $repositoryId The repository to which the folder must be added | ||
| 440 | + * @param string $typeId Object Type id for the folder object being created | ||
| 441 | + * @param array $properties Array of properties which must be applied to the created folder object | ||
| 442 | + * @param string $folderId The id of the folder which will be the parent of the created folder object | ||
| 443 | + * @return string $objectId The id of the created folder object | ||
| 444 | + */ | ||
| 445 | + function createFolder($repositoryId, $typeId, $properties, $folderId) | ||
| 446 | + { | ||
| 447 | + $objectId = null; | ||
| 448 | + | ||
| 449 | + $objectId = $this->ObjectService->createFolder($repositoryId, $typeId, $properties, $folderId); | ||
| 450 | + | ||
| 451 | + if (PEAR::isError($propertiesResult)) | ||
| 452 | + { | ||
| 453 | + return array( | ||
| 454 | + "status_code" => 1, | ||
| 455 | + "message" => "Failed getting properties for object" | ||
| 456 | + ); | ||
| 457 | + } | ||
| 458 | + | ||
| 459 | + return array( | ||
| 460 | + 'status_code' => 0, | ||
| 461 | + 'results' => $objectId | ||
| 462 | + ); | ||
| 463 | + } | ||
| 464 | + | ||
| 414 | } | 465 | } |
| 415 | 466 | ||
| 416 | ?> | 467 | ?> |
tests/ktcmis/testCmisApi.php
| 1 | <?php | 1 | <?php |
| 2 | require_once (KT_DIR . '/tests/test.php'); | 2 | require_once (KT_DIR . '/tests/test.php'); |
| 3 | -require_once (KT_DIR . '/ktcmis/ktcmis.inc.php'); | 3 | +require_once (KT_LIB_DIR . '/api/ktcmis/ktcmis.inc.php'); |
| 4 | 4 | ||
| 5 | // username and password for authentication | 5 | // username and password for authentication |
| 6 | // must be set correctly for all of the tests to pass in all circumstances | 6 | // must be set correctly for all of the tests to pass in all circumstances |
| 7 | define (KT_TEST_USER, 'admin'); | 7 | define (KT_TEST_USER, 'admin'); |
| 8 | define (KT_TEST_PASS, 'admin'); | 8 | define (KT_TEST_PASS, 'admin'); |
| 9 | 9 | ||
| 10 | +define (DEBUG_CMIS, false); | ||
| 11 | + | ||
| 10 | /** | 12 | /** |
| 11 | * These are the unit tests for the main KTCMIS class | 13 | * These are the unit tests for the main KTCMIS class |
| 12 | * | 14 | * |
| @@ -44,7 +46,6 @@ class CMISTestCase extends KTUnitTestCase { | @@ -44,7 +46,6 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 44 | public function setUp() { | 46 | public function setUp() { |
| 45 | $this->ktapi = new KTAPI(); | 47 | $this->ktapi = new KTAPI(); |
| 46 | $this->session = $this->ktapi->start_session(KT_TEST_USER, KT_TEST_PASS); | 48 | $this->session = $this->ktapi->start_session(KT_TEST_USER, KT_TEST_PASS); |
| 47 | - $this->ktcmis = new KTCMIS($this->ktapi); | ||
| 48 | $this->root = $this->ktapi->get_root_folder(); | 49 | $this->root = $this->ktapi->get_root_folder(); |
| 49 | $this->folders = array(); | 50 | $this->folders = array(); |
| 50 | $this->docs = array(); | 51 | $this->docs = array(); |
| @@ -60,9 +61,11 @@ class CMISTestCase extends KTUnitTestCase { | @@ -60,9 +61,11 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 60 | // Repository service functions | 61 | // Repository service functions |
| 61 | function testRepositoryServices() | 62 | function testRepositoryServices() |
| 62 | { | 63 | { |
| 64 | + $RepositoryService = new KTRepositoryService(); | ||
| 65 | + | ||
| 63 | // TEST 1 | 66 | // TEST 1 |
| 64 | // test get repositories | 67 | // test get repositories |
| 65 | - $response = $this->ktcmis->getRepositories(); | 68 | + $response = $RepositoryService->getRepositories(); |
| 66 | 69 | ||
| 67 | $this->assertEqual($response['status_code'], 0); | 70 | $this->assertEqual($response['status_code'], 0); |
| 68 | $this->assertNotNull($response['results'][0]); | 71 | $this->assertNotNull($response['results'][0]); |
| @@ -91,7 +94,7 @@ class CMISTestCase extends KTUnitTestCase { | @@ -91,7 +94,7 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 91 | // test getting info for specified repository | 94 | // test getting info for specified repository |
| 92 | 95 | ||
| 93 | // get info | 96 | // get info |
| 94 | - $response = $this->ktcmis->getRepositoryInfo($repositoryId); | 97 | + $response = $RepositoryService->getRepositoryInfo($repositoryId); |
| 95 | 98 | ||
| 96 | $this->assertEqual($response['status_code'], 0); | 99 | $this->assertEqual($response['status_code'], 0); |
| 97 | $this->assertNotNull($response['results']); | 100 | $this->assertNotNull($response['results']); |
| @@ -119,7 +122,7 @@ class CMISTestCase extends KTUnitTestCase { | @@ -119,7 +122,7 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 119 | // TEST 3 | 122 | // TEST 3 |
| 120 | // test get object types supported by specified repository | 123 | // test get object types supported by specified repository |
| 121 | 124 | ||
| 122 | - $response = $this->ktcmis->getTypes($repositoryId); | 125 | + $response = $RepositoryService->getTypes($repositoryId); |
| 123 | 126 | ||
| 124 | $this->assertEqual($response['status_code'], 0); | 127 | $this->assertEqual($response['status_code'], 0); |
| 125 | $this->assertNotNull($response['results']); | 128 | $this->assertNotNull($response['results']); |
| @@ -148,7 +151,7 @@ class CMISTestCase extends KTUnitTestCase { | @@ -148,7 +151,7 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 148 | // now get info | 151 | // now get info |
| 149 | foreach ($types as $typeId) | 152 | foreach ($types as $typeId) |
| 150 | { | 153 | { |
| 151 | - $response = $this->ktcmis->getTypeDefinition($repositoryId, $typeId); | 154 | + $response = $RepositoryService->getTypeDefinition($repositoryId, $typeId); |
| 152 | 155 | ||
| 153 | $this->assertEqual($response['status_code'], 0); | 156 | $this->assertEqual($response['status_code'], 0); |
| 154 | $this->assertNotNull($response['results']); | 157 | $this->assertNotNull($response['results']); |
| @@ -169,18 +172,20 @@ class CMISTestCase extends KTUnitTestCase { | @@ -169,18 +172,20 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 169 | } | 172 | } |
| 170 | 173 | ||
| 171 | // test printout | 174 | // test printout |
| 172 | - echo '<div> </div>'; | 175 | + if (DEBUG_CMIS) echo '<div> </div>'; |
| 173 | } | 176 | } |
| 174 | 177 | ||
| 175 | // Navigation service functions | 178 | // Navigation service functions |
| 176 | function testNavigationServices() | 179 | function testNavigationServices() |
| 177 | { | 180 | { |
| 181 | + $NavigationService = new KTNavigationService(); | ||
| 182 | + $NavigationService->startSession(KT_TEST_USER, KT_TEST_PASS); | ||
| 183 | + | ||
| 178 | // set up the folder/doc tree structure with which we will be testing | 184 | // set up the folder/doc tree structure with which we will be testing |
| 179 | $this->createFolderDocStructure(); | 185 | $this->createFolderDocStructure(); |
| 180 | 186 | ||
| 181 | - // TEST 1 | ||
| 182 | - // test getting descendants | ||
| 183 | - $response = $this->ktcmis->getRepositories(); | 187 | + $RepositoryService = new KTRepositoryService(); |
| 188 | + $response = $RepositoryService->getRepositories(); | ||
| 184 | 189 | ||
| 185 | $this->assertEqual($response['status_code'], 0); | 190 | $this->assertEqual($response['status_code'], 0); |
| 186 | $this->assertNotNull($response['results'][0]); | 191 | $this->assertNotNull($response['results'][0]); |
| @@ -189,12 +194,15 @@ class CMISTestCase extends KTUnitTestCase { | @@ -189,12 +194,15 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 189 | $repository = $response['results'][0]; | 194 | $repository = $response['results'][0]; |
| 190 | $repositoryId = $repository['repositoryId']; | 195 | $repositoryId = $repository['repositoryId']; |
| 191 | 196 | ||
| 197 | + // TEST 1 | ||
| 198 | + // test getting descendants | ||
| 192 | // test descendant functionality on first of created folders, should have depth 2; | 199 | // test descendant functionality on first of created folders, should have depth 2; |
| 193 | $folderid = 'F' . $this->folders[1]; | 200 | $folderid = 'F' . $this->folders[1]; |
| 201 | +// echo "FOLDER: $folderid<BR>"; | ||
| 194 | // $folderid = 'F1'; | 202 | // $folderid = 'F1'; |
| 195 | 203 | ||
| 196 | $depth = 2; | 204 | $depth = 2; |
| 197 | - $result = $this->ktcmis->getDescendants($repositoryId, $folderid, false, false, $depth); | 205 | + $result = $NavigationService->getDescendants($repositoryId, $folderid, false, false, $depth); |
| 198 | // echo '<pre>'.print_r($result, true).'</pre>'; | 206 | // echo '<pre>'.print_r($result, true).'</pre>'; |
| 199 | // var_dump($result); | 207 | // var_dump($result); |
| 200 | $this->assertEqual($response['status_code'], 0); | 208 | $this->assertEqual($response['status_code'], 0); |
| @@ -217,7 +225,7 @@ class CMISTestCase extends KTUnitTestCase { | @@ -217,7 +225,7 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 217 | // test getting direct children, using the second set of folders, should have a folder and a document as children | 225 | // test getting direct children, using the second set of folders, should have a folder and a document as children |
| 218 | $folderid_2 = 'F' . $this->folders[0]; | 226 | $folderid_2 = 'F' . $this->folders[0]; |
| 219 | 227 | ||
| 220 | - $result = $this->ktcmis->getChildren($repositoryId, $folderid_2, false, false); | 228 | + $result = $NavigationService->getChildren($repositoryId, $folderid_2, false, false); |
| 221 | $this->assertNotNull($result['results']); | 229 | $this->assertNotNull($result['results']); |
| 222 | 230 | ||
| 223 | $children = $result['results']; | 231 | $children = $result['results']; |
| @@ -234,7 +242,7 @@ class CMISTestCase extends KTUnitTestCase { | @@ -234,7 +242,7 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 234 | // test getting folder parent, using first created folder, parent should be root folder | 242 | // test getting folder parent, using first created folder, parent should be root folder |
| 235 | 243 | ||
| 236 | // echo "OUTPUT FROM FIRST TEST<BR>"; | 244 | // echo "OUTPUT FROM FIRST TEST<BR>"; |
| 237 | - $ancestry = $this->ktcmis->getFolderParent($repositoryId, $folderid, false, false, false); | 245 | + $ancestry = $NavigationService->getFolderParent($repositoryId, $folderid, false, false, false); |
| 238 | $this->assertNotNull($ancestry['results']); | 246 | $this->assertNotNull($ancestry['results']); |
| 239 | // echo "OUTPUT FROM FIRST TEST<BR>"; | 247 | // echo "OUTPUT FROM FIRST TEST<BR>"; |
| 240 | // echo '<pre>'.print_r($ancestry, true).'</pre>'; | 248 | // echo '<pre>'.print_r($ancestry, true).'</pre>'; |
| @@ -247,7 +255,7 @@ class CMISTestCase extends KTUnitTestCase { | @@ -247,7 +255,7 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 247 | 255 | ||
| 248 | // echo "OUTPUT FROM SECOND TEST<BR>"; | 256 | // echo "OUTPUT FROM SECOND TEST<BR>"; |
| 249 | // TODO since here we are testing more than one level up, add check for depth as with testGetDescendants | 257 | // TODO since here we are testing more than one level up, add check for depth as with testGetDescendants |
| 250 | - $ancestry = $this->ktcmis->getFolderParent($repositoryId, $subfolder_id, false, false, true); | 258 | + $ancestry = $NavigationService->getFolderParent($repositoryId, $subfolder_id, false, false, true); |
| 251 | $this->assertNotNull($ancestry['results']); | 259 | $this->assertNotNull($ancestry['results']); |
| 252 | // echo "OUTPUT FROM SECOND TEST<BR>"; | 260 | // echo "OUTPUT FROM SECOND TEST<BR>"; |
| 253 | // echo '<pre>'.print_r($ancestry, true).'</pre>'; | 261 | // echo '<pre>'.print_r($ancestry, true).'</pre>'; |
| @@ -262,7 +270,7 @@ class CMISTestCase extends KTUnitTestCase { | @@ -262,7 +270,7 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 262 | // test getting object parent(s) with a document | 270 | // test getting object parent(s) with a document |
| 263 | 271 | ||
| 264 | $objectId = 'D' . $this->docs[0]->get_documentid(); | 272 | $objectId = 'D' . $this->docs[0]->get_documentid(); |
| 265 | - $ancestry = $this->ktcmis->getObjectParents($repositoryId, $objectId, false, false); | 273 | + $ancestry = $NavigationService->getObjectParents($repositoryId, $objectId, false, false); |
| 266 | $this->assertNotNull($ancestry); | 274 | $this->assertNotNull($ancestry); |
| 267 | // echo '<pre>'.print_r($ancestry, true).'</pre>'; | 275 | // echo '<pre>'.print_r($ancestry, true).'</pre>'; |
| 268 | 276 | ||
| @@ -273,7 +281,7 @@ class CMISTestCase extends KTUnitTestCase { | @@ -273,7 +281,7 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 273 | // test getting object parent(s) with a folder | 281 | // test getting object parent(s) with a folder |
| 274 | 282 | ||
| 275 | $objectId = 'F' . $this->subfolders[0]; | 283 | $objectId = 'F' . $this->subfolders[0]; |
| 276 | - $ancestry = $this->ktcmis->getObjectParents($repositoryId, $objectId, false, false); | 284 | + $ancestry = $NavigationService->getObjectParents($repositoryId, $objectId, false, false); |
| 277 | $this->assertNotNull($ancestry); | 285 | $this->assertNotNull($ancestry); |
| 278 | // echo '<pre>'.print_r($ancestry, true).'</pre>'; | 286 | // echo '<pre>'.print_r($ancestry, true).'</pre>'; |
| 279 | 287 | ||
| @@ -284,20 +292,21 @@ class CMISTestCase extends KTUnitTestCase { | @@ -284,20 +292,21 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 284 | $this->cleanupFolderDocStructure(); | 292 | $this->cleanupFolderDocStructure(); |
| 285 | 293 | ||
| 286 | // test printout | 294 | // test printout |
| 287 | - echo '<div> </div>'; | 295 | + if (DEBUG_CMIS) echo '<div> </div>'; |
| 288 | } | 296 | } |
| 289 | 297 | ||
| 290 | // Object Services | 298 | // Object Services |
| 291 | 299 | ||
| 292 | function testObjectServices() | 300 | function testObjectServices() |
| 293 | { | 301 | { |
| 302 | + $ObjectService = new KTObjectService(); | ||
| 303 | + $ObjectService->startSession(KT_TEST_USER, KT_TEST_PASS); | ||
| 304 | + | ||
| 294 | // set up the folder/doc tree structure with which we will be testing | 305 | // set up the folder/doc tree structure with which we will be testing |
| 295 | $this->createFolderDocStructure(); | 306 | $this->createFolderDocStructure(); |
| 296 | - | ||
| 297 | - // TEST 1 | ||
| 298 | - // test getting properties for a specific object | ||
| 299 | 307 | ||
| 300 | - $response = $this->ktcmis->getRepositories(); | 308 | + $RepositoryService = new KTRepositoryService(); |
| 309 | + $response = $RepositoryService->getRepositories(); | ||
| 301 | 310 | ||
| 302 | $this->assertEqual($response['status_code'], 0); | 311 | $this->assertEqual($response['status_code'], 0); |
| 303 | $this->assertNotNull($response['results'][0]); | 312 | $this->assertNotNull($response['results'][0]); |
| @@ -305,10 +314,12 @@ class CMISTestCase extends KTUnitTestCase { | @@ -305,10 +314,12 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 305 | // we only expect one repository | 314 | // we only expect one repository |
| 306 | $repository = $response['results'][0]; | 315 | $repository = $response['results'][0]; |
| 307 | $repositoryId = $repository['repositoryId']; | 316 | $repositoryId = $repository['repositoryId']; |
| 308 | - | 317 | + |
| 318 | + // TEST 1 | ||
| 319 | + // test getting properties for a specific object | ||
| 309 | $objectId = 'F'.$this->folders[0]; | 320 | $objectId = 'F'.$this->folders[0]; |
| 310 | 321 | ||
| 311 | - $properties = $this->ktcmis->getProperties($repositoryId, $objectId, false, false); | 322 | + $properties = $ObjectService->getProperties($repositoryId, $objectId, false, false); |
| 312 | $this->assertNotNull($properties['results']); | 323 | $this->assertNotNull($properties['results']); |
| 313 | // echo '<pre>'.print_r($properties['results'], true).'</pre>'; | 324 | // echo '<pre>'.print_r($properties['results'], true).'</pre>'; |
| 314 | // | 325 | // |
| @@ -317,17 +328,33 @@ class CMISTestCase extends KTUnitTestCase { | @@ -317,17 +328,33 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 317 | 328 | ||
| 318 | $objectId = 'D'.$this->docs[0]->get_documentid(); | 329 | $objectId = 'D'.$this->docs[0]->get_documentid(); |
| 319 | 330 | ||
| 320 | - $properties = $this->ktcmis->getProperties($repositoryId, $objectId, false, false); | 331 | + $properties = $ObjectService->getProperties($repositoryId, $objectId, false, false); |
| 321 | $this->assertNotNull($properties['results']); | 332 | $this->assertNotNull($properties['results']); |
| 322 | 333 | ||
| 323 | // test printout | 334 | // test printout |
| 324 | $this->printTable($properties['results'][0], 'Properties for Folder Object ' . $objectId . ' (getProperties())'); | 335 | $this->printTable($properties['results'][0], 'Properties for Folder Object ' . $objectId . ' (getProperties())'); |
| 325 | 336 | ||
| 337 | + // TEST 2 | ||
| 338 | + // test creation of a folder (random name so that we don't have to clean up after) | ||
| 339 | + // TODO test invalid type | ||
| 340 | + // TODO test invalid parent folder | ||
| 341 | + // TODO other invalid parameters | ||
| 342 | + $created = $ObjectService->createFolder($repositoryId, 'Folder', array('name' => 'My Test Folder ' . mt_rand()), 1); | ||
| 343 | + $this->assertNotNull($created['results']); | ||
| 344 | + | ||
| 345 | + // delete created folder | ||
| 346 | + if (!is_null($created['results'])) | ||
| 347 | + { | ||
| 348 | + $folder_id = $created['results']; | ||
| 349 | + CMISUtil::decodeObjectId($folder_id); | ||
| 350 | + $this->ktapi->delete_folder($folder_id, 'Testing API', KT_TEST_USER, KT_TEST_PASS); | ||
| 351 | + } | ||
| 352 | + | ||
| 326 | // tear down the folder/doc tree structure with which we were testing | 353 | // tear down the folder/doc tree structure with which we were testing |
| 327 | $this->cleanupFolderDocStructure(); | 354 | $this->cleanupFolderDocStructure(); |
| 328 | 355 | ||
| 329 | // test printout | 356 | // test printout |
| 330 | - echo '<div> </div>'; | 357 | + if (DEBUG_CMIS) echo '<div> </div>'; |
| 331 | } | 358 | } |
| 332 | 359 | ||
| 333 | /** | 360 | /** |
| @@ -493,8 +520,9 @@ class CMISTestCase extends KTUnitTestCase { | @@ -493,8 +520,9 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 493 | 520 | ||
| 494 | function printTable($results, $header, $subheader = '', $depth = 1) | 521 | function printTable($results, $header, $subheader = '', $depth = 1) |
| 495 | { | 522 | { |
| 496 | - // turn off for testing :) | ||
| 497 | -// return null; | 523 | + if (!DEBUG_CMIS) return null; |
| 524 | + if (!is_array($results)) return null; | ||
| 525 | + | ||
| 498 | ?><div> </div> | 526 | ?><div> </div> |
| 499 | <table border="2"><tr><td colspan="2"><div style="padding: 8px; background-color: green; color: white;"><?php | 527 | <table border="2"><tr><td colspan="2"><div style="padding: 8px; background-color: green; color: white;"><?php |
| 500 | echo $header; | 528 | echo $header; |
| @@ -542,6 +570,9 @@ class CMISTestCase extends KTUnitTestCase { | @@ -542,6 +570,9 @@ class CMISTestCase extends KTUnitTestCase { | ||
| 542 | 570 | ||
| 543 | function printTree($results, $header, $depth = 1) | 571 | function printTree($results, $header, $depth = 1) |
| 544 | { | 572 | { |
| 573 | + if (!DEBUG_CMIS) return null; | ||
| 574 | + if (!is_array($results)) return null; | ||
| 575 | + | ||
| 545 | ?><div> </div> | 576 | ?><div> </div> |
| 546 | <table border="2"><tr><td colspan="<?php echo 1 + $depth; ?>"><div style="padding: 8px; background-color: green; color: white;"><?php | 577 | <table border="2"><tr><td colspan="<?php echo 1 + $depth; ?>"><div style="padding: 8px; background-color: green; color: white;"><?php |
| 547 | echo $header; | 578 | echo $header; |