我尝试了解如何在PHPUnit的laravel项目中使用Gitlab CI。正如在Laravel的documentation中所写,我已经添加了PHPUnit-bridge和composer require --dev symfony/phpunit-bridge
。
我的gilab-ci.yml
文件
image: php:7.2-cli
services:
- mysql:latest
cache:
paths:
- vendor/
stages:
- connect
- test
- deploy
variables:
# Configure mysql service (https://hub.docker.com/_/mysql/)
MYSQL_DATABASE: deshautsdebats
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: root
MYSQL_PASSWORD: root
before_script:
- apt-get update -yqq
- apt-get install git -yqq zlib1g-dev
# Install mysql driver
- docker-php-ext-install pdo_mysql zip
# Install composer
- curl -sS https://getcomposer.org/installer | php
# Install all project dependencies
- php composer.phar install
test:
stage: test
script:
- ls -lad bin/
- ./bin/phpunit
当我在本地输入./bin/phpunit
时它可以工作,但是如果它由CI制作,如果说:
/ bin / bash:第90行:./ bin / phpun:没有这样的文件或目录
我试图取代./bin/phpunit
by ./vendor/bin/phpunit
,但它会抛出同样的错误......你有什么想法吗?
谢谢,
我通过跟随those steps来解决这个问题