当前位置: 首页>>代码示例>>PHP>>正文


PHP SavedSearch::retrieveSavedSearch方法代码示例

本文整理汇总了PHP中SavedSearch::retrieveSavedSearch方法的典型用法代码示例。如果您正苦于以下问题:PHP SavedSearch::retrieveSavedSearch方法的具体用法?PHP SavedSearch::retrieveSavedSearch怎么用?PHP SavedSearch::retrieveSavedSearch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SavedSearch的用法示例。


在下文中一共展示了SavedSearch::retrieveSavedSearch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleSaveAndRetrieveSavedSearch

 public function handleSaveAndRetrieveSavedSearch($id)
 {
     $savedSearch = new SavedSearch();
     $searchModuleBean = new Lead();
     $_REQUEST['search_module'] = 'Leads';
     $_REQUEST['description'] = 'test description';
     $_REQUEST['test_content'] = 'test text';
     $expected = array('search_module' => 'Leads', 'description' => 'test description', 'test_content' => 'test text', 'advanced' => true);
     //execute the method and then retrieve back to verify contents attribute
     $savedSearch->handleSave('', false, false, $id, $searchModuleBean);
     $savedSearch->retrieveSavedSearch($id);
     $this->assertSame($expected, $savedSearch->contents);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:13,代码来源:SavedSearchTest.php

示例2: testSaveDateFields

 /**
  * This test captures the scenario for date_modified field where range search is not enabled
  */
 public function testSaveDateFields()
 {
     require_once 'modules/SavedSearch/SavedSearch.php';
     $focus = new SavedSearch();
     $focus->retrieve($this->saved_search_id);
     $_REQUEST = unserialize(base64_decode($focus->contents));
     unset($_REQUEST['start_range_date_modified_advanced']);
     unset($_REQUEST['end_range_date_modified_advanced']);
     unset($_REQUEST['range_date_modified_advanced']);
     $_REQUEST['date_modified_advanced'] = '07/03/2009';
     //Special date :)
     $mockBean = new Bug42377MockOpportunity();
     $focus->handleSave('', false, '', $this->saved_search_id, $mockBean);
     //Now retrieve what we have saved and test
     $focus = new SavedSearch();
     $focus->retrieve($this->saved_search_id);
     $formatted_data = unserialize(base64_decode($focus->contents));
     $this->assertEquals($formatted_data['date_modified_advanced'], '2009-07-03', "Assert that value is in db format ('2009-07-03')");
     //Now test that when we populate the search form, we bring it back to user's date format
     $focus->retrieveSavedSearch($this->saved_search_id);
     $focus->populateRequest();
     $this->assertEquals($_REQUEST['date_modified_advanced'], '07/03/2009', "Assert that dates in db format were converted back to user's date preference");
     //Take this a step further, assume date format now changes, will date be populated correctly?
     global $current_user;
     $current_user->setPreference('datef', 'd/m/Y', 0, 'global');
     $current_user->save();
     //Now test that when we populate the search form, we bring it back to user's date format
     $focus->retrieveSavedSearch($this->saved_search_id);
     $focus->populateRequest();
     $this->assertEquals($_REQUEST['date_modified_advanced'], '03/07/2009', "Assert that dates in db format were converted back to user's date preference");
 }
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:34,代码来源:Bug42378Test.php

示例3: testSaveNumericFields

 public function testSaveNumericFields()
 {
     global $current_user;
     require_once 'modules/SavedSearch/SavedSearch.php';
     $focus = new SavedSearch();
     $focus->retrieve($this->saved_search_id);
     $_REQUEST = unserialize(base64_decode($focus->contents));
     $_REQUEST['start_range_amount_advanced'] = '$9,500.00';
     $_REQUEST['end_range_amount_advanced'] = '$49,500.00';
     $mockBean = new Bug42915MockOpportunity();
     $focus->handleSave('', false, '', $this->saved_search_id, $mockBean);
     //Now retrieve what we have saved and test
     $focus->retrieveSavedSearch($this->saved_search_id);
     $formatted_data = $focus->contents;
     $this->assertEquals(9500, $formatted_data['start_range_amount_advanced'], "Assert that value is unformatted value 9500");
     $this->assertEquals(49500, $formatted_data['end_range_amount_advanced'], "Assert that value is unformatted value 49500");
     $focus->populateRequest();
     $this->assertEquals('$9,500.00', $_REQUEST['start_range_amount_advanced'], "Assert that value is formatted value \$9,500.00");
     $this->assertEquals('$49,500.00', $_REQUEST['end_range_amount_advanced'], "Assert that value is formatted value \$49,500.00");
     $current_user->setPreference('num_grp_sep', '.');
     $current_user->setPreference('dec_sep', ',');
     $current_user->save();
     //Force reset on dec_sep and num_grp_sep because the dec_sep and num_grp_sep values are stored as static variables
     get_number_seperators(true);
     $focus = new SavedSearch();
     $focus->retrieveSavedSearch($this->saved_search_id);
     $focus->populateRequest();
     $this->assertEquals('$9.500,00', $_REQUEST['start_range_amount_advanced'], "Assert that value is formatted value \$9,500.00");
     $this->assertEquals('$49.500,00', $_REQUEST['end_range_amount_advanced'], "Assert that value is formatted value \$49,500.00");
     //Okay so now what happens if they don't specify currency or separator or decimal values?
     $_REQUEST['start_range_amount_advanced'] = '9500';
     $_REQUEST['end_range_amount_advanced'] = '49500';
     //Well then the populated values should be unformatted!
     $focus->handleSave('', false, '', $this->saved_search_id, $mockBean);
     $focus->retrieveSavedSearch($this->saved_search_id);
     $focus->populateRequest();
     $this->assertEquals(9500, $_REQUEST['start_range_amount_advanced'], "Assert that value is unformatted value 9500");
     $this->assertEquals(49500, $_REQUEST['end_range_amount_advanced'], "Assert that value is unformatted value 49500");
 }
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:39,代码来源:Bug42915Test.php


注:本文中的SavedSearch::retrieveSavedSearch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。