yiisoft/yii-core

wrong Theme ref in test file

axtho opened this issue · 3 comments

axtho commented

use yii\base\Theme;
... should this not be yii\view\Theme?

Yes.

After the bug fixing the tests are still broken.

suuser@farm /var/www/yii3.test/vendor/yiisoft/yii-core (107-fix-theme-bug) $ vendor/bin/phpunit move-tests/view/ThemeTest.php
PHPUnit 7.5.5-1-gd00d0af03 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.2.15-1+ubuntu18.04.1+deb.sury.org+1 with Xdebug 2.6.1
Configuration: /var/www/yii3.test/vendor/yiisoft/yii-core/phpunit.xml.dist

FFFEEFFEEEE.                                                      12 / 12 (100%)

Time: 235 ms, Memory: 8.00MB
                                                                                                                                                                                             
There were 6 errors:                                                                                                                                                                         
                                                                                                                                                                                             
1) yii\tests\framework\base\ThemeTest::testSetBasePath                                                                                                                                       
yii\exceptions\InvalidArgumentException: Invalid path alias: @app/framework/base/fixtures/themes/basic                                                                                       
                                                                                                                                                                                             
/var/www/yii3.test/vendor/yiisoft/yii-core/src/base/Aliases.php:144                                                                                                                          
/var/www/yii3.test/vendor/yiisoft/yii-core/src/helpers/BaseYii.php:253                                                                                                                       
/var/www/yii3.test/vendor/yiisoft/yii-core/move-tests/view/ThemeTest.php:62                                                                                                                  
/var/www/yii3.test/vendor/yiisoft/yii-core/vendor/phpunit/phpunit/phpunit:61                                                                                                                 
                                                                                                                                                                                             
2) yii\tests\framework\base\ThemeTest::testGetPathFilledBasePath
yii\exceptions\InvalidArgumentException: Invalid path alias: @app/framework/base/fixtures/themes/basic/img/logo.gif

/var/www/yii3.test/vendor/yiisoft/yii-core/src/base/Aliases.php:144
/var/www/yii3.test/vendor/yiisoft/yii-core/src/helpers/BaseYii.php:253
/var/www/yii3.test/vendor/yiisoft/yii-core/move-tests/view/ThemeTest.php:70
/var/www/yii3.test/vendor/yiisoft/yii-core/vendor/phpunit/phpunit/phpunit:61

3) yii\tests\framework\base\ThemeTest::testApplyToEmptyPathMap
yii\exceptions\InvalidArgumentException: Invalid path alias: @app/framework/base/fixtures/themes/basic/views/site/index.php

/var/www/yii3.test/vendor/yiisoft/yii-core/src/base/Aliases.php:144
/var/www/yii3.test/vendor/yiisoft/yii-core/src/helpers/BaseYii.php:253
/var/www/yii3.test/vendor/yiisoft/yii-core/move-tests/view/ThemeTest.php:98
/var/www/yii3.test/vendor/yiisoft/yii-core/vendor/phpunit/phpunit/phpunit:61

4) yii\tests\framework\base\ThemeTest::testApplyToFilledPathMap
yii\exceptions\InvalidArgumentException: Invalid path alias: @app/framework/base/fixtures/themes/basic/views/site/index.php

/var/www/yii3.test/vendor/yiisoft/yii-core/src/base/Aliases.php:144
/var/www/yii3.test/vendor/yiisoft/yii-core/src/helpers/BaseYii.php:253
/var/www/yii3.test/vendor/yiisoft/yii-core/move-tests/view/ThemeTest.php:113
/var/www/yii3.test/vendor/yiisoft/yii-core/vendor/phpunit/phpunit/phpunit:61

5) yii\tests\framework\base\ThemeTest::testApplyToFilledPathMapNotExistsViewInFirstTheme
yii\exceptions\InvalidArgumentException: Invalid path alias: @app/framework/base/fixtures/themes/christmas/views/site/main.php

