[pLog-svn] r6678 - in plog/branches/lifetype-1.2/class/test: helpers tests/net/xmlrpc

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Mon Jun 23 19:37:17 EDT 2008


Author: jondaley
Date: 2008-06-23 19:37:17 -0400 (Mon, 23 Jun 2008)
New Revision: 6678

Modified:
   plog/branches/lifetype-1.2/class/test/helpers/testtools.class.php
   plog/branches/lifetype-1.2/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php
Log:
add default description

Modified: plog/branches/lifetype-1.2/class/test/helpers/testtools.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/helpers/testtools.class.php	2008-06-23 23:37:06 UTC (rev 6677)
+++ plog/branches/lifetype-1.2/class/test/helpers/testtools.class.php	2008-06-23 23:37:17 UTC (rev 6678)
@@ -43,7 +43,11 @@
 
             // add a default category
             $articleCategories = new ArticleCategories();
-            $articleCategory = new ArticleCategory( "Default Category", "", $blog->getId(), true );
+            $articleCategory = new ArticleCategory( "Default Category",
+                                                    "",
+                                                    $blog->getId(),
+                                                    true,
+                                                    "This is an uninteresting description");
             $catId = $articleCategories->addArticleCategory( $articleCategory );
 
             if(!$catId)

Modified: plog/branches/lifetype-1.2/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php	2008-06-23 23:37:06 UTC (rev 6677)
+++ plog/branches/lifetype-1.2/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php	2008-06-23 23:37:17 UTC (rev 6678)
@@ -4,13 +4,13 @@
 	lt_include( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
-	lt_include( PLOG_CLASS_PATH."class/dao/bloginfo.class.php" );	
-	lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" );
-	lt_include( PLOG_CLASS_PATH."class/dao/userinfo.class.php" );	
+//	lt_include( PLOG_CLASS_PATH."class/dao/bloginfo.class.php" );	
+//	lt_include( PLOG_CLASS_PATH."class/dao/users.class.php" );
+//	lt_include( PLOG_CLASS_PATH."class/dao/userinfo.class.php" );	
 	lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/dao/articlecategory.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
-	lt_include( PLOG_CLASS_PATH."class/dao/userstatus.class.php" );	
+//	lt_include( PLOG_CLASS_PATH."class/dao/userstatus.class.php" );	
 	lt_include( PLOG_CLASS_PATH."class/net/xmlrpc/IXR_Library.lib.php" );
 	lt_include( PLOG_CLASS_PATH."class/net/url.class.php" );
 	lt_include( PLOG_CLASS_PATH."class/locale/locales.class.php" );	
@@ -20,63 +20,28 @@
 	 */
 	class XmlRpcServer_Test extends LifeTypeTestCase
 	{
-		/**
-		 * dummy blog we'll be using during the tests
-		 */
 		var $blog;
-		
-		/**
-		 * dummy blog owner
-		 */
-		var $owner;
-		
-		/**
-		 * dummy category
-		 */
+		var $user;
 		var $cat;
 		
 		function setUp()
 		{
-			// create the blog owner
-			$this->owner = new UserInfo( md5(time()),   // name
-			                             "password",   // password
-			                             "whatever at whatever.com",  // email address
-			             				 "",    // about
-			                             "" );
-			$users = new Users();
-			if( !$users->addUser( $this->owner )) {
-				throw( new Exception( "Error adding test user" ));
-				die();
-			}
-			
+			$this->user = TestTools::createUser();
+			$this->blog = TestTools::createBlog( $this->user->getId());
+            $articlecategories = new ArticleCategories();
+			$arr = $articlecategories->getBlogCategories($this->blog->getId());
+            $this->cat = $arr[0];
+            
 			// load a UTF-8 locale
 			$zhLocale =& Locales::getLocale( "zh_CN" );
-		
-			// create the test blog
+
 			$blogs = new Blogs();
-			$this->blog = null;
-			$this->blog = new BlogInfo( "test blog",
-			                            $this->owner->getId(),
-			                            "",
-			                            new BlogSettings());
 			$this->blog->setLocale( $zhLocale );
-			if( !$blogs->addBlog( $this->blog )) {
-				throw( new Exception( "Error adding test blog!" ));
-				die();
+			if(!$blogs->updateBlog( $this->blog )) {
+				print "Error adding test blog!";
+				return;
 			}
 			
-			// add a default category
-			$this->cat = new ArticleCategory( "General", 
-			                            "Description for category General",
-										$this->blog->getId(),
-										true );
-										
-			$cats = new ArticleCategories();
-			if( !$cats->addArticleCategory( $this->cat )) {
-				throw(  new Exception( "Error adding test category!" ));
-				die();
-			}
-			
 			// get the URL pointing to xmlrpc.php
 			$config =& Config::getConfig();
 			$this->url = $config->getValue( "base_url" )."/xmlrpc.php";
@@ -84,14 +49,13 @@
 		
 		function tearDown()
 		{
-			$users = new Users();
-			$users->deleteUser( $this->owner->getId());
-			
-			$cats = new ArticleCategories();
-			$cats->deleteCategory( $this->cat->getId(), $this->blog->getId());
-
-			$blogs = new Blogs();
-			$blogs->deleteBlog( $this->blog->getId());
+            $articles = new Articles();
+            $articles->deleteBlogPosts($this->blog->getId());
+            
+			TestTools::deleteDaoTestData(
+                Array($this->cat, $this->user)
+			);
+			TestTools::deleteBlog( $this->blog );
         }
 
 		/**
@@ -103,7 +67,7 @@
 			$res = $c->query( "blogger.newPost", 
 			           "appkey", 
 					   $this->blog->getId(), 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   "blah blah", 
 					   true );
@@ -123,7 +87,7 @@
 			$this->assertEquals( "blah blah", $article->getTopic());
 			
 			// delete the article
-			$articles->deleteArticle( $artId, $this->owner->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $artId, $this->user->getId(), $this->blog->getId(), true );
 
 			// get the response and see that it has the right encoding			
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog), 
@@ -133,7 +97,7 @@
 			$res = $c->query( "blogger.newPost", 
 			           "appkey", 
 					   $this->blog->getId(), 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   "topic\nblah blah", 
 					   true );
@@ -153,7 +117,7 @@
 			$this->assertEquals( "topic", $article->getTopic());
 
 			// delete the article
-			$articles->deleteArticle( $artId, $this->owner->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $artId, $this->user->getId(), $this->blog->getId(), true );
 
 			// get the response and see that it has the right encoding			
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog), 
@@ -163,7 +127,7 @@
 			$res = $c->query( "blogger.newPost", 
 			           "appkey", 
 					   $this->blog->getId(), 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   "topic\n" . "Intro text" . POST_EXTENDED_TEXT_MODIFIER . "Extended text", 
 					   true );
@@ -186,7 +150,7 @@
 			$this->assertEquals( "Extended text", $article->getExtendedText());
 
 			// delete the article
-			$articles->deleteArticle( $artId, $this->owner->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $artId, $this->user->getId(), $this->blog->getId(), true );
 
 			// get the response and see that it has the right encoding			
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog), 
@@ -202,7 +166,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "blogger.getUserInfo", 
 			           "appkey", 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -211,10 +175,10 @@
 			// and check the data in the response
 			$userData = $c->getResponse();
 			
-			$this->assertEquals( $this->owner->getUsername(), $userData["nickname"], "The user nickname did not match!" );
-			$this->assertEquals( $this->owner->getUsername(), $userData["firstname"], "The user firstname did not match!" );
-			$this->assertEquals( $this->owner->getEmail(), $userData["email"], "The user email address did not match!" );
-			$this->assertEquals( $this->owner->getId(), $userData["userid"], "The user id did not match!" );			
+			$this->assertEquals( $this->user->getUsername(), $userData["nickname"], "The user nickname did not match!" );
+			$this->assertEquals( $this->user->getUsername(), $userData["firstname"], "The user firstname did not match!" );
+			$this->assertEquals( $this->user->getEmail(), $userData["email"], "The user email address did not match!" );
+			$this->assertEquals( $this->user->getId(), $userData["userid"], "The user id did not match!" );			
 
 			// get the response and see that it has the right encoding
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog ), 
@@ -229,7 +193,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "blogger.getUsersBlogs", 
 			           "appkey", 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -256,7 +220,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "metaWeblog.getUsersBlogs", 
 			           "appkey", 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -285,7 +249,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -298,7 +262,7 @@
 			$res = $c->query( "blogger.editPost", 
 			           "appkey", 
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   "updated text", 
 					   true );
@@ -327,7 +291,7 @@
 			$res = $c->query( "blogger.editPost", 
 			           "appkey", 
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   "topic\nupdated text", 
 					   true );
@@ -350,7 +314,7 @@
 			                   "The blog encoding and the response of the XMLRPC request did not match!" );	
 			
 			// delete the post
-			$articles->deleteArticle( $updatedArticle->getId(), $this->owner->getId(), $this->blog->getId());	
+			$articles->deleteArticle( $updatedArticle->getId(), $this->user->getId(), $this->blog->getId());	
 		}
 		
 		/**
@@ -363,7 +327,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -376,7 +340,7 @@
 			$res = $c->query( "blogger.deletePost", 
 			           "appkey", 
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   true );
 					
@@ -408,7 +372,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -419,7 +383,7 @@
 				"topic 2",
 				"text 2",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -431,7 +395,7 @@
 			$res = $c->query( "blogger.getRecentPosts", 
 			           "appkey", 
 					   $this->blog->getId(),	
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   10 );
 					
@@ -449,8 +413,8 @@
 			                   "The blog encoding and the response of the XMLRPC request did not match!" );
 			
 			// delete the articles
-			$articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true );
-			$articles->deleteArticle( $article2->getId(), $this->owner->getId(), $this->blog->getId(), true );			
+			$articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $article2->getId(), $this->user->getId(), $this->blog->getId(), true );			
 		}
 		
 		/**
@@ -463,7 +427,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -476,7 +440,7 @@
 			$res = $c->query( "blogger.getPost", 
 			           "appkey", 
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -487,11 +451,11 @@
 			$this->assertTrue( $response, "blogger.getPost did not return a valid response" );
 			
 			// and now compare that the returned values match with what we expected
-			$this->assertEquals( $this->owner->getId(), $response["userid"], "The user id of the article does not match" );
+			$this->assertEquals( $this->user->getId(), $response["userid"], "The user id of the article does not match" );
 			$this->assertEquals( "topic\ntext", $response["content"] );
 			$this->assertEquals( $article->getId(), $response["postid"] );
 
-			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true ),
+			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true ),
 			                   "Error deleting article" );
 			
 			// get the response and see that it has the right encoding
@@ -504,7 +468,7 @@
 				"topic",
 				"Intro text" . POST_EXTENDED_TEXT_MODIFIER . "Extended text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -516,7 +480,7 @@
 			$res = $c->query( "blogger.getPost", 
 			           "appkey", 
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -528,11 +492,11 @@
 			$this->assertTrue( $response, "blogger.getPost did not return a valid response" );
 			
 			// and now compare that the returned values match with what we expected
-			$this->assertEquals( $this->owner->getId(), $response["userid"], "The user id of the article does not match" );
+			$this->assertEquals( $this->user->getId(), $response["userid"], "The user id of the article does not match" );
 			$this->assertEquals( "topic\nIntro text[@more@]Extended text", $response["content"] );
 			$this->assertEquals( $article->getId(), $response["postid"] );
 
-			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true ),
+			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true ),
 			                   "Error deleting article" );
 			
 			// get the response and see that it has the right encoding
@@ -560,7 +524,7 @@
 
 			$res = $c->query( "metaWeblog.newPost", 
 					   $this->blog->getId(), 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   $content, 
 					   true );
@@ -573,8 +537,10 @@
 			$articles = new Articles();
 			$article = $articles->getArticle( $artId );
 			$this->assertTrue( $article, "Could not load article with id = ".$artId );
-			if( !$article )
+			if( !$article ){
+                TestTools::deleteDaoTestData( Array( $cat1, $cat2, $cat3 ));
 				return;
+            }
 			// check that the post has the expected values
 			$this->assertEquals( "body text", $article->getText(false));
 			$this->assertEquals( "topic", $article->getTopic());
@@ -585,7 +551,7 @@
 			$this->assertEquals( count( $cats ), count( $postCats ), "The post did not have as many categories as expected!" );
 			
 			// delete the article
-			$articles->deleteArticle( $artId, $this->owner->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $artId, $this->user->getId(), $this->blog->getId(), true );
 
 			// get the response and see that it has the right encoding			
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog), 
@@ -598,7 +564,7 @@
 			$content["categories"] = Array( $cat1->getName(), $cat2->getName(), $cat3->getName());
 			$res = $c->query( "metaWeblog.newPost", 
 					   $this->blog->getId(), 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   $content, 
 					   true );
@@ -621,7 +587,7 @@
 			$this->assertEquals( "Extended text", $article->getExtendedText());
 
 			// delete the article
-			$articles->deleteArticle( $artId, $this->owner->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $artId, $this->user->getId(), $this->blog->getId(), true );
 
 			// get the response and see that it has the right encoding			
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog), 
@@ -634,7 +600,7 @@
             $content["mt_text_more"] = "Extended text";
 			$res = $c->query( "metaWeblog.newPost", 
 					   $this->blog->getId(), 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   $content, 
 					   true );
@@ -647,8 +613,10 @@
 			$articles = new Articles();
 			$article = $articles->getArticle( $artId );
 			$this->assertTrue( $article, "Could not load article with id = ".$artId );
-			if( !$article )
+			if( !$article ){
+                TestTools::deleteDaoTestData( Array( $cat1, $cat2, $cat3 ));
 				return;
+            }
 			// check that the post has the expected values
 			$this->assertEquals( "topic", $article->getTopic());
 			$this->assertEquals( "Intro textExtended text", $article->getText());
@@ -657,7 +625,7 @@
 			$this->assertEquals( "Extended text", $article->getExtendedText());
 
 			// delete the article
-			$articles->deleteArticle( $artId, $this->owner->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $artId, $this->user->getId(), $this->blog->getId(), true );
 
 			// get the response and see that it has the right encoding			
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog), 
@@ -679,7 +647,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -691,7 +659,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "metaWeblog.getPost",
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -702,7 +670,7 @@
 			$this->assertTrue( $response, "metaWeblog.getPost did not return a valid response" );
 			
 			// and now compare that the returned values match with what we expected
-			$this->assertEquals( $this->owner->getId(), $response["userid"], "The user id of the article does not match" );
+			$this->assertEquals( $this->user->getId(), $response["userid"], "The user id of the article does not match" );
 			$this->assertEquals( "topic", $response["title"], "The topic of the post does not match" );
 			$this->assertEquals( "text", $response["description"], "The text of the article does not match" );
 			$this->assertEquals( $article->getId(), $response["postid"] );
@@ -710,7 +678,7 @@
 			$this->assertEquals( $url->postLink( $article ), $response["link"], "The post permalink does not match" );
 			$this->assertEquals( $url->postPermalink( $article ), $response["permaLink"], "The post permalink does not match" );
 			
-			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true ),
+			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true ),
 			                   "Error deleting article" );
 			
 			// get the response and see that it has the right encoding
@@ -723,7 +691,7 @@
 				"topic",
 				"Intro text" . POST_EXTENDED_TEXT_MODIFIER . "Extended text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -736,7 +704,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "metaWeblog.getPost",
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -747,7 +715,7 @@
 			$this->assertTrue( $response, "metaWeblog.getPost did not return a valid response" );
 			
 			// and now compare that the returned values match with what we expected
-			$this->assertEquals( $this->owner->getId(), $response["userid"], "The user id of the article does not match" );
+			$this->assertEquals( $this->user->getId(), $response["userid"], "The user id of the article does not match" );
 			$this->assertEquals( "topic", $response["title"], "The topic of the post does not match" );
 			$this->assertEquals( "Intro text", $response["description"], "The text of the article does not match" );
 			$this->assertEquals( $article->getId(), $response["postid"] );
@@ -755,7 +723,7 @@
 			$this->assertEquals( $url->postLink( $article ), $response["link"], "The post permalink does not match" );
 			$this->assertEquals( $url->postPermalink( $article ), $response["permaLink"], "The post permalink does not match" );
 			
-			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true ),
+			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true ),
 			                   "Error deleting article" );
 			
 			// get the response and see that it has the right encoding
@@ -770,7 +738,7 @@
 				"topic",
 				"Intro text" . POST_EXTENDED_TEXT_MODIFIER . "Extended text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -790,7 +758,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "metaWeblog.getPost",
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -801,7 +769,7 @@
 			$this->assertTrue( $response, "metaWeblog.getPost did not return a valid response" );
 			
 			// and now compare that the returned values match with what we expected
-			$this->assertEquals( $this->owner->getId(), $response["userid"], "The user id of the article does not match" );
+			$this->assertEquals( $this->user->getId(), $response["userid"], "The user id of the article does not match" );
 			$this->assertEquals( "topic", $response["title"], "The topic of the post does not match" );
 			$this->assertEquals( "Intro text", $response["description"], "The text of the article does not match" );
 			$this->assertEquals( "Extended text", $response["mt_text_more"], "The text of the extended text does not match" );
@@ -810,7 +778,7 @@
 			$this->assertEquals( $url->postLink( $article ), $response["link"], "The post permalink does not match" );
 			$this->assertEquals( $url->postPermalink( $article ), $response["permaLink"], "The post permalink does not match" );
 			
-			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true ),
+			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true ),
 			                   "Error deleting article" );
 			
 			// get the response and see that it has the right encoding
@@ -835,7 +803,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "metaWeblog.getCategories",
 					   $this->blog->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -846,14 +814,16 @@
 			$this->assertTrue( $response, "metaWeblog.getCategories did not return a valid response" );
 						
 			// there should only be one category
-			$this->assertTrue(( count( $response ) == 1 ), "There should only be one category returned by metaWeblog.getCategories" );
+			$this->assertEquals(1, count($response), "There should only be one category returned by metaWeblog.getCategories" );
 			
 			// check that the category settings are correct
 			$this->assertEquals( $this->cat->getName(), key($response), "The category name did not match" );
-			$this->assertEquals( $this->cat->getDescription(), $response["General"]["description"], "The category description did not match" );
+			$this->assertEquals( $this->cat->getDescription(), $response["Default Category"]["description"], 
+                                 "The category description did not match" );
 			$url = $this->blog->getBlogRequestGenerator();
 			$url->setXHTML( false );
-			$this->assertEquals( $url->categoryLink( $this->cat ), $response["General"]["htmlUrl"], "The category link did not match" );
+			$this->assertEquals( $url->categoryLink( $this->cat ), $response["Default Category"]["htmlUrl"],
+                                 "The category link did not match" );
 			
 			// get the response and see that it has the right encoding
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog ), 
@@ -866,7 +836,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "mt.getCategoryList",
 					   $this->blog->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -877,7 +847,7 @@
 			$this->assertTrue( $response, "mt.getCategoryList did not return a valid response" );
 						
 			// there should only be one category
-			$this->assertTrue(( count( $response ) == 1 ), "There should only be one category returned by mt.getCategoryList" );
+			$this->assertEquals(1, count($response), "There should only be one category returned by mt.getCategoryList" );
 			
 			// check that the category settings are correct
 			$this->assertEquals( $this->cat->getName(), $response[0]["categoryName"], "The category name did not match" );
@@ -895,7 +865,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -906,7 +876,7 @@
 				"topic 2",
 				"text 2",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -917,7 +887,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "metaWeblog.getRecentPosts", 
 					   $this->blog->getId(),	
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   10 );
 					
@@ -935,8 +905,8 @@
 			                   "The blog encoding and the response of the XMLRPC request did not match!" );
 			
 			// delete the articles
-			$articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true );
-			$articles->deleteArticle( $article2->getId(), $this->owner->getId(), $this->blog->getId(), true );			
+			$articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $article2->getId(), $this->user->getId(), $this->blog->getId(), true );			
 			
 		}
 		
@@ -964,7 +934,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -976,7 +946,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "mt.getPostCategories",
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -994,7 +964,7 @@
 			$this->assertEquals( $this->cat->getName(), $response[0]["categoryName"], "The category name did not match" );
 			$this->assertEquals( $this->cat->getId(), $response[0]["categoryId"], "The category description did not match" );
 			
-			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true ),
+			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true ),
 			                   "Error deleting article" );
 			
 			// get the response and see that it has the right encoding
@@ -1010,7 +980,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -1025,8 +995,8 @@
 										  true );			
 			$cats = new ArticleCategories();
 			if( !$cats->addArticleCategory( $cat2 )) {
-				throw(  new Exception( "Error adding test category!" ));
-				die();
+				print "Error adding test category!";
+                return;
 			}		  
 			
 			// Construct the Category Struct
@@ -1040,7 +1010,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "mt.setPostCategories",
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password",
 					   $categories
 					   );
@@ -1055,9 +1025,11 @@
 			// check that the post was successfully updated
 			$updatedArticle = $articles->getArticle( $article->getId());
 			$this->assertEquals( $cat2->getId(), $updatedArticle->_categoryIds[0]);
-			
-			$cats->deleteCategory( $cat2->getId(), $this->blog->getId());
 
+
+			$this->assertTrue( $cats->deleteCategory( $cat2->getId(), $this->blog->getId()),
+                               "Couldn't erase/cleanup category");
+
 			// get the response and see that it has the right encoding
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog ), 
 			                   "The blog encoding and the response of the XMLRPC request did not match!" );			



More information about the pLog-svn mailing list