mirror of
https://github.com/roundcube/roundcubemail.git
synced 2026-03-07 00:26:48 +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
60 lines
2.0 KiB
PHP
60 lines
2.0 KiB
PHP
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* Test class to test rcube_output class
|
|
*/
|
|
class Framework_Output extends TestCase
|
|
{
|
|
/**
|
|
* Test get_edit_field()
|
|
*/
|
|
public function test_get_edit_field()
|
|
{
|
|
$out = rcube_output::get_edit_field('test', 'value');
|
|
|
|
$this->assertSame('<input name="_test" class="ff_test" type="text" value="value">', $out);
|
|
|
|
$_POST['_test'] = 'testv';
|
|
$out = rcube_output::get_edit_field('test', 'value');
|
|
|
|
$this->assertSame('<input name="_test" class="ff_test" type="text" value="testv">', $out);
|
|
|
|
$out = rcube_output::get_edit_field('test', 'value', ['class' => 'a'], 'checkbox');
|
|
|
|
$this->assertSame('<input class="a ff_test" name="_test" value="1" type="checkbox">', $out);
|
|
|
|
$out = rcube_output::get_edit_field('test', 'value', ['class' => 'a'], 'textarea');
|
|
|
|
$this->assertSame('<textarea class="a ff_test" name="_test">testv</textarea>', $out);
|
|
|
|
$out = rcube_output::get_edit_field('test', 'value', ['class' => 'a'], 'select');
|
|
|
|
$this->assertSame('<select class="a ff_test" name="_test">' . "\n" . '<option value="">---</option></select>', $out);
|
|
|
|
$_POST['_test'] = 'tt';
|
|
$attr = ['options' => ['tt' => 'oo']];
|
|
$out = rcube_output::get_edit_field('test', 'value', $attr, 'select');
|
|
|
|
$this->assertSame('<select name="_test" class="ff_test">' . "\n"
|
|
. '<option value="">---</option><option value="tt" selected="selected">oo</option></select>',
|
|
$out
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Test json_serialize()
|
|
*/
|
|
public function test_json_serialize()
|
|
{
|
|
$this->assertSame('""', rcube_output::json_serialize(''));
|
|
$this->assertSame('[]', rcube_output::json_serialize([]));
|
|
$this->assertSame('10', rcube_output::json_serialize(10));
|
|
$this->assertSame('{"test":"test"}', rcube_output::json_serialize(['test' => 'test']));
|
|
|
|
// Test non-utf-8 input
|
|
$this->assertSame('{"ab":"ab"}', rcube_output::json_serialize(["a\x8cb" => "a\x8cb"]));
|
|
}
|
|
}
|