亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Symfony 和 PHPUnit 與 Bitbucket 管道

Symfony 和 PHPUnit 與 Bitbucket 管道

PHP
元芳怎么了 2021-10-15 16:08:03
我正在嘗試建立一個管道以使用 Bitbucket 自動執行我的測試套件。不幸的是,我對 Docker 和管道完全陌生。我讀了這篇文章,經過大量的試驗和錯誤,我想出了這個bitbucket-pipelines.yml配置:image: php:7.2.17pipelines:  default:    - step:        caches:          - composer        script:          - apt-get update && apt-get install -y unzip zlib1g-dev sqlite3 libsqlite3-dev          - docker-php-ext-install zip && docker-php-ext-install pdo_sqlite && docker-php-ext-install pdo_mysql          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer          - composer install          - vendor/bin/simple-phpunit問題是這個配置還是報錯:  [RuntimeException]                                                                 An error occurred when executing the "'cache:clear --no-warmup'" command:          In ConnectionFactory.php line 79:                                                    An exception occured while establishing a connection to figure out your pla        tform version.                                                                     You can circumvent this by setting a 'server_version' configuration value          For further information have a look at:                                            https://github.com/doctrine/DoctrineBundle/issues/673                            In AbstractMySQLDriver.php line 93:                                                  An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused       In PDOConnection.php line 31:                                                        SQLSTATE[HY000] [2002] Connection refused                                        In PDOConnection.php line 27:                                                        SQLSTATE[HY000] [2002] Connection refused 為什么要嘗試使用 MySQL 進行連接?它不應該只執行測試嗎?我不需要運行的項目或可部署的版本,我只需要使用 SQLite 和單元測試執行的測試套件。
查看完整描述

2 回答

?
不負相思意

TA貢獻1777條經驗 獲得超10個贊

Doctrine 嘗試猜測您的 MySQL/PostgreSQL 版本。因此,它會在創建適配器時嘗試建立與數據庫的連接。


可以通過在配置中配置具體版本來規避此行為。


# config.yaml


doctrine:

  dbal:

    # [..]

    server_version: '5.7' # or mariadb-<version> for MariaDB

您可以在文檔章節Doctrine DBAL Configuration的配置概述下方的通知中找到有關此“問題”的更多信息。


只需添加server_version到config_test.yaml即可解決您的問題。


查看完整回答
反對 回復 2021-10-15
  • 2 回答
  • 0 關注
  • 336 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號