Files
roundcubemail/plugins/attachment_reminder/tests/AttachmentReminder.php
Michael Voříšek 6a53a1d853 Fix CS (whitespace, visibility) (#9297)
* Fix "method_argument_space"

* Fix "control_structure_continuation_position"

* Fix "new_with_parentheses"

* Fix "blank_line_before_statement"

* Fix "visibility_required"

* Fix some "array_indentation"

* Fix some "array_indentation" - unify all "rcube::raise_error" calls

* rm useless eslint ignores and add rules counts

* sort eslint ignores

* fix eslint ignores grammar

* Revert "Fix "blank_line_before_statement""

* fix CS 3.46.0
2024-01-04 14:26:35 +01:00

69 lines
1.9 KiB
PHP

<?php
class AttachmentReminder_Plugin extends PHPUnit\Framework\TestCase
{
public static function setUpBeforeClass(): void
{
include_once __DIR__ . '/../attachment_reminder.php';
}
/**
* Plugin object construction test
*/
public function test_constructor()
{
$rcube = rcube::get_instance();
$plugin = new attachment_reminder($rcube->plugins);
$this->assertInstanceOf('attachment_reminder', $plugin);
$this->assertInstanceOf('rcube_plugin', $plugin);
$plugin->init();
}
/**
* Test prefs_list() method
*/
public function test_prefs_list()
{
$rcube = rcube::get_instance();
$plugin = new attachment_reminder($rcube->plugins);
$args = ['section' => 'compose', 'blocks' => ['main' => ['options' => []]]];
$result = $plugin->prefs_list($args);
$this->assertSame(
'<label for="rcmfd_attachment_reminder">Remind about forgotten attachments</label>',
$result['blocks']['main']['options']['attachment_reminder']['title']
);
$this->assertSame(
'<input name="_attachment_reminder" id="rcmfd_attachment_reminder" value="1" type="checkbox">',
$result['blocks']['main']['options']['attachment_reminder']['content']
);
}
/**
* Test prefs_save() method
*/
public function test_prefs_save()
{
$rcube = rcube::get_instance();
$plugin = new attachment_reminder($rcube->plugins);
$_POST = [];
$args = ['section' => 'compose', 'prefs' => []];
$result = $plugin->prefs_save($args);
$this->assertFalse($result['prefs']['attachment_reminder']);
$_POST = ['_attachment_reminder' => 1];
$args = ['section' => 'compose', 'prefs' => []];
$result = $plugin->prefs_save($args);
$this->assertTrue($result['prefs']['attachment_reminder']);
}
}