/** * testMultipleBelongsToWithSameClass method * * @return void */ public function testMultipleBelongsToWithSameClass() { $this->loadFixtures('DeviceType', 'DeviceTypeCategory', 'FeatureSet', 'ExteriorTypeCategory', 'Document', 'Device', 'DocumentDirectory'); $DeviceType = new DeviceType(); $DeviceType->recursive = 2; $result = $DeviceType->read(null, 1); $expected = array('DeviceType' => array('id' => 1, 'device_type_category_id' => 1, 'feature_set_id' => 1, 'exterior_type_category_id' => 1, 'image_id' => 1, 'extra1_id' => 1, 'extra2_id' => 1, 'name' => 'DeviceType 1', 'order' => 0), 'Image' => array('id' => 1, 'document_directory_id' => 1, 'name' => 'Document 1', 'DocumentDirectory' => array('id' => 1, 'name' => 'DocumentDirectory 1')), 'Extra1' => array('id' => 1, 'document_directory_id' => 1, 'name' => 'Document 1', 'DocumentDirectory' => array('id' => 1, 'name' => 'DocumentDirectory 1')), 'Extra2' => array('id' => 1, 'document_directory_id' => 1, 'name' => 'Document 1', 'DocumentDirectory' => array('id' => 1, 'name' => 'DocumentDirectory 1')), 'DeviceTypeCategory' => array('id' => 1, 'name' => 'DeviceTypeCategory 1'), 'FeatureSet' => array('id' => 1, 'name' => 'FeatureSet 1'), 'ExteriorTypeCategory' => array('id' => 1, 'image_id' => 1, 'name' => 'ExteriorTypeCategory 1', 'Image' => array('id' => 1, 'device_type_id' => 1, 'name' => 'Device 1', 'typ' => 1)), 'Device' => array(array('id' => 1, 'device_type_id' => 1, 'name' => 'Device 1', 'typ' => 1), array('id' => 2, 'device_type_id' => 1, 'name' => 'Device 2', 'typ' => 1), array('id' => 3, 'device_type_id' => 1, 'name' => 'Device 3', 'typ' => 2))); $this->assertEquals($expected, $result); }