使用phpunit测试时,未经授权的用户返回状态500而不是401

I'm working with buddy.works for continuous integration of my project. The issue is though, my phpunit tests pass on my local computer but fail on the buddy works pipeline.

I have tried googling and reading for over two days now and although I found many similar problems, I haven't encountered a solution that can even point me in the right direction.

    public function test_orders_route_unauthenticated_user () {

        $data = [
            'orderID'      => '001241',
            'sku'          => '123456',
            'quantity'     => 9,
            'pricePerUnit' => 78,
            'priceTotal'   => 702,
        ];

        $this->json('POST', 'api/orders', [$data])->assertStatus(401);

    }

The test fails with status code 500 instead of 401 and I don't know what is causing this.

Edit: Laravel 5.8.17, php unit which comes integrated with it, works as expected until being run on buddy works.