示例#1
2
 /**
  * Test unit conversion functions with various numbers
  */
 public function testAddHtml()
 {
     $content = '';
     // Default
     $section = new Section(1);
     $this->assertEquals(0, $section->countElements());
     // Heading
     $styles = array('strong', 'em', 'sup', 'sub');
     for ($level = 1; $level <= 6; $level++) {
         $content .= "<h{$level}>Heading {$level}</h{$level}>";
     }
     // Styles
     $content .= '<p style="text-decoration: underline; text-decoration: line-through; ' . 'text-align: center; color: #999; background-color: #000;">';
     foreach ($styles as $style) {
         $content .= "<{$style}>{$style}</{$style}>";
     }
     $content .= '</p>';
     // Add HTML
     Html::addHtml($section, $content);
     $this->assertEquals(7, $section->countElements());
     // Other parts
     $section = new Section(1);
     $content = '';
     $content .= '<table><tr><th>Header</th><td>Content</td></tr></table>';
     $content .= '<ul><li>Bullet</li><ul><li>Bullet</li></ul></ul>';
     $content .= '<ol><li>Bullet</li></ol>';
     Html::addHtml($section, $content);
 }