/** * Fetch the list of supported object types for the selected repository * * @param string $repositoryId The ID of the repository for which object types must be returned * @param string $typeId The type to return, ALL if not set * @param boolean $returnPropertyDefinitions Return property definitions as well if TRUE * @param int $maxItems The maximum number of items to return * @param int $skipCount The number of items to skip before starting to return results * @param boolean $hasMoreItems TRUE if there are more items to return than were requested * @return cmisTypeDefinitionType[] */ public function getTypes($repositoryId, $typeId = '', $returnPropertyDefinitions = false, $maxItems = 0, $skipCount = 0, &$hasMoreItems = false) { $result = parent::getTypes($repositoryId, $typeId, $returnPropertyDefinitions, $maxItems, $skipCount, $hasMoreItems); if ($result['status_code'] == 0) { return $result['results']; } }
function testRepositoryService() { $RepositoryService = new KTRepositoryService(); // TEST 1 // test get repositories $response = $RepositoryService->getRepositories(); $this->assertEqual($response['status_code'], 0); $this->assertNotNull($response['results'][0]); // we only expect one repository, though there may be more $repository = $response['results'][0]; // check for null $this->assertNotNull($repository['repositoryId']); $this->assertNotNull($repository['repositoryName']); $this->assertNotNull($repository['repositoryURI']); // check for empty string $this->assertNotEqual(trim($repository['repositoryId']), ''); $this->assertNotEqual(trim($repository['repositoryName']), ''); $this->assertNotEqual(trim($repository['repositoryURI']), ''); // test printout $this->printTable($repository, 'Available Repositories (getRepositories())'); /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ $repositoryId = $repository['repositoryId']; // TEST 2 // test getting info for specified repository // get info $response = $RepositoryService->getRepositoryInfo($repositoryId); $this->assertEqual($response['status_code'], 0); $this->assertNotNull($response['results']); $repositoryInfo = $response['results']; // returned ID MUST match sent ID $this->assertEqual($repositoryId, $repositoryInfo['repositoryId']); // check for null $this->assertNotNull($repositoryInfo['repositoryName']); // check for empty string $this->assertNotEqual(trim($repositoryInfo['repositoryName']), ''); $capabilities = $repositoryInfo['capabilities']; $this->assertNotNull($capabilities); // echo '<pre>'.print_r($repositoryInfo, true).'</pre>'; // test printout $this->printTable($repositoryInfo, 'Repository Information for ' . $repositoryInfo['repositoryName'] . ' Repository (getRepositoryInfo())'); /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ // TEST 3 // test get object types supported by specified repository $response = $RepositoryService->getTypes($repositoryId); $this->assertEqual($response['status_code'], 0); $this->assertNotNull($response['results']); $supportedObjects = $response['results']; // echo '<pre>'.print_r($supportedObjects, true).'</pre>'; // we're expecting support for Documents and Folders // TODO change test to not care about alphabetical or order alphabetically first, // just in case at some point we manage to return the objects in another order :) // TODO this test is pretty arbitrary, needs work to properly test results, // for now just testing that something was returned $this->assertEqual($supportedObjects[0]['typeId'], 'Document'); $this->assertEqual($supportedObjects[1]['typeId'], 'Folder'); // test printout $this->printTable($supportedObjects, 'CMIS Objects Supported by the ' . $repository['repositoryName'] . ' Repository (getTypes())', 'Object Type'); /*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ // TEST 4 // test getting type definition for specified types // types to test $types = array('Document', 'Folder'); // now get info foreach ($types as $typeId) { $response = $RepositoryService->getTypeDefinition($repositoryId, $typeId); $this->assertEqual($response['status_code'], 0); $this->assertNotNull($response['results']); $typeDefinition = $response['results']; // we're expecting support for Documents and Folders // TODO change test to not care about alphabetical or order alphabetically first, // just in case at some point we manage to return the objects in another order :) // TODO this test is pretty arbitrary, needs work to properly test results, // for now just testing that something was returned which matches the requested type $this->assertEqual($typeDefinition['typeId'], $typeId); // test printout $this->printTable($typeDefinition, 'CMIS Type Definition for ' . $typeDefinition['typeId'] . ' Objects (getTypeDefinition())'); // TODO test properties as well } // test printout if (DEBUG_CMIS) { echo '<div> </div>'; } }