public function testget_list_view_data() { $call = new Call(); $current_theme = SugarThemeRegistry::current(); $call->assigned_user_id = 1; $call->created_by = 1; $call->modified_user_id = 1; //execute the method and verify that it retunrs expected results $expected = array('MODIFIED_USER_ID' => 1, 'CREATED_BY' => 1, 'DELETED' => 0, 'ASSIGNED_USER_ID' => 1, 'STATUS' => 'Planned', 'REMINDER_TIME' => '-1', 'EMAIL_REMINDER_TIME' => '-1', 'EMAIL_REMINDER_SENT' => '0', 'REPEAT_INTERVAL' => '1', 'SET_COMPLETE' => '~' . preg_quote('<a id=\'\' onclick=\'SUGAR.util.closeActivityPanel.show("Calls","","Held","listview","1");\'><img src="themes/' . $current_theme . '/images/close_inline.png?v=') . '[\\w-]+' . preg_quote('" border=\'0\' alt="Close" /></a>') . '~', 'DATE_START' => '<font class=\'overdueTask\'></font>', 'CONTACT_ID' => null, 'CONTACT_NAME' => null, 'PARENT_NAME' => '', 'REMINDER_CHECKED' => false, 'EMAIL_REMINDER_CHECKED' => false); $actual = $call->get_list_view_data(); foreach ($expected as $expectedKey => $expectedVal) { if ($expectedKey == 'SET_COMPLETE') { $this->assertRegExp($expected[$expectedKey], $actual[$expectedKey]); } else { $this->assertSame($expected[$expectedKey], $actual[$expectedKey]); } } $this->assertEquals('Administrator', $call->assigned_user_name); $this->assertEquals('Administrator', $call->created_by_name); $this->assertEquals('Administrator', $call->modified_by_name); }