setUp() public méthode

public setUp ( )
Exemple #1
0
 public function setUp()
 {
     parent::setUp();
     //If somehow this package already exists copy it
     if (file_exists('custom/modules/' . $this->package)) {
         $this->packageExists = true;
         mkdir_recursive('custom/modules/' . $this->package . '_bak');
         copy_recursive('custom/modules/' . $this->package, 'custom/modules/' . $this->package . '_bak');
     }
     //Make the custom package directory and simulate copying the file in
     mkdir_recursive('custom/modules/' . $this->package . '/Ext/WirelessLayoutdefs');
     $theArray = array($this->package => array('subpanel_setup' => array($this->package . '_accounts' => array('order' => 100, 'module' => 'Contacts', 'subpanel_name' => 'default', 'title_key' => 'LBL_BUG48784TEST', 'get_subpanel_data' => 'Bug48748Test'))));
     $theFile = 'custom/modules/' . $this->package . '/Ext/WirelessLayoutdefs/wireless.subpaneldefs.ext.php';
     write_array_to_file('layout_defs', $theArray, $theFile);
     sugar_chmod('custom/modules/' . $this->package . '/Ext/WirelessLayoutdefs/wireless.subpaneldefs.ext.php', 0655);
     global $beanList, $beanFiles, $current_user;
     //$beanList['Contacts'] = 'Contact';
     //$beanFiles['Bug48784Mock'] = 'modules/Contacts/Contact.php';
     //Create an anonymous user for login purposes/
     $current_user = SugarTestUserUtilities::createAnonymousUser();
     $current_user->status = 'Active';
     $current_user->is_admin = 1;
     $current_user->save();
     $GLOBALS['db']->commit();
     // Making sure we commit any changes before continuing
     $_SESSION['avail_modules'][$this->package] = 'write';
 }
 public function setUp()
 {
     parent::setUp();
     // do this so if there was an error that prevented clean up in the last test run we can still test again.
     $this->cleanUpTestUser();
     $this->createTestUser();
     $this->client = new Client(Yii::app()->params['pas_api_test_base_url'] . $this->base_url_stub, array(Client::REQUEST_OPTIONS => array('auth' => array($this->user->username, $this->user_password), 'headers' => array('Accept' => 'application/xml'))));
 }
Exemple #3
0
 public function setUp()
 {
     global $current_user;
     parent::setUp();
     //Create an anonymous user for login purposes/
     $current_user = SugarTestUserUtilities::createAnonymousUser();
     $current_user->status = 'Active';
     $current_user->is_admin = 1;
     $current_user->save();
     $GLOBALS['db']->commit();
     // Making sure we commit any changes before continuing
 }
    public function setUp()
    {
        parent::setUp();
        //If somehow this package already exists copy it
        if (file_exists('custom/modules/' . $this->package)) {
            $this->packageExists = true;
            mkdir_recursive('custom/modules/' . $this->package . '_bak');
            copy_recursive('custom/modules/' . $this->package, 'custom/modules/' . $this->package . '_bak');
        }
        //Make the custom package directory and simulate copying the file in
        mkdir_recursive('custom/modules/' . $this->package . '/Ext/WirelessLayoutdefs');
        if ($fh = @fopen('custom/modules/' . $this->package . '/Ext/WirelessLayoutdefs/wireless.subpaneldefs.ext.php', 'w+')) {
            $string = <<<EOQ
<?php
\$layout_defs["{$this->package}"]["subpanel_setup"]['{$this->package}_accounts'] = array (
  'order' => 100,
  'module' => 'Contacts',
  'subpanel_name' => 'default',
  'title_key' => 'LBL_BUG48784TEST',
  'get_subpanel_data' => 'Bug48748Test',
);

?>
EOQ;
            fputs($fh, $string);
            fclose($fh);
        }
        global $beanList, $beanFiles, $current_user;
        //$beanList['Contacts'] = 'Contact';
        //$beanFiles['Bug48784Mock'] = 'modules/Contacts/Contact.php';
        //Create an anonymous user for login purposes/
        $current_user = SugarTestUserUtilities::createAnonymousUser();
        $current_user->status = 'Active';
        $current_user->is_admin = 1;
        $current_user->save();
        $GLOBALS['db']->commit();
        // Making sure we commit any changes before continuing
        $_SESSION['avail_modules'][$this->package] = 'write';
        $this->useOutputBuffering = false;
    }