![](/img/trans.png)
[英]Gitlab CI -Laravel 5.5 - PHPUnit “Tests\TestCase not found”
[英]How should I have outpout from errors in PHPUNIT with Gitlab CI
我正在嘗試從 Gitlab CI 運行 phpunit。
在本地,我可以運行它,當測試失敗時我會顯示錯誤。
但是在 Gitlab CI 中,我有:
$ ./vendor/phpunit/phpunit/phpunit --verbose
PHPUnit 9.5.3 by Sebastian Bergmann and contributors.
Runtime: PHP 8.0.3
Configuration: /builds/project-0/phpunit.xml
..EESSEEEEEEEEEEEEEEESSSSSSSSSSSESSSSSSEEEESSSSSEEEEEEESSSSSEEE 63 / 190 ( 33%)
E.Etesting that url:/nova-api/individual-reports has responde code:200
Etesting that url:/nova-api/individual-reports has responde code:200
Etesting that url:/nova-api/individual-reports has responde code:200
EEtesting that url:/nova-api/individual-reports has responde code:200
Etesting that url:/nova-api/individual-reports has responde code:200
EEEEEEEEEEEEEEEEEEEEEEESEEEEEEEEEERROR: Job failed: exit code 1
FATAL: exit code 1
這是我的.gitlab-ci.yml
image: php:8.0
cache:
paths:
- vendor/
variables:
APP_ENV: "local"
APP_NAME: "APP_NAME"
DB_CONNECTION: "sqlite"
before_script:
# Install git, the php image doesn't have installed
- apt-get update -yqq
- apt-get install git libmagickwand-dev libzip-dev -yqq
# Install Xdebug & imagick
- pecl install xdebug
- git clone https://github.com/Imagick/imagick
- cd imagick && phpize
- ./configure
- make
- make install
- cd ${CI_PROJECT_DIR} # Change it to variable
- cp .env.example .env
- docker-php-ext-configure gd --with-freetype --with-jpeg
- docker-php-ext-enable xdebug imagick
- docker-php-ext-install pcntl exif gd zip
# Install composer
- curl -sS https://getcomposer.org/installer | php
# Install all project dependencies
- php composer.phar config http-basic.nova.laravel.com ${NOVA_USERNAME} ${NOVA_PASSWORD} && php composer.phar install
- php artisan key:generate
- touch ${CI_PROJECT_DIR}/database/database.sqlite
- php artisan migrate --database=sqlite
# Run our tests
test:
script:
- ./vendor/phpunit/phpunit/phpunit --verbose
artifacts:
paths:
- ./storage/logs # for debugging
expire_in: 7 days
when: always
我應該如何查看我的錯誤的詳細信息?
我用 --testdox 運行了 phpunit:
- ./vendor/phpunit/phpunit/phpunit --testdox
現在,我有關於測試成功或錯誤的詳細信息:
✔ Component can be retrieved with correct resource elements
✘ Operation is required on create
│
│ Expected status code 500 but received 419.
│ Failed asserting that 500 is identical to 419.
│
│ /builds/project-0/vendor/laravel/framework/src/Illuminate/Testing/TestResponse.php:187
│ /builds/project-0/tests/Feature/UserInvoiceData/UserInvoiceDataResourceTest.php:154
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.