diff --git a/tests/framework/helpers/ArrayHelperTest.php b/tests/framework/helpers/ArrayHelperTest.php index 224ef06692e..282ae7f304f 100644 --- a/tests/framework/helpers/ArrayHelperTest.php +++ b/tests/framework/helpers/ArrayHelperTest.php @@ -44,7 +44,9 @@ class ArrayHelperTest extends TestCase protected function setUp() { parent::setUp(); - $this->mockApplication(); + + // destroy application, Helper must work without Yii::$app + $this->destroyApplication(); } public function testToArray() @@ -267,6 +269,7 @@ public function testMultisortUseSort() $sort = new Sort([ 'attributes' => ['name', 'age'], 'defaultOrder' => ['name' => SORT_ASC], + 'params' => [], ]); $orders = $sort->getOrders(); @@ -284,6 +287,7 @@ public function testMultisortUseSort() $sort = new Sort([ 'attributes' => ['name', 'age'], 'defaultOrder' => ['name' => SORT_ASC, 'age' => SORT_DESC], + 'params' => [], ]); $orders = $sort->getOrders(); diff --git a/tests/framework/helpers/ConsoleTest.php b/tests/framework/helpers/ConsoleTest.php index 61f777de38d..89521067d44 100644 --- a/tests/framework/helpers/ConsoleTest.php +++ b/tests/framework/helpers/ConsoleTest.php @@ -12,6 +12,14 @@ */ class ConsoleTest extends TestCase { + protected function setUp() + { + parent::setUp(); + + // destroy application, Helper must work without Yii::$app + $this->destroyApplication(); + } + public function testStripAnsiFormat() { ob_start(); diff --git a/tests/framework/helpers/FileHelperTest.php b/tests/framework/helpers/FileHelperTest.php index d70c3787ad5..ca976db12c0 100644 --- a/tests/framework/helpers/FileHelperTest.php +++ b/tests/framework/helpers/FileHelperTest.php @@ -33,8 +33,14 @@ public function setUp() */ $this->markTestInComplete('Unit tests runtime directory should be local!'); } + + parent::setUp(); + + // destroy application, Helper must work without Yii::$app + $this->destroyApplication(); } + public function tearDown() { $this->removeDir($this->testFilePath); diff --git a/tests/framework/helpers/InflectorTest.php b/tests/framework/helpers/InflectorTest.php index 0d8875c6a06..2408ba131e3 100644 --- a/tests/framework/helpers/InflectorTest.php +++ b/tests/framework/helpers/InflectorTest.php @@ -10,6 +10,14 @@ */ class InflectorTest extends TestCase { + protected function setUp() + { + parent::setUp(); + + // destroy application, Helper must work without Yii::$app + $this->destroyApplication(); + } + public function testPluralize() { $testData = [ diff --git a/tests/framework/helpers/JsonTest.php b/tests/framework/helpers/JsonTest.php index a88ef943a6e..9788858a4e9 100644 --- a/tests/framework/helpers/JsonTest.php +++ b/tests/framework/helpers/JsonTest.php @@ -14,6 +14,14 @@ */ class JsonTest extends TestCase { + protected function setUp() + { + parent::setUp(); + + // destroy application, Helper must work without Yii::$app + $this->destroyApplication(); + } + public function testEncode() { // basic data encoding diff --git a/tests/framework/helpers/MarkdownTest.php b/tests/framework/helpers/MarkdownTest.php index af83c626e7c..3e993609f16 100644 --- a/tests/framework/helpers/MarkdownTest.php +++ b/tests/framework/helpers/MarkdownTest.php @@ -12,6 +12,14 @@ */ class MarkdownTest extends TestCase { + protected function setUp() + { + parent::setUp(); + + // destroy application, Helper must work without Yii::$app + $this->destroyApplication(); + } + public function testOriginalFlavor() { $text = <<destroyApplication(); + } + public function testDumpIncompleteObject() { $serializedObj = 'O:16:"nonExistingClass":0:{}'; diff --git a/tests/framework/validators/BooleanValidatorTest.php b/tests/framework/validators/BooleanValidatorTest.php index c3f013017a7..29b008f646b 100644 --- a/tests/framework/validators/BooleanValidatorTest.php +++ b/tests/framework/validators/BooleanValidatorTest.php @@ -14,7 +14,9 @@ class BooleanValidatorTest extends TestCase protected function setUp() { parent::setUp(); - $this->mockApplication(); + + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); } public function testValidateValue() diff --git a/tests/framework/validators/CompareValidatorTest.php b/tests/framework/validators/CompareValidatorTest.php index 181e98abe51..e831cb1e9cf 100644 --- a/tests/framework/validators/CompareValidatorTest.php +++ b/tests/framework/validators/CompareValidatorTest.php @@ -14,7 +14,9 @@ class CompareValidatorTest extends TestCase protected function setUp() { parent::setUp(); - $this->mockApplication(); + + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); } public function testValidateValueException() diff --git a/tests/framework/validators/DefaultValueValidatorTest.php b/tests/framework/validators/DefaultValueValidatorTest.php index 80a0fdcdb13..5699415d2b5 100644 --- a/tests/framework/validators/DefaultValueValidatorTest.php +++ b/tests/framework/validators/DefaultValueValidatorTest.php @@ -13,7 +13,9 @@ class DefaultValueValidatorTest extends TestCase protected function setUp() { parent::setUp(); - $this->mockApplication(); + + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); } public function testValidateAttribute() diff --git a/tests/framework/validators/EachValidatorTest.php b/tests/framework/validators/EachValidatorTest.php index 743052794b6..a2757d811f3 100644 --- a/tests/framework/validators/EachValidatorTest.php +++ b/tests/framework/validators/EachValidatorTest.php @@ -14,7 +14,9 @@ class EachValidatorTest extends TestCase protected function setUp() { parent::setUp(); - $this->mockApplication(); + + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); } public function testArrayFormat() diff --git a/tests/framework/validators/EmailValidatorTest.php b/tests/framework/validators/EmailValidatorTest.php index 6e59dee56c3..5fa88ae0eef 100644 --- a/tests/framework/validators/EmailValidatorTest.php +++ b/tests/framework/validators/EmailValidatorTest.php @@ -13,7 +13,9 @@ class EmailValidatorTest extends TestCase protected function setUp() { parent::setUp(); - $this->mockApplication(); + + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); } public function testValidateValue() diff --git a/tests/framework/validators/ExistValidatorTest.php b/tests/framework/validators/ExistValidatorTest.php index 306f98dc8f7..d3aacc4719a 100644 --- a/tests/framework/validators/ExistValidatorTest.php +++ b/tests/framework/validators/ExistValidatorTest.php @@ -14,10 +14,12 @@ abstract class ExistValidatorTest extends DatabaseTestCase { - public function setUp() + protected function setUp() { parent::setUp(); - $this->mockApplication(); + + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); ActiveRecord::$db = $this->getConnection(); } diff --git a/tests/framework/validators/FileValidatorTest.php b/tests/framework/validators/FileValidatorTest.php index 8775bd5f39a..bfa88e41ce5 100644 --- a/tests/framework/validators/FileValidatorTest.php +++ b/tests/framework/validators/FileValidatorTest.php @@ -14,8 +14,9 @@ */ class FileValidatorTest extends TestCase { - public function setUp() + protected function setUp() { + parent::setUp(); $this->mockApplication(); } diff --git a/tests/framework/validators/FilterValidatorTest.php b/tests/framework/validators/FilterValidatorTest.php index b554e48f139..9512c2f6222 100644 --- a/tests/framework/validators/FilterValidatorTest.php +++ b/tests/framework/validators/FilterValidatorTest.php @@ -14,7 +14,8 @@ class FilterValidatorTest extends TestCase protected function setUp() { parent::setUp(); - $this->mockApplication(); + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); } public function testAssureExceptionOnInit() diff --git a/tests/framework/validators/IpValidatorTest.php b/tests/framework/validators/IpValidatorTest.php index 1fc2a7e138d..56f5d9695c5 100644 --- a/tests/framework/validators/IpValidatorTest.php +++ b/tests/framework/validators/IpValidatorTest.php @@ -14,7 +14,8 @@ class IpValidatorTest extends TestCase protected function setUp() { parent::setUp(); - $this->mockApplication(); + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); } public function testInitException() diff --git a/tests/framework/validators/NumberValidatorTest.php b/tests/framework/validators/NumberValidatorTest.php index 7959d1a48ee..b4456a5fa97 100644 --- a/tests/framework/validators/NumberValidatorTest.php +++ b/tests/framework/validators/NumberValidatorTest.php @@ -46,8 +46,11 @@ private function restoreLocale() protected function setUp() { parent::setUp(); - $this->mockApplication(); + $this->oldLocale = setlocale(LC_NUMERIC, 0); + + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); } public function testEnsureMessageOnInit() diff --git a/tests/framework/validators/RangeValidatorTest.php b/tests/framework/validators/RangeValidatorTest.php index f882eb1153c..f995740327d 100644 --- a/tests/framework/validators/RangeValidatorTest.php +++ b/tests/framework/validators/RangeValidatorTest.php @@ -14,7 +14,9 @@ class RangeValidatorTest extends TestCase protected function setUp() { parent::setUp(); - $this->mockApplication(); + + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); } public function testInitException() diff --git a/tests/framework/validators/RegularExpressionValidatorTest.php b/tests/framework/validators/RegularExpressionValidatorTest.php index adbf7be84b6..bafb1bc36a0 100644 --- a/tests/framework/validators/RegularExpressionValidatorTest.php +++ b/tests/framework/validators/RegularExpressionValidatorTest.php @@ -14,7 +14,9 @@ class RegularExpressionValidatorTest extends TestCase protected function setUp() { parent::setUp(); - $this->mockApplication(); + + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); } public function testValidateValue() diff --git a/tests/framework/validators/RequiredValidatorTest.php b/tests/framework/validators/RequiredValidatorTest.php index 0c206e4ccf0..6f43bff7057 100644 --- a/tests/framework/validators/RequiredValidatorTest.php +++ b/tests/framework/validators/RequiredValidatorTest.php @@ -13,7 +13,9 @@ class RequiredValidatorTest extends TestCase protected function setUp() { parent::setUp(); - $this->mockApplication(); + + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); } public function testValidateValueWithDefaults() diff --git a/tests/framework/validators/UniqueValidatorTest.php b/tests/framework/validators/UniqueValidatorTest.php index afdb0c44b46..c6248d57608 100644 --- a/tests/framework/validators/UniqueValidatorTest.php +++ b/tests/framework/validators/UniqueValidatorTest.php @@ -16,11 +16,13 @@ abstract class UniqueValidatorTest extends DatabaseTestCase { - public function setUp() + protected function setUp() { parent::setUp(); - $this->mockApplication(); ActiveRecord::$db = $this->getConnection(); + + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); } public function testAssureMessageSetOnInit() diff --git a/tests/framework/validators/UrlValidatorTest.php b/tests/framework/validators/UrlValidatorTest.php index 063d172f7a1..1448866300d 100644 --- a/tests/framework/validators/UrlValidatorTest.php +++ b/tests/framework/validators/UrlValidatorTest.php @@ -14,7 +14,9 @@ class UrlValidatorTest extends TestCase protected function setUp() { parent::setUp(); - $this->mockApplication(); + + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); } public function testValidateValue() diff --git a/tests/framework/validators/ValidatorTest.php b/tests/framework/validators/ValidatorTest.php index eb3ab054221..cb87e44a5a1 100644 --- a/tests/framework/validators/ValidatorTest.php +++ b/tests/framework/validators/ValidatorTest.php @@ -17,7 +17,9 @@ class ValidatorTest extends TestCase protected function setUp() { parent::setUp(); - $this->mockApplication(); + + // destroy application, Validator must work without Yii::$app + $this->destroyApplication(); } protected function getTestModel($additionalAttributes = [])