Codeception sendPOST not working with Slim 3 getParam

207 Views Asked by At

Relatively new to Codeception and trying to hook it up to Slim 3. Setting up a basic test for a POST request like so:

$I->sendPOST('/user', [
        'details' => [
            'id' => 0,
            'package_id' => 0,
            'order_id' => 0
        ]
    ]);

On the route itself, I am using Slim 3's getParam to get the details that I sent over like so:

$details = $request->getParam('details', []);

Running the test via --debug, I see that the Request has {"details":{"package_id":0,"order_id":0}

However, it seems as if the details from the getParam are returning nothing. I've tried sending them separately outside of details but to no avail.

At this point, wondering if it's a PSR-7 compatibility issue between the details I send via Codeception's sendPOST and Slim 3's getParam since the getParam method from Slim came with the comments:

 * Fetch request parameter value from body or query string (in that order).
 *
 * Note: This method is not part of the PSR-7 standard.

Any help is appreciated!

0

There are 0 best solutions below