]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/include/generic/SugarWidgets/Bug44272Test.php
Release 6.3.0beta1
[Github/sugarcrm.git] / tests / include / generic / SugarWidgets / Bug44272Test.php
1 <?php
2
3 require_once('include/generic/SugarWidgets/SugarWidgetSubPanelTopButtonQuickCreate.php');
4 require_once('include/SubPanel/SubPanel.php');
5 require_once('include/SubPanel/SubPanelDefinitions.php');
6
7 class Bug44272Test extends PHPUnit_Framework_TestCase
8 {
9
10 var $account;
11         
12 public function setUp()
13 {
14     $beanList = array();
15     $beanFiles = array();
16     require('include/modules.php');
17     $GLOBALS['beanList'] = $beanList;
18     $GLOBALS['beanFiles'] = $beanFiles;
19     
20         $this->account = SugarTestAccountUtilities::createAccount();
21 }       
22
23 public function tearDown()
24 {
25         SugarTestAccountUtilities::removeAllCreatedAccounts();
26 }
27         
28 public function testSugarWidgetSubpanelTopButtonQuickCreate()
29 {
30         $defines = array();
31         $defines['focus'] = $this->account;
32         $defines['module'] = 'Accounts';
33         $defines['action'] = 'DetailView';
34
35         $subpanel_definitions = new SubPanelDefinitions(new Contact());
36         $contactSubpanelDef = $subpanel_definitions->load_subpanel('contacts');
37
38         $subpanel = new SubPanel('Accounts', $this->account->id, 'contacts', $contactSubpanelDef, 'Accounts');
39         $defines['subpanel_definition'] = $subpanel->subpanel_defs;
40         
41         $button = new SugarWidgetSubPanelTopButtonQuickCreate();
42         $code = $button->_get_form($defines);
43         $this->assertRegExp('/\<input[^\>]*?name=\"return_name\"/', $code, "Assert that the hidden input field return_name was created");
44 }
45         
46 }