public function testInsensitiveMatch() { $address = new Horde_Mail_Rfc822_Address('Test <*****@*****.**>'); $this->assertTrue($address->matchInsensitive('Foo <*****@*****.**>')); $this->assertTrue($address->matchInsensitive('Foo <*****@*****.**>')); $this->assertTrue($address->matchInsensitive('Foo <*****@*****.**>')); }
/** * Returns whether an email address matches this attendee. * * @param string $email An email address. * @param boolean $caseSensitive Whether to match case-sensitive. * * @return boolean True if the email address matches this attendee. */ public function matchesEmail($email, $caseSensitive) { $email = new Horde_Mail_Rfc822_Address($email); return $caseSensitive && $email->match($this->email) || !$caseSensitive && $email->matchInsensitive($this->email); }
/** * Checks to see whether the specified attendee is associated with the * current event. * * @param string $email The email address of the attendee. * @param boolean $case_sensitive Match in a case sensitive manner. * @since 4.3.0 * @return boolean True if the specified attendee is present for this * event. */ public function hasAttendee($email, $case_sensitive = false) { $email = new Horde_Mail_Rfc822_Address($email); foreach (array_keys($this->attendees) as $attendee) { if ($case_sensitive && $email->match($attendee) || !$case_sensitive && $email->matchInsensitive($email)) { return true; } } return false; }
/** * @dataProvider insensitiveMatchProvider */ public function testInsensitiveMatch($in, $match, $expected) { $address = new Horde_Mail_Rfc822_Address($in); $this->assertEquals($expected, $address->matchInsensitive($match)); }