Just in case, make sure Laravel's config cache is clear before running the tests.
php artisan config:clear
It can cause problems.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi folks,
I built a simple gitlab ci with the following docker container:
# Set the base image for subsequent instructions
FROM php:7.1
# Update packages
RUN apt-get update
# Install PHP and composer dependencies
RUN apt-get install git curl libmcrypt-dev libjpeg-dev libpng-dev libfreetype6-dev libbz2-dev -yqq
# Clear out the local repository of retrieved package files
RUN apt-get clean
# Install needed extensions
# Here you can install any other extension that you need during the test and deployment process
RUN docker-php-ext-install exif mcrypt pdo_mysql zip
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Install Laravel Envoy
RUN composer global require "laravel/envoy"
with this gitlab-ci.yml:
image: registry.gitlab.com/treenio/treenio:latest
stages:
- test
- deploy
cache:
paths:
- vendor/
before_script:
- cp .env.example .env
- composer install
phpcs:
stage: test
script:
- vendor/bin/phpcs
unit_test:
stage: test
script:
- php artisan key:generate
- vendor/bin/phpunit
When running the test locally everything works fine. As well with the docker container locally.
But in the Gitlab CI the ExampleTest fails with a 500 instead of a 200 status code. All other tests are green.
There was 1 failure:
1) Tests\Feature\ExampleTest::testBasicTest
Expected status code 200 but received 500.
Failed asserting that false is true.
/builds/treenio/treenio/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:77
/builds/treenio/treenio/tests/Feature/ExampleTest.php:25
FAILURES!
Tests: 5, Assertions: 7, Failures: 1.
ERROR: Job failed: exit code 1
Anyone any suggestions why the test fails in the CI ?
Thanks in advance bambamboole
After checking the logs on the CI server I realized I added the mix-manifest.json to my gitignore... That's why it worked locally but not on the CI server. My bad :)
Please or to participate in this conversation.