You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by ri...@apache.org on 2013/07/14 05:32:54 UTC
svn commit: r1502932 - in /chemistry/phpclient/trunk: README-atom
atom/cmis/cmis_service.php test/atom/AlfrescoH2CMISTest.php
Author: richardm
Date: Sun Jul 14 03:32:54 2013
New Revision: 1502932
URL: http://svn.apache.org/r1502932
Log:
Fixes for CMIUS-652 and CMIS-691
Modified:
chemistry/phpclient/trunk/README-atom
chemistry/phpclient/trunk/atom/cmis/cmis_service.php
chemistry/phpclient/trunk/test/atom/AlfrescoH2CMISTest.php
Modified: chemistry/phpclient/trunk/README-atom
URL: http://svn.apache.org/viewvc/chemistry/phpclient/trunk/README-atom?rev=1502932&r1=1502931&r2=1502932&view=diff
==============================================================================
--- chemistry/phpclient/trunk/README-atom (original)
+++ chemistry/phpclient/trunk/README-atom Sun Jul 14 03:32:54 2013
@@ -49,6 +49,9 @@ DOCS
The docs were built with the following command
phpdoc -t docs/atom -d atom
+Testing
+php ../utils/phpunit.phar <classname>
+php -e -d display_errors=On ../utils/phpunit.phar --debug -v <classname>
==============
Adding Calls that mimick the domain model
Modified: chemistry/phpclient/trunk/atom/cmis/cmis_service.php
URL: http://svn.apache.org/viewvc/chemistry/phpclient/trunk/atom/cmis/cmis_service.php?rev=1502932&r1=1502931&r2=1502932&view=diff
==============================================================================
--- chemistry/phpclient/trunk/atom/cmis/cmis_service.php (original)
+++ chemistry/phpclient/trunk/atom/cmis/cmis_service.php Sun Jul 14 03:32:54 2013
@@ -248,7 +248,7 @@ class CMISService extends CMISRepository
* @internal
*/
function getLink($objectId, $linkName) {
- if ($this->_link_cache[$objectId][$linkName]) {
+ if (isset($this->_link_cache[$objectId][$linkName])) {
return $this->_link_cache[$objectId][$linkName];
}
$obj = $this->getObject($objectId);
@@ -475,7 +475,7 @@ class CMISService extends CMISRepository
$myURL = $this->getLink($folderId, LINK_UP);
//TODO: Need GenURLQueryString Utility
$ret = $this->doGet($myURL);
- $obj = $this->extractObjectEntry($ret->body);
+ $obj = CMISRepositoryWrapper::extractObject($ret->body);
$this->cacheObjectInfo($obj);
return $obj;
}
@@ -989,7 +989,7 @@ xmlns:cmisra="http://docs.oasis-open.org
} else {
$hash_values = array ();
}
- if ($this->_changeToken_cache[$objectId] != null) {
+ if (isset($this->_changeToken_cache[$objectId])) {
$properties['cmis:changeToken'] = $this->_changeToken_cache[$objectId];
}
@@ -1001,6 +1001,9 @@ xmlns:cmisra="http://docs.oasis-open.org
}
$hash_values["PROPERTIES"] = $properties_xml;
$hash_values["SUMMARY"] = CMISService :: getSummaryTemplate();
+ if (isset($properties["cmis:name"])) {
+ $objectName=$properties["cmis:name"];
+ }
if (!isset ($hash_values['title'])) {
$hash_values['title'] = $objectName;
}
@@ -1008,7 +1011,6 @@ xmlns:cmisra="http://docs.oasis-open.org
$hash_values['summary'] = $objectName;
}
$put_value = CMISRepositoryWrapper :: processTemplate($entry_template, $hash_values);
- // print $put_value; // RRM DEBUG
$ret = $this->doPut($obj_url, $put_value, MIME_ATOM_XML_ENTRY);
$obj = $this->extractObject($ret->body);
$this->cacheObjectInfo($obj);
Modified: chemistry/phpclient/trunk/test/atom/AlfrescoH2CMISTest.php
URL: http://svn.apache.org/viewvc/chemistry/phpclient/trunk/test/atom/AlfrescoH2CMISTest.php?rev=1502932&r1=1502931&r2=1502932&view=diff
==============================================================================
--- chemistry/phpclient/trunk/test/atom/AlfrescoH2CMISTest.php (original)
+++ chemistry/phpclient/trunk/test/atom/AlfrescoH2CMISTest.php Sun Jul 14 03:32:54 2013
@@ -9,26 +9,61 @@ require_once('../utils/phpunit.phar');
require_once('../../atom/cmis-lib.php');
class AlfrescoCMISH2Test extends PHPUnit_Framework_TestCase
{
- protected $client;
- protected function setUp() {
+ protected static $client;
+ protected static $unitTestFolder;
+ public static function setUpBeforeClass() {
+ echo "Set Up Before Class";
$repo_url = "http://localhost:8080/alfresco/cmisatom";
$repo_username = "admin";
$repo_password = "admin";
- $this->client = new CMISService($repo_url, $repo_username, $repo_password);
+ AlfrescoCMISH2Test::$client = new CMISService($repo_url, $repo_username, $repo_password);
+ $rootFolder = AlfrescoCMISH2Test::$client->getObjectByPath("/");
+ $unitTestFolderHome = null;
+ try {
+ $unitTestFolderHome = AlfrescoCMISH2Test::$client->getObjectByPath("/UnitTest");
+ } catch (CmisObjectNotFoundException $x) {
+ $unitTestFolderHome = AlfrescoCMISH2Test::$client->createFolder($rootFolder->id,"UnitTest");
+ }
+ AlfrescoCMISH2Test::$unitTestFolder = AlfrescoCMISH2Test::$client->createFolder($unitTestFolderHome->id,base_convert(time(),10,36));
+ }
+ protected function setUp() {
}
public function testGetFolder() {
/*
* This test gets an known folder and tests the ability to retreive know properties
*/
- $folder = $this->client->getObjectByPath("/Sites");
+ $folder = AlfrescoCMISH2Test::$client->getObjectByPath("/Sites");
$this->assertEquals("F:st:sites",$folder->properties["cmis:objectTypeId"]);
$this->assertEquals("cmis:folder",$folder->properties["cmis:baseTypeId"]);
}
+ public function testGetFolderParent() {
+ /*
+ * This test gets an known folder and tests the ability to retreive know properties
+ */
+ $folder = AlfrescoCMISH2Test::$client->getObjectByPath("/Sites");
+ $parentFolder = AlfrescoCMISH2Test::$client->getFolderParent($folder->id);
+ $rootFolder = AlfrescoCMISH2Test::$client->getObjectByPath("/");
+ $this->assertEquals($parentFolder->id,$rootFolder->id);
+ }
/**
* @expectedException CmisObjectNotFoundException
*/
public function testInvalidCreateFolder() {
- $folder = $this->client->getObjectByPath("/x");
- $folder = $this->client->createFolder($folder->id,"TEST");
+ $folder = AlfrescoCMISH2Test::$client->getObjectByPath("/x");
+ $folder = AlfrescoCMISH2Test::$client->createFolder($folder->id,"TEST");
+ }
+
+ /**
+ * Create a Folder and change its name
+ * This will only work in an Alfresco Repository
+ */
+ public function testRenameFolder() {
+ $folder = AlfrescoCMISH2Test::$client->createFolder(AlfrescoCMISH2Test::$unitTestFolder->id,"TEST",array("cmis:objectTypeId" => "F:cmiscustom:folder","cmiscustom:folderprop_string" => "Original Value"));
+ $newProps = array( "cmis:name" => "Renamed Test","cmiscustom:folderprop_string" => "New Value");
+ $this->assertEquals("Original Value",$folder->properties["cmiscustom:folderprop_string"]);
+ $folder = AlfrescoCMISH2Test::$client->updateProperties($folder->id,$newProps);
+ $this->assertEquals("Renamed Test",$folder->properties["cmis:name"]);
+ $this->assertEquals("New Value",$folder->properties["cmiscustom:folderprop_string"]);
}
+
}
\ No newline at end of file