Files
roundcubemail/tests/Framework/Enriched.php
Michael Voříšek 332c165d28 Fix some basic JS CS (#9328)
* fix "nonblock-statement-body-position" (fixed already)

* fix "comma-dangle"

* fix "no-regex-spaces"

* fix "new-parens"

* fix "object-curly-newline"

* fix "object-property-newline"

* fix "spaced-comment" semimanually

* fix "no-constant-condition" manually

* fix "unicorn/no-hex-escape"

* fix "unicorn/escape-case"

* fix "quote-props"

* fix "no-whitespace-before-property" - fix bug/typo

* fix "unicorn/empty-brace-spaces"

* fix "keyword-spacing"

* fix "dot-notation"

* fix "no-return-assign" manually

* fix "padding-line-between-statements"

* fix "key-spacing"

* fix "no-else-return" semimanually

* fix some "no-undef"

* fix case cs

* Revert "fix "padding-line-between-statements""

* improve switch/case format I.

* improve switch/case format II.

regex: (^ *(break|return).*)\n *(\n)

* fix safe "eqeqeq"

* fix "radix"

* fix v3.49.0 CS (static providers)

* fix "string_implicit_backslashes" in php files

* fix comments align

* fix test static providers

* fix stan

* disable "final_internal_class" rule
2024-02-06 08:28:19 +01:00

75 lines
2.0 KiB
PHP

<?php
use PHPUnit\Framework\TestCase;
/**
* Test class to test rcube_enriched class
*/
class Framework_Enriched extends TestCase
{
/**
* Class constructor
*/
public function test_class()
{
$object = new rcube_enriched();
$this->assertInstanceOf('rcube_enriched', $object, 'Class constructor');
}
/**
* Test to_html()
*/
public function test_to_html()
{
$enriched = '<bold><italic>the-text</italic></bold>';
$expected = '<b><i>the-text</i></b>';
$result = rcube_enriched::to_html($enriched);
$this->assertSame($expected, $result);
}
/**
* Data for test_formatting()
*/
public static function provide_formatting_cases(): iterable
{
return [
['<bold>', '<b>'],
['</bold>', '</b>'],
['<italic>', '<i>'],
['</italic>', '</i>'],
['<fixed>', '<tt>'],
['</fixed>', '</tt>'],
['<smaller>', '<font size=-1>'],
['</smaller>', '</font>'],
['<bigger>', '<font size=+1>'],
['</bigger>', '</font>'],
['<underline>', '<span style="text-decoration: underline">'],
['</underline>', '</span>'],
['<flushleft>', '<span style="text-align: left">'],
['</flushleft>', '</span>'],
['<flushright>', '<span style="text-align: right">'],
['</flushright>', '</span>'],
['<flushboth>', '<span style="text-align: justified">'],
['</flushboth>', '</span>'],
['<indent>', '<span style="padding-left: 20px">'],
['</indent>', '</span>'],
['<indentright>', '<span style="padding-right: 20px">'],
['</indentright>', '</span>'],
];
}
/**
* Test formatting conversion
*
* @dataProvider provide_formatting_cases
*/
public function test_formatting($enriched, $expected)
{
$result = rcube_enriched::to_html($enriched);
$this->assertSame($expected, $result);
}
}