bb = $this->make('e_bbcode'); } catch(Exception $e) { $this->assertTrue(false, $e->getMessage()); } $this->bb->__construct(); } /* public function testSetClass() { } public function testResizeWidth() { } public function testGetContent() { } */ public function testHtmltoBBcode() { $text = '
Paragraph.
Column 1 | Column 2 |
---|---|
link |
[img title=test]{e_MEDIA_IMAGE}2021-10/test.jpg[/img]
' ], /* 1 => [ 'html' => '[img title=test]{e_MEDIA_IMAGE}2021-10/test.jpg[/img]
' ],*/ ]; foreach($tests as $count => $t) { $actual = $this->bb->imgToBBcode($t['html']); $this->assertSame($t['expected'], $actual, 'Test '.$count.' failed'); } } /* public function testResizeHeight() { } public function testRenderButtons() { } public function testProcessTag() { } */ public function testParseBBCodes() { $codes = array ( '_br' => array ( ), 'b' => array ( ), 'alert' => array ( 'warning' => array('input'=>'Warning Message', 'expected'=>"'), ), 'right' => array ( ), 'sanitised' => array ( ), 'size' => array ( ), 'spoiler' => array ( ), 'stream' => array ( ), 'table' => array ( ), 'tbody' => array ( ), 'td' => array ( ), 'textarea' => array ( ), 'th' => array ( ), 'time' => array ( ), 'tr' => array ( ), 'u' => array ( ), 'url' => array ( ), ); $ret = []; foreach($codes as $bbcode=>$var) { if(empty($var)) { $input = '['.$bbcode.']http://mysite.com[/'.$bbcode.']'; $result = $this->bb->parseBBCodes($input, true); // parsing to check for PHP errors. // $this->assertNotEmpty($result, $input." was empty."); continue; } foreach($var as $parms=>$p) { $input2 = '['.$bbcode.'='.$parms.']'.$p['input'].'[/'.$bbcode.']'; $result2 = $this->bb->parseBBCodes($input2); $this->assertEquals($p['expected'], $result2); } } } /* public function testClearClass() { } public function testGetClass() { } public function testGetMode() { } */ }Quoted Message
Ted