mirror of
https://github.com/roundcube/roundcubemail.git
synced 2026-03-14 03:56:48 +01:00
* 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
41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Test class to test rcmail_action_contacts_mailto
|
|
*/
|
|
class Actions_Contacts_Mailto extends ActionTestCase
|
|
{
|
|
/**
|
|
* Test run() method
|
|
*/
|
|
public function test_run()
|
|
{
|
|
$action = new rcmail_action_contacts_mailto();
|
|
$output = $this->initOutput(rcmail_action::MODE_AJAX, 'contacts', 'mailto');
|
|
|
|
$this->assertInstanceOf('rcmail_action', $action);
|
|
$this->assertTrue($action->checks());
|
|
|
|
self::initDB('contacts');
|
|
|
|
$db = rcmail::get_instance()->get_dbh();
|
|
$query = $db->query('SELECT `contact_id` FROM `contacts` WHERE `email` = ?', 'johndoe@example.org');
|
|
$result = $db->fetch_assoc($query);
|
|
$cid = $result['contact_id'];
|
|
|
|
$_POST = ['_cid' => $cid, '_source' => '0'];
|
|
|
|
$this->runAndAssert($action, OutputJsonMock::E_EXIT);
|
|
|
|
$result = $output->getOutput();
|
|
|
|
$this->assertSame(['Content-Type: application/json; charset=UTF-8'], $output->headers);
|
|
$this->assertSame('mailto', $result['action']);
|
|
$this->assertTrue(strpos($result['exec'], 'this.open_compose_step({"_mailto":"') !== false);
|
|
|
|
preg_match('/_mailto":"([0-9a-z]+)/', $result['exec'], $m);
|
|
|
|
$this->assertSame('John+Doe+%3Cjohndoe%40example.org%3E', $_SESSION['mailto'][$m[1]]);
|
|
}
|
|
}
|