fix: ensure make:test works on Windows#9635
fix: ensure make:test works on Windows#9635paulbalandan merged 2 commits intocodeigniter4:developfrom
make:test works on Windows#9635Conversation
datamweb
left a comment
There was a problem hiding this comment.
Although it might be a bit late to bring this up, based on my understanding of the documentation, test files should end with the Test suffix (e.g., FooTest.php).
Therefore, I would expect the php spark make:test command to follow this convention and automatically append the Test suffix to the class name if it’s not already present.
In this document, the test files corresponding to the classes in the app directory will be placed in the tests/app directory. To test a new library, app/Libraries/Foo.php, you would create a new file at tests/app/Libraries/FooTest.php:
Secondly, currently, if the command is run with missing or incorrect parameters (e.g., php spark make:test), the user is prompted to enter the class name multiple times—up to three times—before the file is finally generated.
To avoid this issue:
$this->classNameLang = 'CLI.generator.className.test';
if (! isset($params[0]) || empty($params[0])) {
$params[0] = CLI::prompt(lang($this->classNameLang), null, 'required');
}|
@datamweb This seems a bit out of the scope of this PR. Can you send a separate PR? |
|
@paulbalandan We would need a changelog entry. |
To be addressed in a separate PR.
|
I have confirmed both of your issues, @datamweb, I'll address those in separate PRs. |
Description
Fixes #9634 . Pending fix confirmation from @b-and-p for Windows.
As this is Windows-related, I cannot write a unit test. But you can test this fix in macOS by reversing the directory separator, the phenomenon experienced in Windows.
Checklist: