Ejemplo n.º 1
0
 /**
  * initialize a validation hook based on a field name
  */
 public function validation_init($field)
 {
     $method = 'validate_' . $field;
     if (method_exists($this, $method)) {
         $action = $this->{$field}->clean_class() . '_' . $method;
         \PSU::add_action($action, array($this, $method));
     }
     //end if
 }
Ejemplo n.º 2
0
 function testActions()
 {
     global $psu_actiontest_1;
     $psu_actiontest_1 = null;
     PSU::add_action('testAction_1', array($this, 'action1'));
     PSU::do_action('testAction_1');
     $this->assertEquals($psu_actiontest_1, 'psu_actiontest_1', 'Action via object method');
     global $psu_actiontest_2;
     $psu_actiontest_2 = null;
     PSU::add_action('testAction_2', 'global_action');
     PSU::do_action('testAction_2');
     $this->assertEquals($psu_actiontest_2, 'psu_actiontest_2', 'Action via object method');
 }