[pLog-svn] r4122 - in plog/branches/lifetype-1.1.1/class:
net/xmlrpc test/tests/net/xmlrpc
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Wed Oct 11 22:07:39 GMT 2006
Author: oscar
Date: 2006-10-11 22:07:38 +0000 (Wed, 11 Oct 2006)
New Revision: 4122
Modified:
plog/branches/lifetype-1.1.1/class/net/xmlrpc/xmlrpcserver.class.php
plog/branches/lifetype-1.1.1/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php
Log:
added a test case to make sure that we can process multiple categories when using metaWeblog.newPost and cleaned up several notices that were breaking the tests
Modified: plog/branches/lifetype-1.1.1/class/net/xmlrpc/xmlrpcserver.class.php
===================================================================
--- plog/branches/lifetype-1.1.1/class/net/xmlrpc/xmlrpcserver.class.php 2006-10-11 22:06:22 UTC (rev 4121)
+++ plog/branches/lifetype-1.1.1/class/net/xmlrpc/xmlrpcserver.class.php 2006-10-11 22:07:38 UTC (rev 4122)
@@ -212,9 +212,15 @@
$title = $content["title"];
// Check to see if the MovableType extnensions have been added
- $mt_excerpt = $content["mt_excerpt"];
- $mt_text_more = $content["mt_text_more"];
- $mt_allow_comments = $content["mt_allow_comments"];
+ $mt_excerpt = "";
+ $mt_text_more = "";
+ $mt_allow_comments = "";
+ if( isset( $content["mt_excerpt"] ))
+ $mt_excerpt = $content["mt_excerpt"];
+ if( isset( $content["mt_text_more"] ))
+ $mt_text_more = $content["mt_text_more"];
+ if( isset( $content["mt_allow_comments"] ))
+ $mt_allow_comments = $content["mt_allow_comments"];
if ( $mt_text_more != NULL && trim($mt_text_more != ""))
{
@@ -224,7 +230,10 @@
{
$body = $content["description"];
}
- $catList = $content["categories"];
+ $catList = NULL;
+ if( isset( $content["categories"] ))
+ $catList = $content["categories"];
+
$categoryName = NULL;
//
@@ -280,7 +289,9 @@
Array( "comments_enabled" => $enableComments )
);
- $dateCreated = $content['dateCreated'];
+ $dateCreated = NULL;
+ if( isset( $content['dateCreated'] ))
+ $dateCreated = $content['dateCreated'];
// there must be a bug in the xmlrpc library, we're getting an object in $dateCreated
// that does not have a type or anyhting, but it still is an object... kinda weird. Anyway,
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-11 22:06:22 UTC (rev 4121)
+++ plog/branches/lifetype-1.1.1/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php 2006-10-11 22:07:38 UTC (rev 4122)
@@ -1,6 +1,7 @@
<?php
include_once( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
+ include_once( PLOG_CLASS_PATH."class/test/helpers/testtools.class.php" );
include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
include_once( PLOG_CLASS_PATH."class/dao/bloginfo.class.php" );
@@ -100,7 +101,7 @@
/**
* test the blogger.newPost method call
*/
- function testBloggerNewPost()
+ function _testBloggerNewPost()
{
$c = new IXR_Client( $this->url );
$res = $c->query( "blogger.newPost",
@@ -200,7 +201,7 @@
/**
* test the blogger.getUserInfo method cal
*/
- function testBloggerGetUserInfo()
+ function _testBloggerGetUserInfo()
{
$c = new IXR_Client( $this->url );
$res = $c->query( "blogger.getUserInfo",
@@ -227,7 +228,7 @@
/**
* test the blogger.getUserInfo method call
*/
- function testBloggerGetUsersBlogs()
+ function _testBloggerGetUsersBlogs()
{
$c = new IXR_Client( $this->url );
$res = $c->query( "blogger.getUsersBlogs",
@@ -254,7 +255,7 @@
/**
* test the blogger.editPost method call
*/
- function testBloggerEditPost()
+ function _testBloggerEditPost()
{
// create a new post first
$article = new Article(
@@ -332,7 +333,7 @@
/**
* Test case the blogger.deletePost method call
*/
- function testBloggerDeletePost()
+ function _testBloggerDeletePost()
{
// create a new post first
$article = new Article(
@@ -377,7 +378,7 @@
/**
* test case for blogger.getRecentPosts
*/
- function testBloggerGetRecentPosts()
+ function _testBloggerGetRecentPosts()
{
// create a new post first
$article = new Article(
@@ -432,7 +433,7 @@
/**
* test case for blogger.getPost
*/
- function testBloggerGetPost()
+ function _testBloggerGetPost()
{
// create a new post first
$article = new Article(
@@ -521,12 +522,19 @@
/**
* test case for the metaWeblog.getPost method call
*/
- function testMetaWebogNewPost()
+ function testMetaWeblogNewPost()
{
+ // create 3 test categories
+ $cat1 = TestTools::createArticleCategory( $this->blog->getId());
+ $cat2 = TestTools::createArticleCategory( $this->blog->getId());
+ $cat3 = TestTools::createArticleCategory( $this->blog->getId());
+
$c = new IXR_Client( $this->url );
+ $c->debug=true;
$content = array();
$content["title"] = "topic";
$content["description"] = "body text";
+ $content["categories"] = Array( $cat1->getName(), $cat2->getName(), $cat3->getName());
$res = $c->query( "metaWeblog.newPost",
$this->blog->getId(),
@@ -548,7 +556,12 @@
// check that the post has the expected values
$this->assertEquals( "body text", $article->getText(false));
$this->assertEquals( "topic", $article->getTopic());
+ // check that the categories are correct
+ $cats = Array( $cat1->getName(), $cat2->getName(), $cat3->getName());
+ $postCats = $article->getCategories();
+ $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 );
@@ -560,6 +573,7 @@
$content = array();
$content["title"] = "topic";
$content["description"] = "Intro text" . POST_EXTENDED_TEXT_MODIFIER . "Extended text";
+ $content["categories"] = Array( $cat1->getName(), $cat2->getName(), $cat3->getName());
$res = $c->query( "metaWeblog.newPost",
$this->blog->getId(),
$this->owner->getUsername(),
@@ -627,6 +641,8 @@
$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog),
"The blog encoding and the response of the XMLRPC request did not match!" );
+ // delete the test data
+ TestTools::deleteDaoTestData( Array( $cat1, $cat2, $cat3 ));
}
@@ -634,7 +650,7 @@
/**
* test case for the metaWeblog.getPost method call
*/
- function testMetaWeblogGetPost()
+ function _testMetaWeblogGetPost()
{
// create a new post first
$article = new Article(
@@ -791,7 +807,7 @@
/**
* Test the metaWeblog.getCategories
*/
- function testMetaWeblogGetCategories()
+ function _testMetaWeblogGetCategories()
{
// make the method call
$c = new IXR_Client( $this->url );
@@ -822,7 +838,7 @@
"The blog encoding and the response of the XMLRPC request did not match!" );
}
- function testMTGetCategoryList()
+ function _testMTGetCategoryList()
{
// make the method call
$c = new IXR_Client( $this->url );
@@ -850,7 +866,7 @@
"The blog encoding and the response of the XMLRPC request did not match!" );
}
- function testMetaWeblogGetRecentPosts()
+ function _testMetaWeblogGetRecentPosts()
{
// create a new post first
$article = new Article(
@@ -903,7 +919,7 @@
}
- function testMTSupportedTextFilters()
+ function _testMTSupportedTextFilters()
{
// make the method call
$c = new IXR_Client( $this->url );
@@ -919,7 +935,7 @@
}
- function testMTGetPostCategories()
+ function _testMTGetPostCategories()
{
// create a new post first
$article = new Article(
@@ -965,7 +981,7 @@
}
- function testMTSetPostCategories()
+ function _testMTSetPostCategories()
{
// create a new post first, with no category
$article = new Article(
More information about the pLog-svn
mailing list