Move pear/mail from packages to composer.json.
[civicrm-core.git] / tests / phpunit / CRM / Core / OptionGroupTest.php
index 49e4fe28f8467ed5ec4674c7441d3a41146a4932..d5309f0bf98888eb42f54838aa792ccc59619916 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018                                |
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -91,4 +91,22 @@ class CRM_Core_OptionGroupTest extends CiviUnitTestCase {
     }
   }
 
+
+  public function emailAddressTests() {
+    $tests[] = array('"Name"<email@example.com>', '"Name" <email@example.com>');
+    $tests[] = array('"Name" <email@example.com>', '"Name" <email@example.com>');
+    $tests[] = array('"Name"  <email@example.com>', '"Name" <email@example.com>');
+    return $tests;
+  }
+
+
+  /**
+   * @dataProvider emailAddressTests
+   */
+  public function testSanitizeFromEmailAddress($dirty, $clean) {
+    $form = new CRM_Admin_Form_Options();
+    $actual = $form->sanitizeFromEmailAddress($dirty);
+    $this->assertEquals($actual, $clean);
+  }
+
 }