Skip to content

Class "Migrations\AbstractMigration" not found error does not point to migration which is broken #1058

@LordSimal

Description

@LordSimal

As just reported in support chat when upgrading to latest Migrations v5 it could happen, that not all migrations have yet ported over to the new base class. This causes the following error/stacktrace when running phpunit tests with the migrator:

Error in bootstrap script: Error:
Class "Migrations\AbstractMigration" not found
#0 /Users/kevin/Documents/sunlime/alfred/vendor/cakephp/migrations/src/Migration/Manager.php(986): require()
#1 /Users/kevin/Documents/sunlime/alfred/vendor/cakephp/migrations/src/Migration/Manager.php(452): Migrations\Migration\Manager->getMigrations()
#2 /Users/kevin/Documents/sunlime/alfred/vendor/cakephp/migrations/src/Migration/BuiltinBackend.php(96): Migrations\Migration\Manager->migrate(NULL)
#3 /Users/kevin/Documents/sunlime/alfred/vendor/cakephp/migrations/src/Migrations.php(114): Migrations\Migration\BuiltinBackend->migrate(Array)
#4 /Users/kevin/Documents/sunlime/alfred/vendor/cakephp/migrations/src/TestSuite/Migrator.php(116): Migrations\Migrations->migrate(Array)
#5 /Users/kevin/Documents/sunlime/alfred/tests/bootstrap.php(62): Migrations\TestSuite\Migrator->runMany(Array)
#6 /Users/kevin/Documents/sunlime/alfred/vendor/phpunit/phpunit/src/TextUI/Configuration/BootstrapLoader.php(61): include_once('/Users/kevin/Do...')
#7 /Users/kevin/Documents/sunlime/alfred/vendor/phpunit/phpunit/src/TextUI/Configuration/BootstrapLoader.php(36): PHPUnit\TextUI\Configuration\BootstrapLoader->load('/Users/kevin/Do...')
#8 /Users/kevin/Documents/sunlime/alfred/vendor/phpunit/phpunit/src/TextUI/Application.php(132): PHPUnit\TextUI\Configuration\BootstrapLoader->handle(Object(PHPUnit\TextUI\Configuration\Configuration))
#9 /Users/kevin/Documents/sunlime/alfred/vendor/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run(Array)
#10 /Users/kevin/Documents/sunlime/alfred/vendor/bin/phpunit(122): include('/Users/kevin/Do...')
#11 {main}

but as you can see it does not contain anything related to what migration class is actually broken.

Would be nice if we can check that before loading that file and throw a better error which points the user to the right direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions