Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Tests that failing on Windows #9123

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

pawelkg
Copy link
Contributor

@pawelkg pawelkg commented Aug 15, 2024

Description
See #7474

A lots of directory separator mismatch in path fixed.

CodeIgniter\Database\Migrations\MigrationRunnerTest::testMigrationUsesSameConnectionAsMigrationRunner
ErrorException: unlink(\writable\runner.sqlite): Resource temporarily unavailable
\tests\system\Database\Migrations\MigrationRunnerTest.php:477
Propably related to: https://bugs.php.net/bug.php?id=78930

CodeIgniter\HTTP\Files\FileMovingTest::testStore
ErrorException: mkdir(): No such file or directory

\system\HTTP\Files\UploadedFile.php:181
\system\HTTP\Files\UploadedFile.php:135
\system\HTTP\Files\UploadedFile.php:355
\tests\system\HTTP\Files\FileMovingTest.php:215

On Windows path was: WRITEPATH . 'uploads/vfs://path/to/file'

In addition change composer test command to work on slower computers.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@pawelkg pawelkg changed the title Fix some tests that failing on Windows fix: Tests that failing on Windows Aug 15, 2024
@kenjis
Copy link
Member

kenjis commented Aug 26, 2024

Thank you for sending this PR.
But unfortunately It seems that no one is interested in this PR.
I cannot review because I don't use Windows.

Also, this PR contains multiple changes, so it is difficult to review.
I think it would be more likely to be reviewed if you sent multiple small PRs that address one issue each.

Comment on lines -106 to +109
$expected = APPPATH . 'Views/errors/html/error_404.php';
$expected = APPPATH . 'Views'
. DIRECTORY_SEPARATOR . 'errors'
. DIRECTORY_SEPARATOR . 'html'
. DIRECTORY_SEPARATOR . 'error_404.php';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I don't like to write test code like this.
Because it is a bit more difficult to read.
So, I would like a different solution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kenjis In my case, I usually prefer to use implode() for paths, which I find improves clarity and maintainability. Here's an example of how it could be refactored using implode()

$expected = implode(DIRECTORY_SEPARATOR, [APPPATH, 'Views', 'errors', 'html', 'error_404.php']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants