コード例 #1
0
ファイル: StringTest.php プロジェクト: grrr-amsterdam/garp3
 public function testExcerpt()
 {
     $this->assertEquals('This is some content.', Garp_Util_String::excerpt("<p><strong>This</strong> is some content.</p>"));
     $this->assertEquals('Small font Large font Colored font Bold font Italic font and more...', Garp_Util_String::excerpt('<p><span style="font-size:10px;">Small font</span> ' . '<span style="font-size:18px;">Large font</span> ' . '<span style="font-size:12px;color:orange;">Colored font</span> ' . '<span style="font-size:12px;font-weight:bold;">Bold font</span> ' . '<span style="font-size:12px;font-style:italic;">Italic font</span> and more...</p>'));
     $this->assertEquals('x', Garp_Util_String::excerpt("<div class=\"beautify\">x</div>"));
     $this->assertEquals("Uw uitdaging\n\n                Geen tijd over voor het beheren van uw werkplekken?", Garp_Util_String::excerpt("<p><strong>Uw uitdaging</strong><br>\n                Geen tijd over voor het beheren van uw werkplekken?</p>"));
     //test different <br> writing styles
     $this->assertEquals("Testing the \nbreak \nwith different formats", Garp_Util_String::excerpt("<p><strong>Testing</strong> the <br>break" . " <br />with different formats</p>"));
     $this->assertEquals("Testing the \nbreak \nwith different formats", Garp_Util_String::excerpt("<p><strong>Testing</strong> the <br >break <br/>with different formats</p>"));
     //test imput of a space if there is none
     $this->assertEquals("insert a\nspace\nhere", Garp_Util_String::excerpt("<p><strong>insert</strong> a<br >space<br/>here</p>"));
     //this is not working
     // $this->assertEquals(Garp_Util_String::excerpt("</div><div>x</div>"),"x");
 }