From 3631890cba7e4700499d440fe840e9f0ccdc4e28 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 24 Oct 2013 00:00:32 +0200 Subject: [PATCH] fixed failing validator tests --- tests/unit/framework/validators/BooleanValidatorTest.php | 6 ++++++ tests/unit/framework/validators/CompareValidatorTest.php | 5 +++++ tests/unit/framework/validators/DateValidatorTest.php | 6 ++++++ tests/unit/framework/validators/DefaultValueValidatorTest.php | 6 ++++++ tests/unit/framework/validators/EmailValidatorTest.php | 6 ++++++ tests/unit/framework/validators/ExistValidatorTest.php | 1 + tests/unit/framework/validators/FilterValidatorTest.php | 6 ++++++ tests/unit/framework/validators/NumberValidatorTest.php | 6 ++++++ tests/unit/framework/validators/RangeValidatorTest.php | 6 ++++++ tests/unit/framework/validators/RegularExpressionValidatorTest.php | 6 ++++++ tests/unit/framework/validators/RequiredValidatorTest.php | 6 ++++++ tests/unit/framework/validators/UniqueValidatorTest.php | 1 + tests/unit/framework/validators/UrlValidatorTest.php | 6 ++++++ tests/unit/framework/validators/ValidatorTest.php | 5 +++++ 14 files changed, 72 insertions(+) diff --git a/tests/unit/framework/validators/BooleanValidatorTest.php b/tests/unit/framework/validators/BooleanValidatorTest.php index f30aa3d..0f09daf 100644 --- a/tests/unit/framework/validators/BooleanValidatorTest.php +++ b/tests/unit/framework/validators/BooleanValidatorTest.php @@ -10,6 +10,12 @@ use yiiunit\TestCase; */ class BooleanValidatorTest extends TestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + public function testValidateValue() { $val = new BooleanValidator; diff --git a/tests/unit/framework/validators/CompareValidatorTest.php b/tests/unit/framework/validators/CompareValidatorTest.php index b3fd6b4..d1bdf34 100644 --- a/tests/unit/framework/validators/CompareValidatorTest.php +++ b/tests/unit/framework/validators/CompareValidatorTest.php @@ -10,6 +10,11 @@ use yiiunit\TestCase; class CompareValidatorTest extends TestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } public function testValidateValueException() { diff --git a/tests/unit/framework/validators/DateValidatorTest.php b/tests/unit/framework/validators/DateValidatorTest.php index 28a6a4a..6ae3521 100644 --- a/tests/unit/framework/validators/DateValidatorTest.php +++ b/tests/unit/framework/validators/DateValidatorTest.php @@ -10,6 +10,12 @@ use yiiunit\TestCase; class DateValidatorTest extends TestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + public function testEnsureMessageIsSet() { $val = new DateValidator; diff --git a/tests/unit/framework/validators/DefaultValueValidatorTest.php b/tests/unit/framework/validators/DefaultValueValidatorTest.php index 05a71b5..48537d8 100644 --- a/tests/unit/framework/validators/DefaultValueValidatorTest.php +++ b/tests/unit/framework/validators/DefaultValueValidatorTest.php @@ -8,6 +8,12 @@ use yiiunit\TestCase; */ class DefaultValueValidatorTest extends TestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + public function testValidateAttribute() { $val = new DefaultValueValidator; diff --git a/tests/unit/framework/validators/EmailValidatorTest.php b/tests/unit/framework/validators/EmailValidatorTest.php index 950ac97..eee708d 100644 --- a/tests/unit/framework/validators/EmailValidatorTest.php +++ b/tests/unit/framework/validators/EmailValidatorTest.php @@ -11,6 +11,12 @@ use yiiunit\TestCase; */ class EmailValidatorTest extends TestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + public function testValidateValue() { $validator = new EmailValidator(); diff --git a/tests/unit/framework/validators/ExistValidatorTest.php b/tests/unit/framework/validators/ExistValidatorTest.php index 5a3a175..a0f0328 100644 --- a/tests/unit/framework/validators/ExistValidatorTest.php +++ b/tests/unit/framework/validators/ExistValidatorTest.php @@ -18,6 +18,7 @@ class ExistValidatorTest extends DatabaseTestCase public function setUp() { parent::setUp(); + $this->mockApplication(); ActiveRecord::$db = $this->getConnection(); } diff --git a/tests/unit/framework/validators/FilterValidatorTest.php b/tests/unit/framework/validators/FilterValidatorTest.php index 139d51d..ec96f21 100644 --- a/tests/unit/framework/validators/FilterValidatorTest.php +++ b/tests/unit/framework/validators/FilterValidatorTest.php @@ -9,6 +9,12 @@ use yiiunit\TestCase; class FilterValidatorTest extends TestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + public function testAssureExceptionOnInit() { $this->setExpectedException('yii\base\InvalidConfigException'); diff --git a/tests/unit/framework/validators/NumberValidatorTest.php b/tests/unit/framework/validators/NumberValidatorTest.php index c2352ec..4e9897e 100644 --- a/tests/unit/framework/validators/NumberValidatorTest.php +++ b/tests/unit/framework/validators/NumberValidatorTest.php @@ -9,6 +9,12 @@ use yiiunit\TestCase; class NumberValidatorTest extends TestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + public function testEnsureMessageOnInit() { $val = new NumberValidator; diff --git a/tests/unit/framework/validators/RangeValidatorTest.php b/tests/unit/framework/validators/RangeValidatorTest.php index bfa7cae..345951c 100644 --- a/tests/unit/framework/validators/RangeValidatorTest.php +++ b/tests/unit/framework/validators/RangeValidatorTest.php @@ -9,6 +9,12 @@ use yiiunit\TestCase; class RangeValidatorTest extends TestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + public function testInitException() { $this->setExpectedException('yii\base\InvalidConfigException', 'The "range" property must be set.'); diff --git a/tests/unit/framework/validators/RegularExpressionValidatorTest.php b/tests/unit/framework/validators/RegularExpressionValidatorTest.php index 3262025..e5b33b2 100644 --- a/tests/unit/framework/validators/RegularExpressionValidatorTest.php +++ b/tests/unit/framework/validators/RegularExpressionValidatorTest.php @@ -9,6 +9,12 @@ use yiiunit\TestCase; class RegularExpressionValidatorTest extends TestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + public function testValidateValue() { $val = new RegularExpressionValidator(['pattern' => '/^[a-zA-Z0-9](\.)?([^\/]*)$/m']); diff --git a/tests/unit/framework/validators/RequiredValidatorTest.php b/tests/unit/framework/validators/RequiredValidatorTest.php index f60e69e..0708cc9 100644 --- a/tests/unit/framework/validators/RequiredValidatorTest.php +++ b/tests/unit/framework/validators/RequiredValidatorTest.php @@ -8,6 +8,12 @@ use yiiunit\TestCase; class RequiredValidatorTest extends TestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + public function testValidateValueWithDefaults() { $val = new RequiredValidator(); diff --git a/tests/unit/framework/validators/UniqueValidatorTest.php b/tests/unit/framework/validators/UniqueValidatorTest.php index 37d666f..d3d0882 100644 --- a/tests/unit/framework/validators/UniqueValidatorTest.php +++ b/tests/unit/framework/validators/UniqueValidatorTest.php @@ -19,6 +19,7 @@ class UniqueValidatorTest extends DatabaseTestCase public function setUp() { parent::setUp(); + $this->mockApplication(); ActiveRecord::$db = $this->getConnection(); } diff --git a/tests/unit/framework/validators/UrlValidatorTest.php b/tests/unit/framework/validators/UrlValidatorTest.php index 4d5fae2..1323434 100644 --- a/tests/unit/framework/validators/UrlValidatorTest.php +++ b/tests/unit/framework/validators/UrlValidatorTest.php @@ -9,6 +9,12 @@ use yiiunit\TestCase; */ class UrlValidatorTest extends TestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } + public function testValidateValue() { $val = new UrlValidator; diff --git a/tests/unit/framework/validators/ValidatorTest.php b/tests/unit/framework/validators/ValidatorTest.php index 0cd56d9..fc69c2f 100644 --- a/tests/unit/framework/validators/ValidatorTest.php +++ b/tests/unit/framework/validators/ValidatorTest.php @@ -12,6 +12,11 @@ use yiiunit\TestCase; class ValidatorTest extends TestCase { + protected function setUp() + { + parent::setUp(); + $this->mockApplication(); + } protected function getTestModel($additionalAttributes = []) {