Skip to content

Bug: case-insensitive treatment of single-word view cells in Windows and macOS #7472

@paulbalandan

Description

@paulbalandan

PHP Version

8.2

CodeIgniter4 Version

develop

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?

This test (CellGeneratorTest) currently fails on Windows:

    public function testGenerateCellSimpleName()
    {
        command('make:cell Another');

        // Check the class was generated
        $file = APPPATH . 'Cells/Another.php';
        $this->assertStringContainsString('File created: ' . clean_path($file), $this->getStreamFilterBuffer());
        $this->assertFileExists($file);
        $this->assertStringContainsString('class Another extends Cell', $this->getFileContents($file));

        // Check the view was generated
        $file = APPPATH . 'Cells/another.php';
        $this->assertStringContainsString('File created: ' . clean_path($file), $this->getStreamFilterBuffer());
        $this->assertFileExists($file);
        $this->assertSame("<div>\n    <!-- Your HTML here -->\n</div>\n", $this->getFileContents($file));
    }

This is because on Windows, Cells/Another.php is treated the same as Cells/another.php. Thus, only one file is generated, the class file. The view file is skipped.

Steps to Reproduce

Run the test above in Windows. Linux and MacOS are not affected.

Expected Output

I think we should add a check if the cell name is a single word and it is run through Windows. If that's the case, we forbid single word as cell name through a nice error message.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions