phpunit - How to get record with same fixture in Yii unit test -



phpunit - How to get record with same fixture in Yii unit test -

its parent kid relation, in childgroup1, getting error during accessing 'parent_id' attribute. given error trying property of non-object.

i having access dynamically.

how parent_id in such case.

homecoming array( 'group1'=>array( 'id' => 1, 'name' => 'test', 'status' => 1, ), 'childgroup1'=>array( 'id' => 2, 'parent_id' => $this->getrecord('groups','group1')->id, 'name' => 'child test group1', 'status' => 1, ), );

since records not loaded yet, cannot utilize $this->getrecord() acquire record. such, utilize plain old array logic record's id.

$records = array(); $records['group1'] = array( 'id' => 1, 'name' => 'test', 'status' => 1, ); $records['childgroup1'] = array( 'id' => 2, 'parent_id' => $records['group1']['id'], 'name' => 'child test group1', 'status' => 1, ); homecoming $records;

if need records other fixtures, require them.

$groups = require __dir__.'/group.php';

this, of course, set @ top of files other groups.php, in order gain access groups models.

yii phpunit testcase

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -