clean_session();
}
/**
* Test avec une chaîne simple sans modification attendue
*/
function test_clean_break__simple_string() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = "hello";
$expected = "hello";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test du trim des espaces en début de chaîne
*/
function test_clean_break__whitespace_leading() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = " hello";
$expected = "hello";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test du trim des espaces en fin de chaîne
*/
function test_clean_break__whitespace_trailing() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = "hello ";
$expected = "hello";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test du trim des espaces en début et fin de chaîne
*/
function test_clean_break__whitespace_both() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = " hello ";
$expected = "hello";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$input = "\n\t hello \r\n";
$expected = "hello";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$input = "\n\t \r\n";
$expected = "";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test de la protection XSS avec une balise script
*/
function test_clean_break__xss_script() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = "";
$expected = "alert('xss')";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test de la protection XSS avec une balise HTML simple
*/
function test_clean_break__xss_tag() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = "bold";
$expected = "bold";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test de la protection XSS avec une balise img malveillante
*/
function test_clean_break__xss_img() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = "
";
$expected = "";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test avec une valeur numérique entière
*/
function test_clean_break__numeric_int() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = "123";
$expected = "123";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test avec une valeur numérique décimale
*/
function test_clean_break__numeric_float() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = "123.45";
$expected = "123.45";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test avec une valeur numérique négative
*/
function test_clean_break__numeric_negative() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = "-42";
$expected = "-42";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test avec une chaîne vide
*/
function test_clean_break__empty_string() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = "";
$expected = "";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test avec des caractères spéciaux (email)
*/
function test_clean_break__special_chars_email() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = "test@example.com";
$expected = "test@example.com";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test avec des guillemets simples et doubles
*/
function test_clean_break__special_quotes() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = "It's a \"test\"";
$expected = "It's a "test"";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test avec l'esperluette (&)
*/
function test_clean_break__special_ampersand() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = "a & b";
$expected = "a & b";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test avec un tableau simple
*/
function test_clean_break__array_simple() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = array("one", "two", "three");
$expected = array("one", "two", "three");
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test avec un tableau contenant des espaces
*/
function test_clean_break__array_whitespace() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = array(" one ", " two ");
$expected = array("one", "two");
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test avec un tableau imbriqué
*/
function test_clean_break__array_nested() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = array(
"level1" => array(
"level2" => " nested value "
)
);
$expected = array(
"level1" => array(
"level2" => "nested value"
)
);
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test avec un tableau contenant du XSS
*/
function test_clean_break__array_xss() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = array("bold", "");
$expected = array("bold", "x");
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
/**
* Test avec un tableau contenant du XSS
*/
function test_clean_break__accents() {
$f = $this->get_inst_om_application();
$f->disableLog();
$input = "éàçè";
$expected = "éàçè";
$result = $f->clean_break($input);
$this->assertEquals($expected, $result);
$f->__destruct();
}
}