Как предотвратить падение PHPUnit в GitLab CI от ошибки типа Warning, прилетающей из bootstrap-точки файла Wordpress-ядра?
Содержимое
Содержимое запускаемого stage (
Что реально получаю на пайплайне:
Что получаю в докер-контейнере при локальном запуске тестов:
Не понимаю, как предотвратить падение тестов от независящей от код-базы ошибки (даже не ошибки, а Warning'а)
phpunit.xml
:<?xml version="1.0" encoding="UTF-8"?><phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" colors="true" bootstrap="wp-load.php" convertWarningsToExceptions="false" convertNoticesToExceptions="false"> <testsuites> <testsuite name="All Tests from ./tests/"> <directory>./tests</directory> </testsuite> </testsuites> <coverage> <include> <directory suffix=".php">./wp-content/themes/FOO/BAR/</directory> </include> <report> <html outputDirectory="./tests/report"/> </report> </coverage></phpunit>
Содержимое запускаемого stage (
test.yml
):.test: stage: test only: [ branches ] interruptible: truevariables: MYSQL_HOST: mysql MYSQL_ROOT_PASSWORD: &mysql-root-password root_password MYSQL_DATABASE: &mysql-db db_name MYSQL_USER: &mysql-user db_user MYSQL_PASSWORD: &mysql-password db_password.inside-app-image: # Job template: use application image for commands execution variables: APP_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-branch # eg.: `registry.gitlab.com/group/repository:foo-branch WORDPRESS_DB_HOST: 'mysql:3306' WORDPRESS_DB_NAME: *mysql-db WORDPRESS_DB_USER: *mysql-user WORDPRESS_DB_PASSWORD: *mysql-password DB_NAME: *mysql-db DB_USER: *mysql-user DB_PASSWORD: *mysql-password image: name: "$APP_IMAGE" entrypoint: [ '' ] before_script: - cd /usr/src/wordpress # change working directory (path defined in Dockerfile)# Run PHPUnit testsphpunit: extends: [ .test, .inside-app-image ] services: - mysql:8.0 script: - sleep 10 - composer install - composer phpunit
Что реально получаю на пайплайне:
> @php ./vendor/bin/phpunit --no-coverage --color=always[03-Mar-2023 13:13:58 UTC] PHP Warning: Undefined array key "HTTP_HOST" in /usr/src/wordpress/wp-includes/functions.php on line 6065Cleaning up project directory and file based variables00:00Job succeeded
Что получаю в докер-контейнере при локальном запуске тестов:
> @php ./vendor/bin/phpunit --no-coverage --color=alwaysPHPUnit 9.5.27 by Sebastian Bergmann and contributors.................................................................. 65 / 96 ( 67%)............................... 96 / 96 (100%)Time: 00:00.017, Memory: 64.50 MBOK (96 tests, 102 assertions)
Не понимаю, как предотвратить падение тестов от независящей от код-базы ошибки (даже не ошибки, а Warning'а)

Смотрите также:
В комментариях запрещаются спам, а также реклама любых товаров и услуг, иных ресурсов.