Commit 3631890c by Carsten Brandt

fixed failing validator tests

parent 7e1dd672
...@@ -10,6 +10,12 @@ use yiiunit\TestCase; ...@@ -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;
......
...@@ -10,6 +10,11 @@ use yiiunit\TestCase; ...@@ -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()
{ {
......
...@@ -10,6 +10,12 @@ use yiiunit\TestCase; ...@@ -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;
......
...@@ -8,6 +8,12 @@ use yiiunit\TestCase; ...@@ -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;
......
...@@ -11,6 +11,12 @@ use yiiunit\TestCase; ...@@ -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();
......
...@@ -18,6 +18,7 @@ class ExistValidatorTest extends DatabaseTestCase ...@@ -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();
} }
......
...@@ -9,6 +9,12 @@ use yiiunit\TestCase; ...@@ -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');
......
...@@ -9,6 +9,12 @@ use yiiunit\TestCase; ...@@ -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;
......
...@@ -9,6 +9,12 @@ use yiiunit\TestCase; ...@@ -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.');
......
...@@ -9,6 +9,12 @@ use yiiunit\TestCase; ...@@ -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']);
......
...@@ -8,6 +8,12 @@ use yiiunit\TestCase; ...@@ -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();
......
...@@ -19,6 +19,7 @@ class UniqueValidatorTest extends DatabaseTestCase ...@@ -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();
} }
......
...@@ -9,6 +9,12 @@ use yiiunit\TestCase; ...@@ -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;
......
...@@ -12,6 +12,11 @@ use yiiunit\TestCase; ...@@ -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 = [])
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment