Browse Source

Fixed AssetBundleTest to work on Windows

tags/3.0.0-alpha1
Alexander Makarov 7 years ago
parent
commit
0b421596a0
No known key found for this signature in database
GPG Key ID: 3617B79C6A325E4A
  1. 20
      tests/framework/web/AssetBundleTest.php

20
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;
<link href="/screen_and_print.css" rel="stylesheet" media="screen, print" hreflang="en">23<script src="/normal.js" charset="utf-8"></script>
<script src="/defered.js" charset="utf-8" defer></script>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()

Loading…
Cancel
Save