public function testGetFields() { $trackData = array('gr2t_id_respondent_track' => 1, 'gr2t_id_track' => 1); $respondentTrack = new \Gems_Tracker_RespondentTrack($trackData); $respondentTrack->answerRegistryRequest('tracker', $this->tracker); $date = new MUtil_Date('2010-10-08', 'yyyy-MM-dd'); $expected = array('f__1' => 'test', 'code' => 'test', 'f__2' => $date, 'datecode' => $date); $actual = $respondentTrack->getFieldData(); $this->assertArrayWithDateMatch($expected, $actual, '', 1, 0); }
/** * When only providing one or two fields, the others should not get nulled */ public function testSetFieldsPartial() { $trackData = array('gr2t_id_respondent_track' => 1, 'gr2t_id_track' => 1); $respondentTrack = new Gems_Tracker_RespondentTrack($trackData); $respondentTrack->answerRegistryRequest('tracker', $this->tracker); $expected = $respondentTrack->getFieldData(); $expected['f__1'] = $expected['code'] = 'newvalue'; $actual = $respondentTrack->setFieldData(array('code' => 'newvalue')); $this->assertArrayWithDateMatch($expected, $actual, '', 1, 0); }