Yii

Yii 2 Codeception Fixtures Gotcha

We use MongoDB (important point) with our Yii 2 applicaton. While setting up our API test fixtures in our Cest file, $I->grabFixture was not able to find the data we wanted eventhough we have defined it within the dataFile. [yii\base\ErrorException] Trying to get property 'client_id' of non-object Here’s what the dataFile looks like. <?php // This doesn't work. return [ 'client_one' => [ 'client_id' => 'mytestclient', ], ]; After some experimentation, we’ve found that we need to set the _id within the dataFile in order to get $I->grabFixture to work properly. ...

<span title='2021-07-17 13:00:00.017 +0800 +0800'>July 17, 2021</span>