コード例 #1
0
ファイル: CaseTest.php プロジェクト: sacredwebsite/SuiteCRM
 public function testget_list_view_data()
 {
     $aCase = new aCase();
     $current_theme = SugarThemeRegistry::current();
     //test without setting attributes
     $expected = array('DELETED' => 0, 'STATE' => 'Open', 'UPDATE_TEXT' => '', 'NAME' => '<em>blank</em>', 'PRIORITY' => '', 'STATUS' => '', 'ENCODED_NAME' => null, 'CASE_NUMBER' => null, 'SET_COMPLETE' => '~' . preg_quote('<a href=\'index.php?return_module=Home&return_action=index&action=EditView&module=Cases&record=&status=Closed\'><img src="themes/' . $current_theme . '/images/close_inline.png?v=') . '[\\w-]+' . preg_quote('"    title=Close border=\'0\' alt="Close" /></a>') . '~');
     $actual = $aCase->get_list_view_data();
     //$this->assertSame($expected ,$actual);
     $this->assertEquals($expected['STATE'], $actual['STATE']);
     $this->assertEquals($expected['UPDATE_TEXT'], $actual['UPDATE_TEXT']);
     $this->assertEquals($expected['NAME'], $actual['NAME']);
     $this->assertEquals($expected['PRIORITY'], $actual['PRIORITY']);
     $this->assertRegExp($expected['SET_COMPLETE'], $actual['SET_COMPLETE']);
     //test with attributes preset
     $aCase->name = 'test';
     $aCase->priority = 'P1';
     $aCase->status = 'Open_New';
     $aCase->case_number = 1;
     $expected = array('NAME' => 'test', 'DELETED' => 0, 'CASE_NUMBER' => 1, 'STATUS' => 'New', 'PRIORITY' => 'High', 'STATE' => 'Open', 'UPDATE_TEXT' => '', 'ENCODED_NAME' => 'test', 'SET_COMPLETE' => '<a href=\'index.php?return_module=Home&return_action=index&action=EditView&module=Cases&record=&status=Closed\'><img src="themes/' . $current_theme . '/images/close_inline.png?v=fqXdFZ_r6FC1K7P_Fy3mVw"    title=Close border=\'0\' alt="Close" /></a>');
     $actual = $aCase->get_list_view_data();
     //$this->assertSame($expected ,$actual);
     $this->assertEquals($expected['NAME'], $actual['NAME']);
     $this->assertEquals($expected['CASE_NUMBER'], $actual['CASE_NUMBER']);
     $this->assertEquals($expected['STATUS'], $actual['STATUS']);
     $this->assertEquals($expected['PRIORITY'], $actual['PRIORITY']);
     $this->assertEquals($expected['STATE'], $actual['STATE']);
 }