Changeset 70 in tests
- Timestamp:
- 11/02/2007 06:29:57 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wp-testlib/utils.php
r58 r70 24 24 class MockAction { 25 25 var $events; 26 27 function MockAction() { 26 var $debug; 27 28 function MockAction($debug=0) { 28 29 $this->reset(); 30 $this->debug = $debug; 29 31 } 30 32 … … 32 34 $this->events = array(); 33 35 } 36 37 function current_filter() { 38 if (is_callable('current_filter')) 39 return current_filter(); 40 global $wp_actions; 41 return end($wp_actions); 42 } 34 43 35 44 function action($arg) { 36 global $wp_current_action; 37 38 $args = func_get_args(); 39 $this->events[] = array('action' => __FUNCTION__, 'tag'=>$wp_current_action, 'args'=>$args); 45 if ($this->debug) dmp(__FUNCTION__, $this->current_filter()); 46 $args = func_get_args(); 47 $this->events[] = array('action' => __FUNCTION__, 'tag'=>$this->current_filter(), 'args'=>$args); 40 48 return $arg; 41 49 } 42 50 43 51 function action2($arg) { 44 global $wp_current_action;45 46 $args = func_get_args(); 47 $this->events[] = array('action' => __FUNCTION__, 'tag'=>$ wp_current_action, 'args'=>$args);52 if ($this->debug) dmp(__FUNCTION__, $this->current_filter()); 53 54 $args = func_get_args(); 55 $this->events[] = array('action' => __FUNCTION__, 'tag'=>$this->current_filter(), 'args'=>$args); 48 56 return $arg; 49 57 } 50 58 51 59 function filter($arg) { 52 global $wp_current_filter;53 54 $args = func_get_args(); 55 $this->events[] = array('filter' => __FUNCTION__, 'tag'=>$ wp_current_filter, 'args'=>$args);60 if ($this->debug) dmp(__FUNCTION__, $this->current_filter()); 61 62 $args = func_get_args(); 63 $this->events[] = array('filter' => __FUNCTION__, 'tag'=>$this->current_filter(), 'args'=>$args); 56 64 return $arg; 57 65 } 58 66 59 67 function filter2($arg) { 60 global $wp_current_filter;61 62 $args = func_get_args(); 63 $this->events[] = array('filter' => __FUNCTION__, 'tag'=>$ wp_current_filter, 'args'=>$args);68 if ($this->debug) dmp(__FUNCTION__, $this->current_filter()); 69 70 $args = func_get_args(); 71 $this->events[] = array('filter' => __FUNCTION__, 'tag'=>$this->current_filter(), 'args'=>$args); 64 72 return $arg; 65 73 }
Note: See TracChangeset
for help on using the changeset viewer.