$this->contact->table_name, 'input_name0' => array(), 'name' => 'contacts', 'rname' => 'last_name', ); $html = $this->getSugarWidgetFieldRelate()->displayInput($layoutDef); $regExpPattern =$this->getAssertRegExp($this->contact->id, "{$this->contact->last_name}"); $this->assertRegExp($regExpPattern, $html); } public function testFirstLastName() { $layoutDef = array( 'table' => $this->contact->table_name, 'input_name0' => array(), 'name' => 'contacts', 'rname' => 'last_name', 'db_concat_fields' => array('first_name', 'last_name'), ); $html = $this->getSugarWidgetFieldRelate()->displayInput($layoutDef); $regExpPattern = $this->getAssertRegExp( $this->contact->id, "{$this->contact->first_name}\s+{$this->contact->last_name}" ); $this->assertRegExp($regExpPattern, $html); } private function getAssertRegExp($value, $text) { $pattern = '/\' . $text . '\<\/option\>/i'; return $pattern; } private function getSugarWidgetFieldRelate() { $LayoutManager = new LayoutManager(); $temp = (object)array('db' => $GLOBALS['db'], 'report_def_str' => ''); $LayoutManager->setAttributePtr('reporter', $temp); $Widget = new SugarWidgetFieldRelate($LayoutManager); return $Widget; } public function setUp() { SugarTestHelper::setUp('current_user'); $this->contact = SugarTestContactUtilities::createContact(); } public function tearDown() { SugarTestContactUtilities::removeAllCreatedContacts(); SugarTestHelper::tearDown(); } }