Exemple #1
0
 public function test_sanitize_active_callback()
 {
     $this->assertEquals('__return_true', Kirki_Field::sanitize_active_callback(array('active_callback' => '__return_true')));
     $this->assertEquals('__return_true', Kirki_Field::sanitize_active_callback(array()));
     $this->assertEquals('kirki_active_callback', Kirki_Field::sanitize_active_callback(array('required' => array())));
 }
 /**
  * Test sanitize_active_callback edge cases
  */
 public function test_sanitize_active_callback()
 {
     $this->assertEquals('__return_false', Kirki_Field::sanitize_active_callback('', array('active_callback' => '__return_false')));
     $this->assertEquals('__return_true', Kirki_Field::sanitize_active_callback('', array('active_callback' => 'nonexistend_dummy_function_name')));
     $this->assertEquals('__return_false', Kirki_Field::sanitize_active_callback('', array('active_callback' => '__return_false', 'required' => array('foo' => 'bar'))));
     $this->assertEquals(array('Kirki_Active_Callback', 'evaluate'), Kirki_Field::sanitize_active_callback('', array('required' => array('foo' => 'bar'))));
 }