Browse Source

Update changelog and tests

pull/8683/head
Aleksander Machniak 3 years ago
parent
commit
b043f3c228
  1. 1
      CHANGELOG.md
  2. 2
      program/include/rcmail.php
  3. 35
      tests/Rcmail/Rcmail.php

1
CHANGELOG.md

@ -12,6 +12,7 @@
- Fix PHP 8.1 warnings in the LDAP backend code (#8572)
- Fix various PHP 8.1 warnings (#8584)
- Fix bug where a recipient address containing UTF-8 characters was ignored when sending an email (#8493, #8546)
- Fix so rcmail::contact_exists() works with IDNA addresses (#8545)
## Release 1.6-rc

2
program/include/rcmail.php

@ -1348,7 +1348,7 @@ class rcmail extends rcube
* @param rcube_addressbook $source The addressbook object
* @param string $error Filled with an error message/label on error
*
* @return int|bool Contact ID on success, False otherwise
* @return int|string|bool Contact ID on success, False otherwise
*/
public function contact_create($contact, $source, &$error = null)
{

35
tests/Rcmail/Rcmail.php

@ -192,19 +192,34 @@ class Rcmail_Rcmail extends ActionTestCase
}
/**
* Test rcmail::contact_create()
* Test rcmail::contact_create() and rcmail::contact_exists()
*/
function test_contact_create()
function test_contact_create_and_contact_exists()
{
$this->markTestIncomplete();
}
self::initDB('contacts');
/**
* Test rcmail::contact_exists()
*/
function test_contact_exists()
{
$this->markTestIncomplete();
$rcmail = rcmail::get_instance();
$db = $rcmail->get_dbh();
$source = $rcmail->get_address_book(rcube_addressbook::TYPE_DEFAULT, true);
$contact_id = $rcmail->contact_create(['email' => 'test@xn--e1aybc.xn--p1ai'], $source, $error);
$this->assertNull($error);
$this->assertTrue($contact_id != false);
$sql_result = $db->query("SELECT * FROM `contacts` WHERE `contact_id` = $contact_id");
$contact = $db->fetch_assoc($sql_result);
$this->assertSame('test@тест.рф', $contact['email']);
$this->assertSame('Test', $contact['name']);
$result = $rcmail->contact_exists('test@xn--e1aybc.xn--p1ai', rcube_addressbook::TYPE_DEFAULT);
$this->assertTrue($result);
$result = $rcmail->contact_exists('test@тест.рф', rcube_addressbook::TYPE_DEFAULT);
$this->assertTrue($result);
}
/**

Loading…
Cancel
Save