Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper independent #14050

Merged
merged 2 commits into from
Apr 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/framework/helpers/ArrayHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -267,6 +269,7 @@ public function testMultisortUseSort()
$sort = new Sort([
'attributes' => ['name', 'age'],
'defaultOrder' => ['name' => SORT_ASC],
'params' => [],
]);
$orders = $sort->getOrders();

Expand All @@ -284,6 +287,7 @@ public function testMultisortUseSort()
$sort = new Sort([
'attributes' => ['name', 'age'],
'defaultOrder' => ['name' => SORT_ASC, 'age' => SORT_DESC],
'params' => [],
]);
$orders = $sort->getOrders();

Expand Down
8 changes: 8 additions & 0 deletions tests/framework/helpers/ConsoleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 6 additions & 0 deletions tests/framework/helpers/FileHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions tests/framework/helpers/InflectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
8 changes: 8 additions & 0 deletions tests/framework/helpers/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions tests/framework/helpers/MarkdownTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <<<TEXT
Expand Down
8 changes: 8 additions & 0 deletions tests/framework/helpers/VarDumperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
*/
class VarDumperTest extends TestCase
{
protected function setUp()
{
parent::setUp();

// destroy application, Helper must work without Yii::$app
$this->destroyApplication();
}

public function testDumpIncompleteObject()
{
$serializedObj = 'O:16:"nonExistingClass":0:{}';
Expand Down
4 changes: 3 additions & 1 deletion tests/framework/validators/BooleanValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion tests/framework/validators/CompareValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion tests/framework/validators/DefaultValueValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion tests/framework/validators/EachValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion tests/framework/validators/EmailValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 4 additions & 2 deletions tests/framework/validators/ExistValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
3 changes: 2 additions & 1 deletion tests/framework/validators/FileValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
*/
class FileValidatorTest extends TestCase
{
public function setUp()
protected function setUp()
{
parent::setUp();
$this->mockApplication();
}

Expand Down
3 changes: 2 additions & 1 deletion tests/framework/validators/FilterValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion tests/framework/validators/IpValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 4 additions & 1 deletion tests/framework/validators/NumberValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion tests/framework/validators/RangeValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion tests/framework/validators/RequiredValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 4 additions & 2 deletions tests/framework/validators/UniqueValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion tests/framework/validators/UrlValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion tests/framework/validators/ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [])
Expand Down