[pLog-svn] r4305 - plog/branches/lifetype-1.1.3/class/test/tests/ui

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Thu Nov 16 04:12:56 GMT 2006


Author: jondaley
Date: 2006-11-16 04:12:54 +0000 (Thu, 16 Nov 2006)
New Revision: 4305

Modified:
   plog/branches/lifetype-1.1.3/class/test/tests/ui/articlecategoriesui_test.class.php
Log:
fixed text to use urlize_word_separator.  And also not crash if a test fails

Modified: plog/branches/lifetype-1.1.3/class/test/tests/ui/articlecategoriesui_test.class.php
===================================================================
--- plog/branches/lifetype-1.1.3/class/test/tests/ui/articlecategoriesui_test.class.php	2006-11-16 03:47:57 UTC (rev 4304)
+++ plog/branches/lifetype-1.1.3/class/test/tests/ui/articlecategoriesui_test.class.php	2006-11-16 04:12:54 UTC (rev 4305)
@@ -1,8 +1,9 @@
 <?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/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" );
+
 	/**
 	 * \ingroup Test
 	 *
@@ -26,6 +27,8 @@
 		 */
 		function testArticleCategories()
 		{
+            $config =& Config::getConfig();
+
 			$this->assertUIScript(
 				Array(
 					"login" => Array(
@@ -68,27 +71,35 @@
 			
 			// find the category in the db...
 			$cats = new ArticleCategories();
-			$cat = $cats->getCategoryByName( "test_category", $this->blog->getId());
-			
-			// ...and delete it via the UI
-			$this->assertUIScript(
-				Array(
-					"delete_category" => Array(
-						"url" => $this->getAdminUrl(),
-						"type" => "get",
-						"params" => Array( "categoryId" => $cat->getId(), "op" => "deleteArticleCategory" ),
-						"expected" => "Category \"".$cat->getName()."\" deleted successfully",
-						"message" => "The test category was not successully deleted"
-					),
-					"delete_category_again" => Array(
-						"url" => $this->getAdminUrl(),
-						"type" => "get",
-						"params" => Array( "categoryId" => $cat->getId(), "op" => "deleteArticleCategory" ),
-						"expected" => "There was an error deleting category with identifier \"".$cat->getId()."\"",
-						"message" => "Attempting to delete the same category twice did not generate the expected error message"
-					)					
-				)
-			);			
+			$cat = $cats->getCategoryByName( "test".$config->getValue( "urlize_word_separator" )."category",
+                                             $this->blog->getId());
+			$this->assertTrue($cat != NULL, "Category \"test category\" was added but now cannot be found");
+
+            if($cat){
+                    // ...and delete it via the UI
+                $this->assertUIScript(
+                    Array(
+                        "delete_category" => Array(
+                            "url" => $this->getAdminUrl(),
+                            "type" => "get",
+                            "params" => Array( "categoryId" => $cat->getId(),
+                                               "op" => "deleteArticleCategory" ),
+                            "expected" => "Category \"".$cat->getName()."\" deleted successfully",
+                            "message" => "The test category was not successully deleted"
+                            ),
+                        "delete_category_again" => Array(
+                            "url" => $this->getAdminUrl(),
+                            "type" => "get",
+                            "params" => Array( "categoryId" => $cat->getId(),
+                                               "op" => "deleteArticleCategory" ),
+                            "expected" => "There was an error deleting category with identifier \"".
+                                               $cat->getId()."\"",
+                            "message" => "Attempting to delete the same category twice did not ".
+                                               "generate the expected error message"
+                            )
+                        )
+                    );
+            }
 		}
 	}
 ?>
\ No newline at end of file



More information about the pLog-svn mailing list