Files
roundcubemail/tests/Actions/Contacts/EditTest.php
Michael Voříšek 736795326c Fix plugins composer.json format (#9405)
* 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
2024-04-05 17:55:46 +02:00

104 lines
2.9 KiB
PHP

<?php
/**
* Test class to test rcmail_action_contacts_edit
*/
class Actions_Contacts_Edit extends ActionTestCase
{
/**
* Test run() method in edit mode
*/
public function test_run_edit_mode()
{
$action = new rcmail_action_contacts_edit();
$output = $this->initOutput(rcmail_action::MODE_HTTP, 'contacts', 'edit');
$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 `user_id` = 1 LIMIT 1');
$contact = $db->fetch_assoc($query);
$_GET = [
'_cid' => $contact['contact_id'],
'_source' => '0',
];
$this->runAndAssert($action, OutputHtmlMock::E_EXIT);
$result = $output->getOutput();
$this->assertSame('contactedit', $output->template);
$this->assertSame('Edit contact', $output->getProperty('pagetitle'));
$this->assertSame($contact['contact_id'], $output->get_env('cid'));
$this->assertTrue(stripos($result, '<!DOCTYPE html>') === 0);
$this->assertTrue(strpos($result, "rcmail.gui_object('contactphoto', 'contactpic');") !== false);
}
/**
* Test run() method in add mode
*/
public function test_run_add_mode()
{
$this->markTestIncomplete();
}
/**
* Test contact_edithead() method
*/
public function test_contact_edithead()
{
$this->markTestIncomplete();
}
/**
* Test contact_editform() method
*/
public function test_contact_editform()
{
$this->markTestIncomplete();
}
/**
* Test get_form_tags() method
*/
public function test_get_form_tags()
{
$this->markTestIncomplete();
}
/**
* Test upload_photo_form() method
*/
public function test_upload_photo_form()
{
$this->markTestIncomplete();
}
/**
* Test photo_drop_area() method
*/
public function test_photo_drop_area()
{
$output = $this->initOutput(rcmail_action::MODE_HTTP, 'contacts', 'edit');
$result = rcmail_action_contacts_edit::photo_drop_area([]);
$this->assertNull($output->get_env('filedrop'));
$output = $this->initOutput(rcmail_action::MODE_HTTP, 'contacts', 'edit');
$result = rcmail_action_contacts_edit::photo_drop_area(['id' => 'test']);
$scripts = $output->getProperty('scripts');
$filedrop = $output->get_env('filedrop');
$this->assertSame("rcmail.gui_object('filedrop', 'test');", trim($scripts['head']));
$this->assertSame('upload-photo', $filedrop['action']);
$this->assertSame('_photo', $filedrop['fieldname']);
$this->assertSame(1, $filedrop['single']);
$this->assertSame('^image/.+', $filedrop['filter']);
}
}