[pLog-svn] r4076 - plog/branches/lifetype-1.1.1/class/test/tests/net/xmlrpc

oscar at devel.lifetype.net oscar at devel.lifetype.net
Mon Oct 2 12:15:15 GMT 2006


Author: oscar
Date: 2006-10-02 12:15:13 +0000 (Mon, 02 Oct 2006)
New Revision: 4076

Modified:
   plog/branches/lifetype-1.1.1/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php
Log:
fixed one of the tests, as there cannot be an article without at least one category. My PHP is configured to spit out errors and warnings to the browser (as opposed to error_log) so the warnings were causing the xmlrpc client to fail (and therefore, the test failed too)


Modified: plog/branches/lifetype-1.1.1/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php
===================================================================
--- plog/branches/lifetype-1.1.1/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php	2006-10-01 21:58:21 UTC (rev 4075)
+++ plog/branches/lifetype-1.1.1/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php	2006-10-02 12:15:13 UTC (rev 4076)
@@ -73,6 +73,7 @@
 			                            "Description for category General",
 										$this->blog->getId(),
 										true );
+										
 			$cats = new ArticleCategories();
 			if( !$cats->addArticleCategory( $this->cat )) {
 				throw(  new Exception( "Error adding test category!" ));
@@ -970,7 +971,7 @@
 			$article = new Article(
 				"topic",
 				"text",
-				Array(),
+				Array( $this->cat->getId()),
 				$this->owner->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
@@ -979,11 +980,22 @@
 			$articles = new Articles();
 			$this->assertTrue( $articles->addArticle( $article ), "Unable to add a new test article" );
 			
+			// another category
+			$cat2 = new ArticleCategory( "General2", 
+			                              "Description for category General2",
+										  $this->blog->getId(),
+										  true );			
+			$cats = new ArticleCategories();
+			if( !$cats->addArticleCategory( $cat2 )) {
+				throw(  new Exception( "Error adding test category!" ));
+				die();
+			}		  
+			
 			// Construct the Category Struct
 			$categories = Array();
 			$theCategory = Array();
-			$theCategory["categoryName"] = $this->cat->getName();
-			$theCategory["categoryId"] = $this->cat->getId();
+			$theCategory["categoryName"] = $cat2->getName();
+			$theCategory["categoryId"] = $cat2->getId();
 			$categories[] = $theCategory;
 			
 			// make the method call
@@ -1001,11 +1013,12 @@
 			// make sure that the call returned ok
 			$response = $c->getResponse();
 			$this->assertTrue( $response, "mt.setPostCategories did not return a valid response" );
-			
-			
+						
 			// check that the post was successfully updated
 			$updatedArticle = $articles->getArticle( $article->getId());
-			$this->assertEquals( $this->cat->getId(), $updatedArticle->_categoryIds[0]);
+			$this->assertEquals( $cat2->getId(), $updatedArticle->_categoryIds[0]);
+			
+			$cats->deleteCategory( $cat2->getId(), $this->blog->getId());
 
 			// get the response and see that it has the right encoding
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog ), 



More information about the pLog-svn mailing list