299 |
$f->__destruct(); |
$f->__destruct(); |
300 |
} |
} |
301 |
|
|
302 |
|
/** |
303 |
|
* Vérification de la méthode permettant de formater le corps du courriel |
304 |
|
* notifié aux communes. |
305 |
|
*/ |
306 |
|
function test_03_instruction_formater_modele() { |
307 |
|
// Instance de la classe Utils |
308 |
|
require_once "../obj/utils.class.php"; |
309 |
|
@session_start(); |
310 |
|
$_SESSION['collectivite'] = 1; |
311 |
|
$_SESSION['login'] = "admin"; |
312 |
|
$_SERVER['REQUEST_URI'] = ""; |
313 |
|
$f = new utils("nohtml"); |
314 |
|
$f->disableLog(); |
315 |
|
$GLOBALS["f"] = $f; |
316 |
|
// template du modèle |
317 |
|
$template = 'DI : <DOSSIER_INSTRUCTION> |
318 |
|
LIEN : <URL_INSTRUCTION> |
319 |
|
INSTRUCTION : <ID_INSTRUCTION>'; |
320 |
|
// résultat attendu |
321 |
|
$di = 'PC01'; |
322 |
|
$inst = 7; |
323 |
|
$url = 'http://localhost/openads/spg/direct_link.php?obj=dossier_instruction&action=3'; |
324 |
|
$url .= '&direct_field=dossier&direct_form=instruction&direct_action=3&direct_idx='.$inst; |
325 |
|
$link = '<a href="'.$url.'">'.$url.'</a>'; |
326 |
|
$expected = 'DI : '.$di.'<br/>'; |
327 |
|
$expected .= 'LIEN : '.$link.'<br/>'; |
328 |
|
$expected .= 'INSTRUCTION : '.$inst; |
329 |
|
// Instance de la classe instruction |
330 |
|
require_once "../obj/instruction.class.php"; |
331 |
|
$instr = new instruction(']', $f->db, DEBUG); |
332 |
|
// Traitement |
333 |
|
$result = $instr->formater_modele($template, $di, $inst); |
334 |
|
// Vérification du traitement |
335 |
|
$this->assertEquals($expected, $result); |
336 |
|
// Destruction de la classe Utils |
337 |
|
$f->__destruct(); |
338 |
|
} |
339 |
} |
} |
340 |
|
|
341 |
?> |
?> |