Esempio n. 1
0
 /**
  * Test identities selection (#1489378)
  */
 function test_rcmail_identity_select2()
 {
     $identities = array(array('name' => 'Test 1', 'email_ascii' => '*****@*****.**', 'ident' => 'Test 1 <*****@*****.**>'), array('name' => 'Test 2', 'email_ascii' => '*****@*****.**', 'ident' => 'Test 2 <*****@*****.**>'), array('name' => 'Test 3', 'email_ascii' => '*****@*****.**', 'ident' => 'Test 3 <*****@*****.**>'), array('name' => 'Test 4', 'email_ascii' => '*****@*****.**', 'ident' => 'Test 4 <*****@*****.**>'));
     $message = new stdClass();
     $message->headers = new rcube_message_header();
     $message->headers->set('From', '<*****@*****.**>');
     $res = rcmail_identity_select($message, $identities);
     $this->assertSame($identities[1], $res);
     $message->headers->set('From', 'Test 2 <*****@*****.**>');
     $res = rcmail_identity_select($message, $identities);
     $this->assertSame($identities[1], $res);
     $message->headers->set('From', 'Other <*****@*****.**>');
     $res = rcmail_identity_select($message, $identities);
     $this->assertSame($identities[1], $res);
     $message->headers->set('From', 'Test 4 <*****@*****.**>');
     $res = rcmail_identity_select($message, $identities);
     $this->assertSame($identities[3], $res);
 }
Esempio n. 2
0
 /**
  * Test identities selection using Return-Path header
  */
 function test_rcmail_identity_select()
 {
     $identities = array(array('name' => 'Test', 'email_ascii' => '*****@*****.**', 'ident' => 'Test <*****@*****.**>'), array('name' => 'Test', 'email_ascii' => '*****@*****.**', 'ident' => 'Test <*****@*****.**>'), array('name' => 'Test', 'email_ascii' => '*****@*****.**', 'ident' => 'Test <*****@*****.**>'));
     $message = new stdClass();
     $message->headers = new rcube_message_header();
     $message->headers->set('Return-Path', '<*****@*****.**>');
     $res = rcmail_identity_select($message, $identities);
     $this->assertSame($identities[0], $res);
     $message->headers->set('Return-Path', '<*****@*****.**>');
     $res = rcmail_identity_select($message, $identities);
     $this->assertSame($identities[1], $res);
 }