Bug: [4.4] Failed tests on Windows.
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
- #10210 de @jalexiscv — fechado sem integrar
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 42/100
Direção de pesquisa
Comece com system/Router/RouteCollection.php nas linhas vinculadas e tests/system/CodeIgniterTest.php; depois execute vendor/bin/phpunit.bat tests/system/CodeIgniterTest.php no Windows. Rastreie a comparação do caminho do arquivo de rotas e garanta que as rotas da aplicação não sejam carregadas para esses testes; os testes afetados do Windows e os testes de caminho relacionados devem passar.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- PHP
- Estrelas
- 6k
- Forks
- 2k
- Merge médio
- 1d 22h
- PRs com merge (30d)
- 59
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de codeigniter4/CodeIgniter4
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
codeigniter4/CodeIgniter4#10616 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
codeigniter4/CodeIgniter4#10618 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 62/100
codeigniter4/CodeIgniter4#10617 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 25/100
codeigniter4/CodeIgniter4#10615 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
codeigniter4/CodeIgniter4#10589 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de codeigniter4/CodeIgniter4
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Automattic/blocks-engine#2803 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
hestiacp/hestiacp#5798 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
woocommerce/woocommerce-google-analytics-integration#699 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
wp-media/imagify-plugin#1289 ·
Mantenedores costumam responder em até 5 dias
-
Sidebar highlights two items when plugin routes share a prefix (/plugin/foo and /plugin/foo-bar)Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
getgrav/grav-plugin-admin2#195 ·