Пример #1
0
 function testCheckMailAddress()
 {
     $fail_words = array('hogehuga.net', 'untarakantara', 'example@example', 'example@.com', 'example@example@example.com');
     foreach ($fail_words as $word) {
         $this->assertFalse(Ethna_Util::checkMailAddress($word));
     }
     $util = new Ethna_Util();
     $result = $util->checkMailAddress('hogefuga.net');
     $this->assertFalse($result);
     $result = $util->checkMailAddress('*****@*****.**');
     $this->assertTrue($result);
 }
Пример #2
0
 function testCheckMailAddress()
 {
     $fail_words = array('hogehuga.net', 'untarakantara', 'example@example', 'example@.com', 'example@example@example.com', '@hogefuga.et', 'hogefuga.net@', 'hoge@fuga.net.', '*****@*****.**');
     $correct_words = array('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '/hoge@fuga.net', '?hoge@fuga.net', 'hoge?@fuga.net');
     foreach ($fail_words as $word) {
         $this->assertFalse(Ethna_Util::checkMailAddress($word));
     }
     foreach ($correct_words as $word) {
         $this->assertTrue(Ethna_Util::checkMailAddress($word));
     }
 }
Пример #3
0
 /**
  * @test
  */
 public function checkMailAddressInvalid()
 {
     // @がない
     $this->assertFalse(Ethna_Util::checkMailAddress('hogefuga.net'));
     // @の前に文字がない
     $this->assertFalse(Ethna_Util::checkMailAddress('@hogefuga.net'));
     // @の後に文字がない
     $this->assertFalse(Ethna_Util::checkMailAddress('hogefuga.net@'));
     // 先頭文字が許されていない
     $this->assertFalse(Ethna_Util::checkMailAddress('*****@*****.**'));
     // 末尾文字が不正
     $this->assertFalse(Ethna_Util::checkMailAddress('hoge@fuga.net.'));
 }