Dec 21, 2016
0
Level 5
PHPUnit give failure but testing success in Gitlab CI
Hi all,
This is my first time to use testing in my project. I use Gitlab CI and gitlab runner to perform test. But something weird happened, when phpunit executed the output is failure, but the test result in gitlab is passed. Gitlab should be show failed result.
I use lumen 5.1. And gitlab runner using docker
This is my .gitlab-ci.yml file
image: dragoncapital/comic:1.0.0
stages:
- test
cache:
paths:
- vendor/
before_script:
- bash .gitlab-ci.sh > /dev/null
test:7.0:
script:
- phpunit
This is my .gitlab-sh.sh file
#!/bin/bash
# We need to install dependencies only for Docker
[[ ! -e /.dockerenv ]] && exit 0
set -xe
composer install
cp .env.testing .env
# Generate an application key. Re-cache.
#php artisan key:generate
#php artisan config:cache
# Run database migrations.
#php artisan migrate
The log result
Running with gitlab-ci-multi-runner 1.8.1 (a2efdd4)
Using Docker executor with image dragoncapital/comic:1.0.0 ...
Using locally found image version with exactly the same ID
Pulling docker image dragoncapital/comic:1.0.0 ...
Running on runner-9f4a0555-project-83-concurrent-0 via gitrunner...
Fetching changes...
Removing vendor/
HEAD is now at 693d8d0 add package dcc/model to 1.0.*
From http://git.***.com/backend/api
693d8d0..c74899d feature/gitlab-ci -> origin/feature/gitlab-ci
Checking out c74899d2 as feature/gitlab-ci...
Checking cache for test:7.0/feature/gitlab-ci...
Successfully extracted cache
$ bash .gitlab-ci.sh > /dev/null
+ composer install
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
+ cp .env.testing .env
$ phpunit
PHPUnit 4.8.31 by Sebastian Bergmann and contributors.
................................................................. 65 / 70 ( 92%)
..FFF 70 / 70 (100%)
Time: 797 ms, Memory: 20.00MB
[Symfony\Component\Debug\Exception\FatalThrowableError]
Call to undefined method PHPUnit_Framework_TestResult::warningCount()
Creating cache test:7.0/feature/gitlab-ci...
Created cache
Build succeeded
The gitlab ci result is green (passed)
Please or to participate in this conversation.