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

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?
Reply
#2

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)
Reply
#3

(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)) {
                    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.
Reply
#4

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

https://codeigniter4.github.io/CodeIgnit...nning.html
Reply
#5

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
Reply
#6

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




Theme © iAndrew 2016 - Forum software by © MyBB