mardi 1 octobre 2019

Codeception api test with Laravel5 module: withoutWrapping() applied on single JsonResource affects other tests

I have codeception api tests with Laravel5 module in several Cest files. If I run all api tests codecept run api. Test after api resource that contains MyResource::withoutWrapping(); affects other api responses on other Cest File (it removes 'data' wrapping from api response). Is it possible to avoid that behavior? I don't want to apply withoutWrapping() to other api resources, that follows after...

# 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']));
    }

Aucun commentaire:

Enregistrer un commentaire