Bug: [4.4] Failed tests on Windows.
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #10210 của @jalexiscv — đã đóng, không merge
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 42/100
Hướng nghiên cứu
Bắt đầu với system/Router/RouteCollection.php quanh các dòng được liên kết và tests/system/CodeIgniterTest.php, sau đó chạy vendor/bin/phpunit.bat tests/system/CodeIgniterTest.php trên Windows. Theo dõi việc so sánh đường dẫn tệp route và đảm bảo các route của ứng dụng không được tải cho các bài kiểm thử này; các bài kiểm thử Windows bị ảnh hưởng và các bài kiểm thử đường dẫn liên quan sẽ phải vượt qua.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
PHP Version
7.4
CodeIgniter4 Version
4.4
CodeIgniter4 Installation Method
Git
Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
No response
What happened?
After PR https://github.com/codeigniter4/CodeIgniter4/pull/7380 in Windows CodeIgniter\CodeIgniterTest::testRun404Override() and similar tests fail.
Instead of the expected response from the 404 error handler, a welcome_page is returned (from App\Controller\Home::index)
$ d:\1\CodeIgniter4\vendor\bin\phpunit.bat tests\system\CodeIgniterTest.php
PHPUnit 9.6.7 by Sebastian Bergmann and contributors.
Runtime: PHP 8.1.1
Configuration: D:\1\CodeIgniter4\phpunit.xml.dist
Warning: No code coverage driver available
...FFFF............................ 35 / 35 (100%)
Time: 00:04.175, Memory: 28.00 MB
There were 4 failures:
1) CodeIgniter\CodeIgniterTest::testRun404Override
Failed asserting that '<!-- DEBUG-VIEW START 1 APPPATH\Views\welcome_message.php -->\r\n
[cut]
D:\1\CodeIgniter4\tests\system\CodeIgniterTest.php:124
2) CodeIgniter\CodeIgniterTest::testRun404OverrideControllerReturnsResponse
Failed asserting that '<!-- DEBUG-VIEW START 1 APPPATH\Views\welcome_message.php -->\r\n
[cut]
...etc
This is happening in this code snippet due to the difference in paths (directory separators) between Windows and UNIX.
https://github.com/codeigniter4/CodeIgniter4/blob/d9fd9d5e9dc34bcaa249c0df42c5d371ca45e582/system/Router/RouteCollection.php#L323-L332
$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" <--- DS
}
Due to the difference in paths, the comparison fails and the file with routes from the application is loaded, thereby adding the route that is accessed in the tests.
Expected Output
Since the framework can be used not only on UNIX, the tests must also pass on Windows. This issue is just a special case and fixing by changing the requested resource in the tests will not solve the problem. That is, the behavior should be like in UNIX, that is, the route from the application should not be loaded.
Anything else?
In other tests related to file/directory paths, there are also errors on Windows due to the directory separator.
- Ngôn ngữ chính
- PHP
- Star
- 6k
- Fork
- 2k
- Merge trung bình
- 1 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 59
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codeigniter4/CodeIgniter4
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
codeigniter4/CodeIgniter4#10616 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
codeigniter4/CodeIgniter4#10618 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
codeigniter4/CodeIgniter4#10617 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
codeigniter4/CodeIgniter4#10615 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
codeigniter4/CodeIgniter4#10589 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của codeigniter4/CodeIgniter4
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
woocommerce/woocommerce-google-analytics-integration#699 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ProfessionalWiki/NeoWiki#1675 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Incorrect documentationĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100