Welcome Guest, Not a member yet? Register   Sign In
[4.4] Tests fail

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?

Cannot reproduce.

(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)

(This post was last modified: 05-02-2023, 02:07 AM by iRedds.)

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)) {

                include $file;
array(2) {
  string(59) "D:\1\CodeIgniter4\app\Config\Routes.php"
  string(70) "D:\1\CodeIgniter4\tests\_support\Config\Routes.php"

array(1) {
  string(59) "D:\1\CodeIgniter4\app\Config/Routes.php"

Most tests that depend on paths fail on Windows.

(This post was last modified: 07-12-2023, 05:30 PM by brabus.)

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?


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.

We orginally had this problem with the start of CodeIgniter 4 with the path seperator in views on Windows.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Theme © iAndrew 2016 - Forum software by © MyBB