From 1bc17a3d22cae876df66486306cc9e4e8effa970 Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Thu, 18 Jan 2018 11:21:40 +0100 Subject: [PATCH] improved dockerized tests (#15516) - added ENV variable for using custom runtime folder - create assets directory before using asset-manager --- tests/bootstrap.php | 5 +++++ tests/docker-compose.yml | 2 ++ tests/framework/grid/CheckboxColumnTest.php | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 9b8a1bb..16965e1 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -23,5 +23,10 @@ require_once __DIR__ . '/../framework/Yii.php'; Yii::setAlias('@yiiunit', __DIR__); +if (getenv('TEST_RUNTIME_PATH')) { + Yii::setAlias('@yiiunit/runtime', getenv('TEST_RUNTIME_PATH')); + Yii::setAlias('@runtime', getenv('TEST_RUNTIME_PATH')); +} + require_once __DIR__ . '/compatibility.php'; require_once __DIR__ . '/TestCase.php'; diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml index 570abcb..3a11c66 100644 --- a/tests/docker-compose.yml +++ b/tests/docker-compose.yml @@ -12,6 +12,8 @@ services: # Tmpfs volume (experimental, asset tests may fail) #tmpfs: # - /project/tests/runtime + environment: + - TEST_RUNTIME_PATH=/tmp/runtime networks: default: diff --git a/tests/framework/grid/CheckboxColumnTest.php b/tests/framework/grid/CheckboxColumnTest.php index 5612c83..60a2c23 100644 --- a/tests/framework/grid/CheckboxColumnTest.php +++ b/tests/framework/grid/CheckboxColumnTest.php @@ -27,8 +27,8 @@ class CheckboxColumnTest extends TestCase $this->mockApplication(); Yii::setAlias('@webroot', '@yiiunit/runtime'); Yii::setAlias('@web', 'http://localhost/'); - Yii::$app->assetManager->bundles['yii\web\JqueryAsset'] = false; FileHelper::createDirectory(Yii::getAlias('@webroot/assets')); + Yii::$app->assetManager->bundles['yii\web\JqueryAsset'] = false; } public function testInputName()