------------------------------------------------------------------------

  @package   FusionInventory
  @author    David Durieux
  @co-author
  @copyright Copyright (c) 2010-2014 FusionInventory team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      http://www.fusioninventory.org/
  @link      http://forge.fusioninventory.org/projects/fusioninventory-for-glpi/
  @since     2014

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
$pfEntity = new PluginFusioninventoryEntity();
if (isset($_POST["add"])) {
    $pfEntity->add($_POST);
    Html::back();
} else {
    if (isset($_POST["update"])) {
        $pfEntity->update($_POST);
        Html::back();
    } else {
        if (isset($_REQUEST["purge"])) {
            $pfEntity->delete($_POST);
            Html::back();
        }
    }
}
 /**
  * @test
  */
 public function getCollectURLRootEntity()
 {
     global $DB;
     $DB->connect();
     $_SESSION['glpiactive_entity'] = 0;
     $_SESSION["plugin_fusioninventory_entity"] = 0;
     $_SESSION["glpiname"] = 'Plugin_FusionInventory';
     $entities_id = 1;
     $agents_id = 1;
     $config = new PluginFusioninventoryConfig();
     $config->loadCache();
     $pfEntity = new PluginFusioninventoryEntity();
     $pfEntity->delete(array('id' => 2));
     // Get answer
     $input = array('action' => 'getConfig', 'task' => array('COLLECT' => '1.0.0'), 'machineid' => 'toto-device');
     $response = PluginFusioninventoryCommunicationRest::communicate($input);
     $this->assertEquals('http://127.0.0.1/glpi085/plugins/fusioninventory/b/collect/', $response['schedule'][0]['remote'], 'Wrong URL');
 }