在我的Laravel项目中更新了Composer之后,我的所有测试都失败了.我的Laravel版本是9.24.0

我在高山Linux映像(php:8.1-fpm-alpine)上的Docker容器中使用PHPUnit测试.

pdo_sqlitesqlite3 php模块都被启用和加载(php -m说).

当我运行docker-compose run --rm phpunit时,我得到的所有测试结果如下:

Domain\Customer\Tests\Address\AddressModelTest::myTestName
Illuminate\Database\QueryException: SQLSTATE[HY000]:
General error: 1 near "0": syntax error (SQL: CREATE TABLE ...

/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:759
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:719
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:545
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php:109
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php:394
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php:241
/var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:338
/var/www/html/database/migrations/2021_11_17_154600_alter_table_modify_content_column_type.php:18
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:482
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:400
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:409
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:210
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php:36
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:740
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:210
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:175
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:118
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:87
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:616
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:99
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php:41
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:651
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php:139
/var/www/html/vendor/symfony/console/Command/Command.php:308
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php:124
/var/www/html/vendor/symfony/console/Application.php:998
/var/www/html/vendor/symfony/console/Application.php:299
/var/www/html/vendor/symfony/console/Application.php:171
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/Application.php:102
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/Application.php:194
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:263
/var/www/html/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:286
/var/www/html/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:465
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php:80
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php:47
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php:22
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:123
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:92
/var/www/html/tests/MultitenancyTestCase.php:34

Caused by
PDOException: SQLSTATE[HY000]: General error: 1 near "0": syntax error

/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:538
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:752
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:719
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:545
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php:109
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php:394
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Schema/Builder.php:241
/var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:338
/var/www/html/database/migrations/2021_11_17_154600_alter_table_modify_content_column_type.php:18
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:482
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:400
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:409
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:210
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php:36
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:740
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:210
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:175
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:118
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:87
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:616
/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php:99
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php:41
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:37
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:651
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php:139
/var/www/html/vendor/symfony/console/Command/Command.php:308
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php:124
/var/www/html/vendor/symfony/console/Application.php:998
/var/www/html/vendor/symfony/console/Application.php:299
/var/www/html/vendor/symfony/console/Application.php:171
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/Application.php:102
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/Application.php:194
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:263
/var/www/html/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:286
/var/www/html/vendor/laravel/framework/src/Illuminate/Testing/PendingCommand.php:465
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php:80
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php:47
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php:22
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:123
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:92
/var/www/html/tests/MultitenancyTestCase.php:34

UPDATE:

2021_11_17_154600_alter_table_modify_content_column_type.php文件的内容为:

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('menu_contents', function (Blueprint $table) {
            $table->mediumText('content')->change();
        }); # this is the 18. line

我试着调低laravel/framework:9.3.0分,但没用.

你知道我怎么才能解决这个问题吗?

推荐答案

请看这里查看最近的学说/dbal https://github.com/doctrine/dbal/issues/5584回滚到3.3.7解决了我的问题.

Laravel相关问答推荐

Laravel Livewire与自定义JS有关的多姆问题

Laravel带S3存储器

在GitHub操作中缺少PHPStan和PHPMD输出,但在本地存在

到查询构建器的MySQL查询

为什么命令php artisan serve不起作用

如何在 Laravel 中使用内存数据库的完整测试套件之前迁移和 seeder ?

Laravel 5.4 - 如何为同一个自定义验证规则使用多个错误消息

如何在 laravel 5.2 中显示 500 内部服务器错误页面?

未找到 PHP 5.4 和 Laravel 类Memcached

Twilio 查找 API 不起作用?

如何在新安装时指定 Lumen(或 Laravel)版本?

在 Laravel 5.4 中将中间件应用于除 `setup/*` 之外的所有路由

Database[] 未配置 Laravel 5

Laravel Eloquent:计算总价的最佳方法

如何使用中间件将标头添加到响应中?

Laravel Eloquent 在子查询中有两个WHERE NOT IN

Laravel - 更新时禁用更新时间

如何在 laravel 中使用 GROUP_CONCAT

在 Laravel 中按用户名查找用户

如何在 Laravel 中 Refresh刷新用户对象?