[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 lt_include( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" ); 4 lt_include( PLOG_CLASS_PATH."class/dao/bloginfo.class.php" ); 5 lt_include( PLOG_CLASS_PATH."class/dao/blogs.class.php" ); 6 lt_include( PLOG_CLASS_PATH."class/data/timestamp.class.php" ); 7 8 /** 9 * \ingroup Test 10 * 11 * Test cases for the BlogInfo class 12 */ 13 class BlogInfo_Test extends LifeTypeTestCase 14 { 15 /** 16 * regression test for mantis case 978 (http://bugs.lifetype.net/view.php?id=978) 17 */ 18 function testGetUpdateDateObject() 19 { 20 $blogs = new Blogs(); 21 // let's hope that blog '1' exists... if not throw an assert error 22 $blog = $blogs->getBlogInfo( 1 ); 23 $this->assertTrue( $blog, "Couldn't load blog with id '1', make sure it exists!" ); 24 25 // test the getUpdateDateObject() method to make sure it does not return the current date 26 $now = new Timestamp(); 27 $blogUpdateDate = $blog->getUpdateDateObject(); 28 29 // check that the dates are different 30 $sameDate = ( $now->getIsoDate() == $blogUpdateDate->getIsoDate()); 31 32 $this->assertFalse( $sameDate, "Please see Mantis case 978 <a href='http://bugs.lifetype.net/view.php?id=978'>here</a>." ); 33 } 34 35 /** 36 * no html allowed in the blog name 37 */ 38 function testSetBlogNoHtmlAllowed() 39 { 40 lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" ); 41 $blogNameHtml = "<h1>This is</h1>some <script type=\"text/javascript\">window.alert('hello!');</script>HTML!"; 42 43 $blog = new BlogInfo( "blah", 1, "blah blah", new BlogSettings()); 44 45 $blog->setBlog( $blogNameHtml ); 46 47 $tf = new Textfilter(); 48 $this->assertEquals( $tf->filterAllHTML($blogNameHtml), $blog->getBlog()); 49 } 50 51 /** 52 * regression test for mantis case 1006 (http://bugs.lifetype.net/view.php?id=1006) 53 * BlogInfo::setMangledBlogName() should re-run Textfilter::domainize() on blog names 54 */ 55 function testSetMangledBlogName() 56 { 57 // when set to 'true', the second parameter modifies the blog name 58 $blogName = "this_is_a_blog____ name"; 59 $blog = new BlogInfo( "blah", 1, "blah blah", new BlogSettings()); 60 $blog->setMangledBlogName( $blogName, true ); 61 $this->assertEquals( Textfilter::domainize( $blogName ), $blog->getMangledBlogName()); 62 // and went set to 'false' (default value) it won't 63 $blogName = "this_is_a_blog____ name"; 64 $blog2 = new BlogInfo( "blah", 1, "blah blah", new BlogSettings()); 65 $blog2->setMangledBlogName( $blogName, false ); 66 $this->assertEquals( "this_is_a_blog____ name", $blog2->getMangledBlogName()); 67 } 68 } 69 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |