EmailValidatorTest.php 714 Bytes
Newer Older
Alexander Makarov committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
<?php
namespace yiiunit\framework\validators;
use yii\validators\EmailValidator;
use yiiunit\TestCase;

/**
 * EmailValidatorTest
 */
class EmailValidatorTest extends TestCase
{
	public function testValidateValue()
	{
		$validator = new EmailValidator();

		$this->assertTrue($validator->validateValue('sam@rmcreative.ru'));
		$this->assertTrue($validator->validateValue('5011@gmail.com'));
		$this->assertFalse($validator->validateValue('rmcreative.ru'));
	}

	public function testValidateValueMx()
	{
		$validator = new EmailValidator();
		$validator->checkMX = true;

		$this->assertTrue($validator->validateValue('sam@rmcreative.ru'));
		$this->assertFalse($validator->validateValue('test@example.com'));
	}
Zander Baldwin committed
28
}