<commit_before><?php

define('PHPUnit_MAIN_METHOD', 'Plugins_Fusioninventory_InventoryLocal::main');
    
if (!defined('GLPI_ROOT')) {
   define('GLPI_ROOT', '../../../..');

   require_once GLPI_ROOT."/inc/includes.php";
   $_SESSION['glpi_use_mode'] = 2;
   $_SESSION['glpiactiveprofile']['id'] = 4;

   ini_set('display_errors','On');
   error_reporting(E_ALL | E_STRICT);
   set_error_handler("userErrorHandler");

   // Backup present DB
   include_once("inc/backup.php");
   backupMySQL();

   $_SESSION["glpilanguage"] = 'fr_FR';
   
   // Install
   include_once("inc/installation.php");
   installGLPI();
   installFusionPlugins();

   loadLanguage();

   $CFG_GLPI["root_doc"] = GLPI_ROOT;
}
require_once 'emulatoragent.php';

/**
 * Test class for MyFile.
 * Generated by PHPUnit on 2010-08-06 at 12:05:09.
 */
class Plugins_Fusioninventory_InventoryLocal extends PHPUnit_Framework_TestCase {

    public static function main() {
        require_once 'PHPUnit/TextUI/TestRunner.php';

        $suite  = new PHPUnit_Framework_TestSuite('Plugins_Fusioninventory_InventoryLocal');
        $result = PHPUnit_TextUI_TestRunner::run($suite);

    }


    public function testSetModuleInventoryOff() {
       global $DB,$LANG;
       loadLanguage();


         //deleteDir(GLPI_ROOT."/files/_plugins/fusioninventory/criterias");
         //deleteDir(GLPI_ROOT."/files/_plugins/fusioninventory/machines");
         system("rm -fr ".GLPI_ROOT."/files/_plugins/fusioninventory/criterias");
         system("rm -fr ".GLPI_ROOT."/files/_plugins/fusioninventory/machines");

        // set in config module inventory = yes by default
        $query = "UPDATE `glpi_plugin_fusioninventory_agentmodules`
           SET `is_active`='0'
           WHERE `modulename`='INVENTORY' ";
        $result = $DB->query($query);
       
    }


//    public function testSendinventoryOff() {
//       $this->testSendinventory();
//    }
//
//
//   public function testMachinesCriteriasFoldersOff() {
//      $exist = 0;
//      if (file_exists(GLPI_ROOT."/files/_plugins/fusioninventory/machines")) {
//         $exist = 1;
//      }<commit_msg>Update phpunit test<commit_after><?php

define('PHPUnit_MAIN_METHOD', 'Plugins_Fusioninventory_InventoryLocal::main');
    
if (!defined('GLPI_ROOT')) {
   define('GLPI_ROOT', '../../../..');

   require_once GLPI_ROOT."/inc/includes.php";
   $_SESSION['glpi_use_mode'] = 2;
   $_SESSION['glpiactiveprofile']['id'] = 4;

   ini_set('display_errors','On');
   error_reporting(E_ALL | E_STRICT);
   set_error_handler("userErrorHandler");

   // Backup present DB
   include_once("inc/backup.php");
   backupMySQL();

   $_SESSION["glpilanguage"] = 'fr_FR';
   
   // Install
   include_once("inc/installation.php");
   installGLPI();
   installFusionPlugins();

   loadLanguage();

   $CFG_GLPI["root_doc"] = GLPI_ROOT;
}
require_once 'emulatoragent.php';

/**
 * Test class for MyFile.
 * Generated by PHPUnit on 2010-08-06 at 12:05:09.
 */
class Plugins_Fusioninventory_InventoryLocal extends PHPUnit_Framework_TestCase {

    public static function main() {
        require_once 'PHPUnit/TextUI/TestRunner.php';

        $suite  = new PHPUnit_Framework_TestSuite('Plugins_Fusioninventory_InventoryLocal');
        $result = PHPUnit_TextUI_TestRunner::run($suite);

    }


    public function testSetModuleInventoryOff() {
       global $DB,$LANG;
       loadLanguage();


         //deleteDir(GLPI_ROOT."/files/_plugins/fusioninventory/criterias");
         //deleteDir(GLPI_ROOT."/files/_plugins/fusioninventory/machines");
         system("rm -fr ".GLPI_ROOT."/files/_plugins/fusioninventory/criterias");
         system("rm -fr ".GLPI_ROOT."/files/_plugins/fusioninventory/machines");


         // Modify criteria rules
         $rulecollection = new PluginFusinvinventoryRuleInventoryCollection();
         $query = "UPDATE `glpi_rules` SET `ranking` = '5'
            WHERE `sub_type` ='PluginFusinvinventoryRuleInventory'
               AND `ranking` = '4' ";
         $DB->query($query);

         $input = array();
         $input['is_active']=1;
         $input['name']='name';
         $input['match']='AND';
         $input['sub_type'] = 'PluginFusinvinventoryRuleInventory';
         $input['ranking'] = 4;
         $rule_id = $rulecollection->add($input);

         // Add criteria
         $rule = $rulecollection->getRuleClass();
         $rulecriteria = new RuleCriteria(get_class($rule));
         $input = array();
         $input['rules_id'] = $rule_id;
         $input['criteria'] = "globalcriteria";
         $input['pattern']= 9;
         $input['condition']=0;
         $rulecriteria->add($input);

         // Add action
         $ruleaction = new RuleAction(get_class($rule));
         $input = array();
         $input['rules_id'] = $rule_id;
         $input['action_type'] = 'assign';
         $input['field'] = '_import';
         $input['value'] = '1';
         $ruleaction->add($input);


        // set in config module inventory = yes by default
        $query = "UPDATE `glpi_plugin_fusioninventory_agentmodules`
           SET `is_active`='0'
           WHERE `modulename`='INVENTORY' ";
        $result = $DB->query($query);
       
    }


//    public function testSendinventoryOff() {
//       $this->testSendinventory();
//    }
//
//
//   public function testMachinesCriteriasFoldersOff() {
//      $exist = 0;
//      if (file_exists(GLPI_ROOT."/files/_plugins/fusioninventory/machines")) {
//         $exist = 1;
//      }
{'fraction_non_alphanumeric': 0.153720211024195, 'fraction_numerical': 0.008186283427323995, 'mean_word_length': 2.986947063089195, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4101566', 'n_tokens_mistral': 1820, 'n_tokens_neox': 1719, 'n_words': 269}