CodeIgniter Forums
[4.4] Tests fail - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: [4.4] Tests fail (/showthread.php?tid=87539)



[4.4] Tests fail - iRedds - 05-01-2023

In the 4.4 branch, the CodeIgniter\CodeIgniterTest::testRun404Override() and similar tests fail.
All tests return welcome_page. Since the request goes to $_SERVER['argv'] = ['index.php', '/'];
And in routes, the default route is on App\Controllers\Home::index
In the develop branch, tests pass.

Are these problems on my side, or is the 4.4 branch not tested?


RE: [4.4] Tests fail - kenjis - 05-01-2023

Cannot reproduce.

Code:
(4.4 $=)$ vendor/bin/phpunit tests/system/CodeIgniterTest.php
PHPUnit 9.6.7 by Sebastian Bergmann and contributors.

Runtime:      PHP 8.1.18
Configuration: /Users/kenji/work/codeigniter/official/CodeIgniter4/phpunit.xml

...................................                                                                                                      35 / 35 (100%)

Time: 00:01.585, Memory: 30.00 MB

OK (35 tests, 57 assertions)



RE: [4.4] Tests fail - iRedds - 05-01-2023

Strange behavior.
On Windows, there are errors in the tests.
On a virtual machine in Ubuntu, there are no errors in the tests.

2All: Can someone test on Windows (no WSL)?

OK. I found. The problem was in the file paths.
PHP Code:
// \CodeIgniter\Router\RouteCollection::discoverRoutes()
            $files $this->fileLocator->search('Config/Routes.php');

            foreach ($files as $file) {
                // Don't include our main file again...
                if (in_array($file$this->routeFilestrue)) {
                    continue;
                }

                include $file;
            }
/*
$files
array(2) {
  [0]=>
  string(59) "D:\1\CodeIgniter4\app\Config\Routes.php"
  [1]=>
  string(70) "D:\1\CodeIgniter4\tests\_support\Config\Routes.php"
}

$this->routeFiles
array(1) {
  [0]=>
  string(59) "D:\1\CodeIgniter4\app\Config/Routes.php"
}
*/ 



Most tests that depend on paths fail on Windows.


RE: [4.4] Tests fail - brabus - 07-12-2023

Quote:You should always be careful about the case of filenames. Many developers develop on case-insensitive file systems on Windows or macOS. However, most server environments use case-sensitive file systems. If the file name case is incorrect, code that works locally will not work on the server.

Can it help?

https://codeigniter4.github.io/CodeIgniter4/installation/running.html


RE: [4.4] Tests fail - kenjis - 07-12-2023

No, it is not related to this case. It is because of the directory separator "\" (Windows) or "/" (others).

On Windows the current 89 tests for the framework fails.
https://github.com/codeigniter4/CodeIgniter4/pull/7491


RE: [4.4] Tests fail - InsiteFX - 07-12-2023

We orginally had this problem with the start of CodeIgniter 4 with the path seperator in views on Windows.