/** * @covers Acc_Account::check * @todo Implement testCheck(). */ public function testCheck() { $value = $this->object->check('pcm_val'); $this->assertTrue($value); $value = $this->object->check('pcm_lib'); $this->assertTrue($value); $value = $this->object->check('pcm_val_parent'); $this->assertTrue($value); $value = $this->object->check('pcm_type', 'CHA'); $this->assertTrue($value); $this->setExpectedException("Exception"); $value = $this->object->check('unknown'); }
//---------------------------------------------------------------------- $message = _("opération réussie"); if ($action == "update" && $acc_delete == 0) { // Check if the data are correct try { $p_val = trim($p_valu); $p_lib = trim($p_libu); $p_parent = trim($p_parentu); $old_line = trim($p_oldu); $p_type = htmlentities($p_typeu); $acc = new Acc_Account($cn); $acc->set_parameter('libelle', $p_lib); $acc->set_parameter('value', $p_val); $acc->set_parameter('parent', $p_parent); $acc->set_parameter('type', $p_type); $acc->check(); } catch (Exception $e) { $message = _("Valeurs invalides, pas de changement") . " \n " . $e->getMessage(); $ctl = 'nok'; } if (strlen($p_val) != 0 && strlen($p_lib) != 0 && strlen($old_line) != 0) { if (strlen($p_val) == 1) { $p_parent = 0; } else { if (strlen($p_parent) == 0) { $p_parent = substr($p_val, 0, strlen($p_val) - 1); } } /* Parent existe */ $Ret = $cn->exec_sql("select pcm_val from tmp_pcmn where pcm_val=\$1", array($p_parent)); if ($p_parent != 0 && Database::num_row($Ret) == 0 || $p_parent == $old_line) {