439 |
$f->__destruct(); |
$f->__destruct(); |
440 |
} |
} |
441 |
|
|
442 |
|
/** |
443 |
|
* TNR de la methode factorisé de création de dossier_message |
444 |
|
*/ |
445 |
|
function test_06_TNR_dossier_message() { |
446 |
|
// Instanciation de tout les requis |
447 |
|
require_once "../obj/utils.class.php"; |
448 |
|
@session_start(); |
449 |
|
$_SESSION['collectivite'] = 2; |
450 |
|
$_SESSION['login'] = "admin"; |
451 |
|
$_SERVER['REQUEST_URI'] = ""; |
452 |
|
$f = new utils("nohtml"); |
453 |
|
$f->disableLog(); |
454 |
|
$GLOBALS["f"] = $f; |
455 |
|
require_once "../obj/dossier_message.class.php"; |
456 |
|
$dossier_message_factory = new dossier_message(0, $f->db, 0); |
457 |
|
$dossier_message_val = array(); |
458 |
|
|
459 |
|
$dossier_message_val['contenu'] = 'Test Success'; |
460 |
|
$dossier_message_val['dossier'] = 'AT0130551200001P0'; |
461 |
|
$dossier_message_val['type'] = _('Ajout de pièce(s)'); |
462 |
|
$dossier_message_val['emetteur'] = 'instr'; |
463 |
|
$dossier_message_val['login'] = 'instr'; |
464 |
|
$dossier_message_val['date_emission'] = date('Y-m-d H:i:s'); |
465 |
|
$add = $dossier_message_factory->add_notification_message($dossier_message_val); |
466 |
|
$this->assertEquals(true, $add); |
467 |
|
$this->assertEquals(true, isset($dossier_message_factory->valF[$dossier_message_factory->clePrimaire])); |
468 |
|
$dossier_message = new dossier_message($dossier_message_factory->valF[$dossier_message_factory->clePrimaire], $f->db, 0); |
469 |
|
$this->assertEquals($dossier_message_val['dossier'], $dossier_message->getVal('dossier')); |
470 |
|
$this->assertEquals('t', $dossier_message->getVal('lu')); |
471 |
|
|
472 |
|
$dossier_message_val['contenu'] = 'Test Duplicata'; |
473 |
|
$add = $dossier_message_factory->add_notification_message($dossier_message_val); |
474 |
|
$this->assertEquals(true, $add); |
475 |
|
|
476 |
|
$dossier_message_val['contenu'] = 'Test nouveau type même dossier'; |
477 |
|
$dossier_message_val['type'] = _('Autorisation contestée'); |
478 |
|
$add = $dossier_message_factory->add_notification_message($dossier_message_val); |
479 |
|
$this->assertEquals(true, $add); |
480 |
|
|
481 |
|
$dossier_message_val['contenu'] = 'Test message non lu'; |
482 |
|
$dossier_message_val['dossier'] = 'AZ0130551200001P0'; |
483 |
|
$dossier_message_val['emetteur'] = $f->get_connected_user_login_name(); |
484 |
|
$dossier_message_val['login'] = $_SESSION['login']; |
485 |
|
$add = $dossier_message_factory->add_notification_message($dossier_message_val); |
486 |
|
$this->assertEquals(true, $add); |
487 |
|
$dossier_message = new dossier_message($dossier_message_factory->valF[$dossier_message_factory->clePrimaire], $f->db, 0); |
488 |
|
$this->assertEquals('f', $dossier_message->getVal('lu')); |
489 |
|
|
490 |
|
// Destruction de la classe Utils |
491 |
|
$f->__destruct(); |
492 |
|
} |
493 |
|
|
494 |
|
|
495 |
} |
} |
496 |
|
|