/var/www/yii3.test/vendor/yiisoft/yii-core/src/base/Aliases.php:144
/var/www/yii3.test/vendor/yiisoft/yii-core/src/helpers/BaseYii.php:253
/var/www/yii3.test/vendor/yiisoft/yii-core/move-tests/view/ThemeTest.php:131
/var/www/yii3.test/vendor/yiisoft/yii-core/vendor/phpunit/phpunit/phpunit:61

6) yii\tests\framework\base\ThemeTest::testApplyToFilledPathMapAndInheritThemes
yii\exceptions\InvalidArgumentException: Invalid path alias: @app/framework/base/fixtures/themes/christmas/views/site/index.php

/var/www/yii3.test/vendor/yiisoft/yii-core/src/base/Aliases.php:144
/var/www/yii3.test/vendor/yiisoft/yii-core/src/helpers/BaseYii.php:253
/var/www/yii3.test/vendor/yiisoft/yii-core/move-tests/view/ThemeTest.php:149
/var/www/yii3.test/vendor/yiisoft/yii-core/vendor/phpunit/phpunit/phpunit:61

--

There were 5 failures:

1) yii\tests\framework\base\ThemeTest::testSetBaseUrl
Failed asserting that null matches expected '/themes/basic'.

/var/www/yii3.test/vendor/yiisoft/yii-core/move-tests/view/ThemeTest.php:37
/var/www/yii3.test/vendor/yiisoft/yii-core/vendor/phpunit/phpunit/phpunit:61

2) yii\tests\framework\base\ThemeTest::testGetUrlFilledBaseUrl
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'/themes/basic/js/test.js'
+'/js/test.js'

/var/www/yii3.test/vendor/yiisoft/yii-core/move-tests/view/ThemeTest.php:47
/var/www/yii3.test/vendor/yiisoft/yii-core/vendor/phpunit/phpunit/phpunit:61

3) yii\tests\framework\base\ThemeTest::testGetUrlNotFilledBaseUrl
Failed asserting that exception of type "yii\exceptions\InvalidConfigException" is thrown.

/var/www/yii3.test/vendor/yiisoft/yii-core/vendor/phpunit/phpunit/phpunit:61

4) yii\tests\framework\base\ThemeTest::testGetPathNotFilledBasePath
Failed asserting that exception of type "yii\exceptions\InvalidConfigException" is thrown.

/var/www/yii3.test/vendor/yiisoft/yii-core/vendor/phpunit/phpunit/phpunit:61

5) yii\tests\framework\base\ThemeTest::testApplyToEmptyBasePath
Failed asserting that exception of type "TypeError" matches expected exception "yii\exceptions\InvalidConfigException". Message was: "Argument 1 passed to yii\helpers\BaseFileHelper::normalizePath() must be of the type string, null given, called in /var/www/yii3.test/vendor/yiisoft/yii-core/vendor/yiisoft/view/src/view/Theme.php on line 145" at
/var/www/yii3.test/vendor/yiisoft/yii-core/src/helpers/BaseFileHelper.php:55
/var/www/yii3.test/vendor/yiisoft/yii-core/vendor/yiisoft/view/src/view/Theme.php:145
/var/www/yii3.test/vendor/yiisoft/yii-core/move-tests/view/ThemeTest.php:92
/var/www/yii3.test/vendor/yiisoft/yii-core/vendor/phpunit/phpunit/phpunit:61
.

/var/www/yii3.test/vendor/yiisoft/yii-core/vendor/phpunit/phpunit/phpunit:61

ERRORS!
Tests: 12, Assertions: 6, Errors: 6, Failures: 5.

Why do we need move-tests directory at all? Isn't tests enough?

These are tests that should be moved to other packages. Effort was started by @hiqsol here: c7a1096#diff-1831d3111c1aa7f29a5b498ce91200a4