mirror of
https://github.com/roundcube/roundcubemail.git
synced 2026-03-07 08:36:51 +01:00
* Check plugins composer.json using CI * Add "require-dev" and "config.allow-plugins" to plugins * fix composer.json format - rm invalid email * fix composer.json format - fix ext require * fix composer.json format - fix plugin name * tmp * Revert "tmp" * fix ext in ext install * disable plugin in plugin install until Roundcube is fully autoloadable * fix composer.json format - fix non-canonical license name * Revert "Add "require-dev" and "config.allow-plugins" to plugins" * no composer install for plugins needed * Revert "fix ext in ext install" * add standard "Test" suffix to phpunit files * rm unneeded "suffix" in phpunit config * simplify phpunit config * fix default "xhtml" doctype in unit testing * fix test_format_date test to not rely on other tests * even more phpunit config simplify * stricter/unify phpunit params for E2E tests * run E2E tests on maximal php version too with lowest deps * "repositories" in bundled plugins are useless as for root package only * add/unify missing plugin test
75 lines
2.0 KiB
PHP
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);
|
|
}
|
|
}
|