upgrade icon indicating copy to clipboard operation
upgrade copied to clipboard

Failure while renaming Layout folder on Linux

Open bancer opened this issue 1 year ago • 1 comments

I have done the steps derscribed in https://book.cakephp.org/4/en/appendices/4-0-upgrade-guide.html#use-the-upgrade-tool without upgrading cakephp to 4.x.

# Install the upgrade tool
git clone https://github.com/cakephp/upgrade
cd upgrade
git checkout 4.x
composer install --no-dev

bin/cake upgrade file_rename templates /path/to/project

Executing bin/cake upgrade file_rename templates /path/to/project --verbose exited with an exception:

Renaming /path/to/project/src/Template
Move /path/to/project/src/Template to /path/to/project/templates
Moving sub directories of /path/to/project/templates
Move /path/to/project/templates/Layout to /path/to/project/templates/layout with filesystem casing
PHP Fatal error:  Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(/path/to/project/templates/Layout/Email): Failed to open directory: No such file or directory in /path/to/upgrade/src/Command/FileRenameCommand.php:210
Stack trace:
#0 [internal function]: RecursiveDirectoryIterator->__construct()
#1 [internal function]: RecursiveDirectoryIterator->getChildren()
#2 /path/to/upgrade/src/Command/FileRenameCommand.php(210): FilterIterator->next()
#3 /path/to/upgrade/src/Command/FileRenameCommand.php(127): Cake\Upgrade\Command\FileRenameCommand->renameSubFolders()
#4 /path/to/upgrade/src/Command/FileRenameCommand.php(104): Cake\Upgrade\Command\FileRenameCommand->processTemplates()
#5 /path/to/upgrade/vendor/cakephp/cakephp/src/Console/BaseCommand.php(190): Cake\Upgrade\Command\FileRenameCommand->execute()
#6 /path/to/upgrade/vendor/cakephp/cakephp/src/Console/CommandRunner.php(334): Cake\Console\BaseCommand->run()
#7 /path/to/upgrade/vendor/cakephp/cakephp/src/Console/CommandRunner.php(172): Cake\Console\CommandRunner->runCommand()
#8 /path/to/upgrade/bin/cake.php(12): Cake\Console\CommandRunner->run()
#9 {main}
  thrown in /path/to/upgrade/src/Command/FileRenameCommand.php on line 210

When I looked inside /path/to/project/templates folder I saw "layout" folder in lowercase.

System: Ubuntu 20.04 LTS. PHP 8.3.6

bancer avatar May 03 '24 09:05 bancer

By the way, unit tests fail on 4.x branch with a similar error:

git checkout 4.x

vendor/bin/phpunit ./tests/

PHPUnit 9.6.19 by Sebastian Bergmann and contributors.

E.....................                                            22 / 22 (100%)

Time: 00:19.503, Memory: 118.50 MB

There was 1 error:

1) Cake\Upgrade\Test\TestCase\Command\FileRenameCommandTest::testTemplates
UnexpectedValueException: RecursiveDirectoryIterator::__construct(/path/to/upgrade/tmp/test_app/templates/Element/Flash): Failed to open directory: No such file or directory

/path/to/upgrade/src/Command/FileRenameCommand.php:210
/path/to/upgrade/src/Command/FileRenameCommand.php:127
/path/to/upgrade/src/Command/FileRenameCommand.php:104
/path/to/upgrade/vendor/cakephp/cakephp/src/Console/BaseCommand.php:190
/path/to/upgrade/vendor/cakephp/cakephp/src/Console/CommandRunner.php:334
/path/to/upgrade/vendor/cakephp/cakephp/src/Console/CommandRunner.php:172
/path/to/upgrade/vendor/cakephp/cakephp/src/Console/TestSuite/ConsoleIntegrationTestTrait.php:106
/path/to/upgrade/tests/TestCase/Command/FileRenameCommandTest.php:32

ERRORS!
Tests: 22, Assertions: 34, Errors: 1.

bancer avatar May 03 '24 11:05 bancer

Closing as one of the fixes was merged.

markstory avatar May 12 '24 00:05 markstory