From 3bb73e54f9aa06b5ccefd63995b3a7a8a2b89369 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Mon, 25 Feb 2013 03:20:55 +0400 Subject: [PATCH] more tests --- tests/unit/framework/YiiBaseTest.php | 26 ++++++++++++++++++++ .../framework/validators/EmailValidatorTest.php | 28 ++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 tests/unit/framework/YiiBaseTest.php create mode 100644 tests/unit/framework/validators/EmailValidatorTest.php diff --git a/tests/unit/framework/YiiBaseTest.php b/tests/unit/framework/YiiBaseTest.php new file mode 100644 index 0000000..df12bf9 --- /dev/null +++ b/tests/unit/framework/YiiBaseTest.php @@ -0,0 +1,26 @@ +assertTrue((boolean)preg_match('~\d+\.\d+(?:\.\d+)?(?:-\w+)?~', \Yii::getVersion())); + } + + public function testPowered() + { + $this->assertTrue(is_string(\Yii::powered())); + } +} diff --git a/tests/unit/framework/validators/EmailValidatorTest.php b/tests/unit/framework/validators/EmailValidatorTest.php new file mode 100644 index 0000000..fbc2f53 --- /dev/null +++ b/tests/unit/framework/validators/EmailValidatorTest.php @@ -0,0 +1,28 @@ +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')); + } +} \ No newline at end of file