我问题,我现在面临一个非常奇怪的问题 .
我的所有单元测试都在本地成功,但是当我用CI运行它们时,其中一些测试失败 .

一个例子:

[2018-12-09 18:05:57] testing.ERROR: Trying to get property 'email' of non-object {"userId":834,"email":"hugh.will@example.org","exception":"[object] (ErrorException(code: 0): Trying to get property 'email' of non-object at /builds/.../laravel/framework/src/Illuminate/Mail/Mailable.php:492)

嗯..我知道这个错误意味着什么,但是当测试在本地成功时,调试极其困难,我不知道从哪里开始 .

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: 本地我可以使用断点和其他工具轻松调试我的测试 .
使用CI,我可以在本地发生,所以我真的不知道从哪里开始 .
错误说我正在尝试访问非对象的属性(在本例中为json) . 似乎在某个地方解析json失败了,但是Mailable是一个Laravel组件应该(并且确实)工作 .
如何调试仅在Gitlab CI上失败的测试?
使用CI测试Laravel应用程序时是否可能需要记住一些事项?