diff --git a/tests/framework/web/AssetBundleTest.php b/tests/framework/web/AssetBundleTest.php index 393a99b..967519f 100644 --- a/tests/framework/web/AssetBundleTest.php +++ b/tests/framework/web/AssetBundleTest.php @@ -42,7 +42,7 @@ class AssetBundleTest extends \yiiunit\TestCase if (is_dir($path)) { FileHelper::removeDirectory($path); } else { - unlink($path); + $this->unlink($path); } } closedir($handle); @@ -194,10 +194,24 @@ class AssetBundleTest extends \yiiunit\TestCase $this->assertFileEquals($publishedFile, $sourceFile); } - $this->assertTrue(unlink($bundle->basePath)); + $this->assertTrue($this->unlink($bundle->basePath)); return $bundle; } + /** + * Properly removes symlinked directory under Windows, MacOS and Linux + * + * @param string $file path to symlink + * @return bool + */ + protected function unlink($file) + { + if (is_dir($file) && DIRECTORY_SEPARATOR === '\\') { + return rmdir($file); + } + return unlink($file); + } + public function testRegister() { $view = $this->getView(); @@ -379,7 +393,7 @@ EOF; 23 4 EOF; - $this->assertEquals($expected, $view->renderFile('@yiiunit/data/views/rawlayout.php')); + $this->assertEqualsWithoutLE($expected, $view->renderFile('@yiiunit/data/views/rawlayout.php')); } public function registerFileDataProvider()