tm = $this->make('e107TinyMceParser');
}
catch (Exception $e)
{
$this->fail("Couldn't load e107TinyMceParser object");
}
}
public function testToHtmlOnPlain()
{
$test = 'Plain text paragraph 1
Plain text "paragraph" 2
Plain text paragraph 3
';
$actual = $this->tm->toHTML($test);
$expected = 'Plain text paragraph 1
Plain text "paragraph" 2
Plain text paragraph 3
';
$this->assertEquals($expected, $actual, "Plain text line-breaks to HTML failed in the TinyMce editor." );
}
public function testToHtmlOnBbcode()
{
$test = '[b]Bold text[/b]
paragraph 2
paragraph 3';
$actual = $this->tm->toHTML($test);
$expected = "Bold text
paragraph 2
paragraph 3";
$this->assertEquals($expected, $actual, "Bbcode to HTML failed in the TinyMce editor." );
}
/**
* Test parsing of input from user via TinyMce.
*/
public function testToDB()
{
$this->tm->setHtmlClass(e_UC_ADMIN);
$test_1 = '
Some text
Some other text
[img class=bbcode-img-right&width=300]{e_MEDIA_IMAGE}2017-11/e107_about.png[/img]Some text
[img class=bbcode-img-left&width=600]{e_MEDIA_IMAGE}2017-11/e107_about.png[/img]Some other text
[/html]'; $this->assertEquals($expected_2, $actual_2); $test_3 = "Nikdy nehovor, že niečo nejde, pretože sa vždy nájde blbec, čo to urobí.
"; $actual_3 = $this->tm->toDB($test_3); $expected_3 = "[html]Nikdy nehovor, že niečo nejde, pretože sa vždy nájde blbec, čo to urobí.
[/html]"; $this->assertEquals($expected_3, $actual_3); $result3 = $this->tm->toHTML($actual_3); $this->assertEquals($test_3, $result3); } /** * Simulate TinyMce usage by a user without access to post HTML. */ function testToDBUser() { $text = "An example,Merchant | Customer |
---|---|
{ORDER_MERCHANT_INFO} |
Billing address{ORDER_DATA: cust_firstname} {ORDER_DATA: cust_lastname} |
Merchant | Customer |
---|---|
{ORDER_MERCHANT_INFO} |
Billing address{ORDER_DATA: cust_firstname} {ORDER_DATA: cust_lastname}{ORDER_DATA: cust_company} {ORDER_DATA: cust_address} {ORDER_DATA: cust_city} {ORDER_DATA: cust_state} {ORDER_DATA: cust_zip} {ORDER_DATA: cust_country} Shipping address{ORDER_DATA: ship_firstname} {ORDER_DATA: ship_lastname}{ORDER_DATA: ship_company} {ORDER_DATA: ship_address} {ORDER_DATA: ship_city} {ORDER_DATA: ship_state} {ORDER_DATA: ship_zip} {ORDER_DATA: ship_country} |