我在几个Cest文件中使用Laravel5模块进行了codeception测试。如果我运行所有的api测试,codecept run api。包含MyResource::withoutWrapping();的应用程序接口资源之后测试会影响其他Cest文件上的其他应用程序接口响应(它会从应用程序接口响应中删除“数据”包装)。有没有可能避免这种行为?我不想将withoutWrapping()应用于其他api资源,这是在...
# api.suite.yml
class_name: ApiTester
modules:
enabled:
- REST:
url: /api
depends: Laravel5
- \Helper\Api
- Asserts
- Laravel5:
environment_file: .env.testing// Controller Api endpoint
public function show(Event $event)
{
EventResource::withoutWrapping();
return new EventResource($event->load([
'eventRoomPrices', 'hotel.availableRoomCategories']));
}发布于 2019-10-01 18:02:16
您必须在该测试方法的末尾或在该Cest类的_after方法中调用与MyResource::withoutWrapping()相反的方法。
有没有MyResource::withWrapping()方法?
https://stackoverflow.com/questions/58181841
复制相似问题