Browse Source

more tests

tags/2.0.0-beta
Alexander Makarov 12 years ago
parent
commit
3bb73e54f9
  1. 26
      tests/unit/framework/YiiBaseTest.php
  2. 28
      tests/unit/framework/validators/EmailValidatorTest.php

26
tests/unit/framework/YiiBaseTest.php

@ -0,0 +1,26 @@
<?php
namespace yiiunit\framework;
use yiiunit\TestCase;
/**
* YiiBaseTest
*/
class YiiBaseTest extends TestCase
{
public function testAlias()
{
}
public function testGetVersion()
{
echo \Yii::getVersion();
$this->assertTrue((boolean)preg_match('~\d+\.\d+(?:\.\d+)?(?:-\w+)?~', \Yii::getVersion()));
}
public function testPowered()
{
$this->assertTrue(is_string(\Yii::powered()));
}
}

28
tests/unit/framework/validators/EmailValidatorTest.php

@ -0,0 +1,28 @@
<?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'));
}
}
Loading…
Cancel
Save