[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gallery-checkins
Subject:    [Gallery-checkins] CVS: gallery2/modules/core/test/phpunit ChildTest.class,NONE,1.1 CoreModuleTest.c
From:       Bharat Mediratta <bharat () users ! sourceforge ! net>
Date:       2003-03-31 8:55:40
[Download RAW message or body]

Update of /cvsroot/gallery/gallery2/modules/core/test/phpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv24284/modules/core/test/phpunit

Modified Files:
	CoreModuleTest.class ItemTest.class 
Added Files:
	ChildTest.class 
Log Message:
* changed core permissions; now we have core.addDataItem and core.addAlbumItem 
  so that it's clear which one you have permission to add. 
 
* Fixed some bad return codes in ItemEditPermissions 
 
* Added GalleryItemHelper::fetchAllItemIds which can return all items of  
  a given type (with given permissions) 
 
* Heavily refactored ItemMove to avoid walking the tree to find out 
  where we can move items since that is very slow.  Now we get a list of all 
  destinations that accept data/album items and then present that in a 
  nice tree form to the user.  We use javascript on the front end to help 
  the user avoid trying to move album/data items into albums where they don't 
  have the right permissions. 
 
* The recent refactor where we count on having an active user id was breaking 
  the core bootstrap code where create the root album, so now I've changed it 
  so that the bootstrap sets the active user id to the admin user after the 
  admin user is created. 
 
* Deleted GalleryChildEntity::getDescendantsList(), in favor of  
  GalleryItemHelper::fetchAllItemIds 
 
* Renamed GalleryChildEntityHelper::getChildCounts() -> fetchChildIds() so that 
  it matches the get/fetch naming semantics 
 
* getMemberData() now encodes the classname, which is used by the debug module. 
 
* Added GalleryTemplateAdapter::elementName() so that we can extract a form 
  element name for use in JavaScript. 
 
* Improved several theme templates to support javascript 
 
* Extended ItemTest, added ChildTest 
 
* Refactored the debug module so that it doesn't do a tree walk to display the 
  page (this was excruciatingly slow on albums with a few hundred GalleryItems) 



***** Error reading new file[Errno 2] No such file or directory: 'ChildTest.class'
Index: CoreModuleTest.class
===================================================================
RCS file: /cvsroot/gallery/gallery2/modules/core/test/phpunit/CoreModuleTest.class,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- CoreModuleTest.class	18 Mar 2003 07:11:25 -0000	1.5
+++ CoreModuleTest.class	31 Mar 2003 08:55:06 -0000	1.6
@@ -105,7 +105,9 @@
 				  array('name' => $t ? 'Berechtigungen': 'Permissions',
 					'view' => 'core:ItemEditPermissions'),
 				  array('name' => $t ? 'Elemente hinzuf&uuml;gen' : 'Add Items',
-					'view' => 'core:ItemAddChildren')
+					'view' => 'core:ItemAddChildren'),
+				  array('name' => $t ? 'Album hinzuf&uuml;gen' : 'Add Album',
+					'view' => 'core:ItemAddAlbum')
 				  ),
 			    $content);
     }

Index: ItemTest.class
===================================================================
RCS file: /cvsroot/gallery/gallery2/modules/core/test/phpunit/ItemTest.class,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ItemTest.class	24 Mar 2003 05:51:34 -0000	1.2
+++ ItemTest.class	31 Mar 2003 08:55:07 -0000	1.3
@@ -142,6 +142,24 @@
 		    return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
 		}
 
+		// Can add data item via group perm
+		$ret = GalleryPermissionMap::addGroupPermission($this->_childItems[$i]->getId(),
+								$groupId,
+								'core.addDataItem',
+								false);
+		if ($ret->isError()) {
+		    return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
+		}
+
+		// Can add data item via group perm
+		$ret = GalleryPermissionMap::addGroupPermission($this->_childItems[$i]->getId(),
+								$groupId,
+								'core.changeText',
+								false);
+		if ($ret->isError()) {
+		    return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
+		}
+
 		break;
 
 	    case 2:
@@ -245,16 +263,50 @@
 
     function testGetPermissions() {
 	list ($ret, $perms) = GalleryItemHelper::getPermissions($this->_childItems[0]->getId());
+	if ($ret->isError()) {
+	    return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
+	}
 	$this->assertEquals(array('core.delete' => 1), $perms);
 
 	list ($ret, $perms) = GalleryItemHelper::getPermissions($this->_childItems[1]->getId());
-	$this->assertEquals(array('core.view' => 1), $perms);
+	if ($ret->isError()) {
+	    return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
+	}
+	$this->assertEquals(array('core.view' => 1,
+				  'core.addDataItem' => 1,
+				  'core.changeText' => 1), $perms);
 
 	list ($ret, $perms) = GalleryItemHelper::getPermissions($this->_childItems[2]->getId());
+	if ($ret->isError()) {
+	    return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
+	}
 	$this->assertEquals(array('core.view' => 1,
 				  'core.delete' => 1), $perms);
     }
 
+    function testFetchAllItemIds() {
+	list ($ret, $ids) = GalleryItemHelper::fetchAllItemIds('GalleryAlbumItem');
+	if ($ret->isError()) {
+	    return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
+	}
+
+	/* We should see childs 1 & 2, but not child 0 or the parent. */
+	$this->assert(!in_array($this->_parentItem->getId(), $ids), "parent");
+	$this->assert(!in_array($this->_childItems[0]->getId(), $ids), "child 0");
+	$this->assert(in_array($this->_childItems[1]->getId(), $ids), "child 1");
+	$this->assert(in_array($this->_childItems[2]->getId(), $ids), "child 2");
+
+	list ($ret, $ids) = GalleryItemHelper::fetchAllItemIds('GalleryAlbumItem', 'core.addDataItem');
+	if ($ret->isError()) {
+	    return $this->failWithStatus($ret->wrap(__FILE__, __LINE__));
+	}
+
+	/* We should only see child 1 */
+	$this->assert(!in_array($this->_parentItem->getId(), $ids), "parent");
+	$this->assert(!in_array($this->_childItems[0]->getId(), $ids), "child 0");
+	$this->assert(in_array($this->_childItems[1]->getId(), $ids), "child 1");
+	$this->assert(!in_array($this->_childItems[2]->getId(), $ids), "child 2");
+    }
 }
 
 ?>



-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
__[ g a l l e r y - c h e c k i n s ]_________________________

[ list info/archive --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic