I'm just starting with Gitlab CI (using a docker executor). After facing and solving some beginner's issues, I'm now facing a pretty strange problem.
All my unit tests succeed locally but when I run them with CI some of them fail.
One example:
[2018-12-09 18:05:57] testing.ERROR: Trying to get property 'email' of non-object {"userId":834,"email":"[email protected]","exception":"[object] (ErrorException(code: 0): Trying to get property 'email' of non-object at /builds/.../laravel/framework/src/Illuminate/Mail/Mailable.php:492)
Well.. I know what this error means but as the test succeeds locally it's extreme hard to debug and I don't know where to start.
Here is the test_job part of my .yml file:
test_job:
stage: test
services:
- mysql:5.7
- redis:latest
artifacts:
when: always
paths:
- storage/logs/
dependencies:
- build_job
script:
- sh .gitlab-test.sh
tags:
- docker
Just to be sure - my test.sh
#!/bin/sh
set -xe
php -v
ping -c 3 mysql
php artisan migrate
php artisan db:seed --class=TestingSeeder
php vendor/bin/phpunit --coverage-text --colors
My question:
It seems that somewhere the parsing of the json fails, but Mailable is a Laravel component which should (and indeed does) work.
Is there any known issue with Laravel 5.5 and Gitlab CI?
How can I debug a test which fails only on Gitlab CI?
Are there maybe some things to remember when testing a Laravel app using CI?
The reason was a faulty configuration.
It turned out, that most of the tests which failed were testing some mail related stuff. I forgot to add my smtp credentials.
Instead of complaining about missing/wrong credentials, it returned this strange absolutely not related error message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With