我正在与buddy.works进行项目的持续集成。问题是,我的phpunit测试通过了我的本地计算机,但在伙伴工作管道上却失败了。
我已经尝试使用谷歌搜索和阅读超过两天了,尽管我发现了许多类似的问题,但是我还没有遇到能使我朝正确方向发展的解决方案。
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);
}
测试失败,状态码为500,而不是401,我不知道是什么原因造成的。
编辑: Laravel 5.8.17是与之集成的php单元,可以正常运行,直到在伙伴作品上运行为止。
答案 0 :(得分:0)
在测试我的 laravel 8 api 时遇到了同样的问题。 我必须随请求一起发送标头。
<div>
<span class="entity">payment</span>
<span class="stage">Type Of Payment</span>
<span class="desc">Type</span>
<span class="control">type</span>
<span class="desc">Primary Customer</span>
<span class="control">customer</span>
<span class="id">ConditionBranchStep445</span>
<span class="desc">Leaseholder</span>
<span class="stageid">4decd3c7-4bd4-3149-428c-ab2613eac80a</span>
<span class="parentstage">87f11531-0493-4f5a-86d2-c8be0c23678f</span>
<span class="id">ConditionBranchStep447</span>
<span class="desc">General Payment</span>
<span class="entity">Vendor</span>
<span class="stage">Type Of Card</span>
<span class="desc">Type</span>
<span class="control">type</span>
<span class="desc">Secondary Customer</span>
<span class="control">customer</span>
<span class="id">ConditionBranchStep445</span>
<span class="desc">Leaseholder</span>
<span class="stageid">4decd3c7-4bd4-3149-428c-ab2613eac80a</span>
<span class="parentstage">87f11531-0493-4f5a-86d2-c8be0c23678f</span>
<span class="id">ConditionBranchStep447</span>
<span class="desc">General Payment</span>
</div>