oceanapplications / httpassertinsequence
断言请求在序列的特定索引位置发送
0.0.1
2020-07-27 23:27 UTC
This package is auto-updated.
Last update: 2024-08-29 05:53:19 UTC
README
composer require oceanapplications/httpassertinsequence
在 app/config 中添加或替换 http 别名为
'Http' => OceanApplications\HttpAssertInSequence\Http::class,
在所有文件中使用别名
use Http;
用法
与 assertSent 的工作方式相同,但允许您指定要检查的请求
Http::fake([
'*' => Http::sequence()
->push(['data' => [ [] ] ], 200) // get customer, none found
->push(['data' => ['id' => 1] ], 200) // create customer
]);
$response = $this->post('createOrUpdate', ['email' => 'test@example.com']);
Http::assertSentInSequence(function(Request $request) {
return $request['email'] == 'test@example.com';
}, 1);