diff --git a/tests/unit/TestCase.php b/tests/unit/TestCase.php
index 5a286cfcd26..f4f8e2d4eae 100644
--- a/tests/unit/TestCase.php
+++ b/tests/unit/TestCase.php
@@ -83,4 +83,18 @@ protected function destroyApplication()
{
\Yii::$app = null;
}
+
+ /**
+ * Asserting two strings equality ignoring line endings
+ *
+ * @param string $expected
+ * @param string $actual
+ */
+ public function assertEqualsWithoutLE($expected, $actual)
+ {
+ $expected = str_replace("\r\n", "\n", $expected);
+ $actual = str_replace("\r\n", "\n", $actual);
+
+ $this->assertEquals($expected, $actual);
+ }
}
diff --git a/tests/unit/framework/helpers/HtmlTest.php b/tests/unit/framework/helpers/HtmlTest.php
index 25cfe2cc9a4..848c2fdcf2f 100644
--- a/tests/unit/framework/helpers/HtmlTest.php
+++ b/tests/unit/framework/helpers/HtmlTest.php
@@ -28,14 +28,6 @@ protected function setUp()
]);
}
- public function assertEqualsWithoutLE($expected, $actual)
- {
- $expected = str_replace("\r\n", "\n", $expected);
- $actual = str_replace("\r\n", "\n", $actual);
-
- $this->assertEquals($expected, $actual);
- }
-
public function testEncode()
{
$this->assertEquals("a<>&"'�", Html::encode("a<>&\"'\x80"));
diff --git a/tests/unit/framework/web/AssetBundleTest.php b/tests/unit/framework/web/AssetBundleTest.php
index 73faa9faf75..2f67ebe6e2f 100644
--- a/tests/unit/framework/web/AssetBundleTest.php
+++ b/tests/unit/framework/web/AssetBundleTest.php
@@ -71,7 +71,7 @@ public function testSimpleDependency()
123
4
EOF;
- $this->assertEquals($expected, $view->renderFile('@yiiunit/data/views/rawlayout.php'));
+ $this->assertEqualsWithoutLE($expected, $view->renderFile('@yiiunit/data/views/rawlayout.php'));
}
public function positionProvider()
@@ -142,7 +142,7 @@ public function testPositionDependency($pos, $jqAlreadyRegistered)
EOF;
break;
}
- $this->assertEquals($expected, $view->renderFile('@yiiunit/data/views/rawlayout.php'));
+ $this->assertEqualsWithoutLE($expected, $view->renderFile('@yiiunit/data/views/rawlayout.php'));
}
public function positionProvider2()
diff --git a/tests/unit/framework/widgets/ActiveFormTest.php b/tests/unit/framework/widgets/ActiveFormTest.php
index c38c486a377..ae33fc7e433 100644
--- a/tests/unit/framework/widgets/ActiveFormTest.php
+++ b/tests/unit/framework/widgets/ActiveFormTest.php
@@ -18,14 +18,6 @@ protected function setUp()
$this->mockApplication();
}
- public function assertEqualsWithoutLE($expected, $actual)
- {
- $expected = str_replace("\r\n", "\n", $expected);
- $actual = str_replace("\r\n", "\n", $actual);
-
- $this->assertEquals($expected, $actual);
- }
-
public function testBooleanAttributes()
{
$o = ['template' => '{input}'];