ybrunet
(Yakitabrunet)
1
I created a phpunit test which references Yii::app()->theme->baseUrl.
When I run, I get an error – "no theme directory exist in "/usr/bin/themes".
Wondering anyone had a similar problem using theme and phpunit.
CException: Theme directory "/usr/bin/themes" does not exist.
/var/www/yii-1.1.8.r3324/framework/web/CThemeManager.php:107
/var/www/yii-1.1.8.r3324/framework/web/CThemeManager.php:95
/var/www/yii-1.1.8.r3324/framework/web/CThemeManager.php:57
/var/www/yii-1.1.8.r3324/framework/web/CWebApplication.php:252
/var/www/yii-1.1.8.r3324/framework/base/CComponent.php:112
/var/www/yii-1.1.8.r3324/framework/base/CModule.php:88
/var/www/mystore/protected/models/MyProduct.php:139
/var/www/mystore/protected/tests/unit/MyProductTest.php:77
I have the same problem, I am trying to test a controller action and I am getting this error
- MealControllerTest::testSortView
CException: Theme directory "/themes" does not exist.
/var/www/html/common/lib/Yii/web/CThemeManager.php:110
/var/www/html/common/lib/Yii/web/CThemeManager.php:98
/var/www/html/common/lib/Yii/web/CThemeManager.php:60
/var/www/html/common/lib/Yii/web/CWebApplication.php:257
/var/www/html/common/modules/core/components/Controller.php:465
/var/www/html/common/lib/Yii/web/CController.php:867
/var/www/html/common/lib/Yii/web/CController.php:782
/var/www/html/backend/controllers/MealController.php:74
/var/www/html/backend/tests/unit/MealControllerTest.php:58
/usr/bin/phpunit:45
Did you find by any chance any solution to this?
I did manage to get around this problem by setting
Yii::app()->themeManager->setBasePath(dirname(FILE) . DIRECTORY_SEPARATOR . ‘…’ . DIRECTORY_SEPARATOR . ‘…’ . DIRECTORY_SEPARATOR . ‘…’ . DIRECTORY_SEPARATOR . ‘www’ . DIRECTORY_SEPARATOR . ‘admin’ . DIRECTORY_SEPARATOR . ‘themes’);
In the beginning of the test. Change to your own theme folder.