Browse Source

fixed failing validator tests

tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
3631890cba
  1. 6
      tests/unit/framework/validators/BooleanValidatorTest.php
  2. 5
      tests/unit/framework/validators/CompareValidatorTest.php
  3. 6
      tests/unit/framework/validators/DateValidatorTest.php
  4. 6
      tests/unit/framework/validators/DefaultValueValidatorTest.php
  5. 6
      tests/unit/framework/validators/EmailValidatorTest.php
  6. 1
      tests/unit/framework/validators/ExistValidatorTest.php
  7. 6
      tests/unit/framework/validators/FilterValidatorTest.php
  8. 6
      tests/unit/framework/validators/NumberValidatorTest.php
  9. 6
      tests/unit/framework/validators/RangeValidatorTest.php
  10. 6
      tests/unit/framework/validators/RegularExpressionValidatorTest.php
  11. 6
      tests/unit/framework/validators/RequiredValidatorTest.php
  12. 1
      tests/unit/framework/validators/UniqueValidatorTest.php
  13. 6
      tests/unit/framework/validators/UrlValidatorTest.php
  14. 5
      tests/unit/framework/validators/ValidatorTest.php

6
tests/unit/framework/validators/BooleanValidatorTest.php

@ -10,6 +10,12 @@ use yiiunit\TestCase;
*/ */
class BooleanValidatorTest extends TestCase class BooleanValidatorTest extends TestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
public function testValidateValue() public function testValidateValue()
{ {
$val = new BooleanValidator; $val = new BooleanValidator;

5
tests/unit/framework/validators/CompareValidatorTest.php

@ -10,6 +10,11 @@ use yiiunit\TestCase;
class CompareValidatorTest extends TestCase class CompareValidatorTest extends TestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
public function testValidateValueException() public function testValidateValueException()
{ {

6
tests/unit/framework/validators/DateValidatorTest.php

@ -10,6 +10,12 @@ use yiiunit\TestCase;
class DateValidatorTest extends TestCase class DateValidatorTest extends TestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
public function testEnsureMessageIsSet() public function testEnsureMessageIsSet()
{ {
$val = new DateValidator; $val = new DateValidator;

6
tests/unit/framework/validators/DefaultValueValidatorTest.php

@ -8,6 +8,12 @@ use yiiunit\TestCase;
*/ */
class DefaultValueValidatorTest extends TestCase class DefaultValueValidatorTest extends TestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
public function testValidateAttribute() public function testValidateAttribute()
{ {
$val = new DefaultValueValidator; $val = new DefaultValueValidator;

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

@ -11,6 +11,12 @@ use yiiunit\TestCase;
*/ */
class EmailValidatorTest extends TestCase class EmailValidatorTest extends TestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
public function testValidateValue() public function testValidateValue()
{ {
$validator = new EmailValidator(); $validator = new EmailValidator();

1
tests/unit/framework/validators/ExistValidatorTest.php

@ -18,6 +18,7 @@ class ExistValidatorTest extends DatabaseTestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
$this->mockApplication();
ActiveRecord::$db = $this->getConnection(); ActiveRecord::$db = $this->getConnection();
} }

6
tests/unit/framework/validators/FilterValidatorTest.php

@ -9,6 +9,12 @@ use yiiunit\TestCase;
class FilterValidatorTest extends TestCase class FilterValidatorTest extends TestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
public function testAssureExceptionOnInit() public function testAssureExceptionOnInit()
{ {
$this->setExpectedException('yii\base\InvalidConfigException'); $this->setExpectedException('yii\base\InvalidConfigException');

6
tests/unit/framework/validators/NumberValidatorTest.php

@ -9,6 +9,12 @@ use yiiunit\TestCase;
class NumberValidatorTest extends TestCase class NumberValidatorTest extends TestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
public function testEnsureMessageOnInit() public function testEnsureMessageOnInit()
{ {
$val = new NumberValidator; $val = new NumberValidator;

6
tests/unit/framework/validators/RangeValidatorTest.php

@ -9,6 +9,12 @@ use yiiunit\TestCase;
class RangeValidatorTest extends TestCase class RangeValidatorTest extends TestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
public function testInitException() public function testInitException()
{ {
$this->setExpectedException('yii\base\InvalidConfigException', 'The "range" property must be set.'); $this->setExpectedException('yii\base\InvalidConfigException', 'The "range" property must be set.');

6
tests/unit/framework/validators/RegularExpressionValidatorTest.php

@ -9,6 +9,12 @@ use yiiunit\TestCase;
class RegularExpressionValidatorTest extends TestCase class RegularExpressionValidatorTest extends TestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
public function testValidateValue() public function testValidateValue()
{ {
$val = new RegularExpressionValidator(['pattern' => '/^[a-zA-Z0-9](\.)?([^\/]*)$/m']); $val = new RegularExpressionValidator(['pattern' => '/^[a-zA-Z0-9](\.)?([^\/]*)$/m']);

6
tests/unit/framework/validators/RequiredValidatorTest.php

@ -8,6 +8,12 @@ use yiiunit\TestCase;
class RequiredValidatorTest extends TestCase class RequiredValidatorTest extends TestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
public function testValidateValueWithDefaults() public function testValidateValueWithDefaults()
{ {
$val = new RequiredValidator(); $val = new RequiredValidator();

1
tests/unit/framework/validators/UniqueValidatorTest.php

@ -19,6 +19,7 @@ class UniqueValidatorTest extends DatabaseTestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
$this->mockApplication();
ActiveRecord::$db = $this->getConnection(); ActiveRecord::$db = $this->getConnection();
} }

6
tests/unit/framework/validators/UrlValidatorTest.php

@ -9,6 +9,12 @@ use yiiunit\TestCase;
*/ */
class UrlValidatorTest extends TestCase class UrlValidatorTest extends TestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
public function testValidateValue() public function testValidateValue()
{ {
$val = new UrlValidator; $val = new UrlValidator;

5
tests/unit/framework/validators/ValidatorTest.php

@ -12,6 +12,11 @@ use yiiunit\TestCase;
class ValidatorTest extends TestCase class ValidatorTest extends TestCase
{ {
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}
protected function getTestModel($additionalAttributes = []) protected function getTestModel($additionalAttributes = [])
{ {

Loading…
Cancel
Save