Changeset 78 in tests for wp-testcase/test_filters.php
- Timestamp:
- 11/08/2007 01:26:12 AM (18 years ago)
- File:
-
- 1 edited
-
wp-testcase/test_filters.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-testcase/test_filters.php
r77 r78 4 4 5 5 class WPTestFilters extends WPTestCase { 6 var $_old_filters;7 8 function setUp() {9 $this->_old_filters = $GLOBALS['wp_filter'];10 unset($GLOBALS['merged_filters']);11 // this screws up filter priorities12 unset($GLOBALS['wp_filter']['all']);13 }14 15 function tearDown() {16 $GLOBALS['wp_filter'] = $this->_old_filters;17 }18 6 19 7 function test_simple_filter() { … … 144 132 $tag1 = rand_str(); 145 133 $tag2 = rand_str(); 134 $val = rand_str(); 146 135 147 136 // add an 'all' filter 148 add_filter('all', array(&$a, 'filter '));137 add_filter('all', array(&$a, 'filterall')); 149 138 // do some filters 150 139 $this->assertEquals($val, apply_filters($tag1, $val)); … … 158 147 $this->assertEquals(array($tag1, $tag2, $tag1, $tag1), $a->get_tags()); 159 148 149 remove_filter('all', array(&$a, 'filterall')); 150 160 151 } 161 152 … … 165 156 $val = rand_str(); 166 157 167 add_filter('all', array(&$a, 'filter '));168 $this->assertEquals($val, apply_filters($tag 1, $val));158 add_filter('all', array(&$a, 'filterall')); 159 $this->assertEquals($val, apply_filters($tag, $val)); 169 160 170 161 // make sure our hook was called correctly … … 173 164 174 165 // now remove the filter, do it again, and make sure it's not called this time 175 remove_filter('all', array(&$a, 'filter '));176 $this->assertEquals($val, apply_filters($tag 1, $val));166 remove_filter('all', array(&$a, 'filterall')); 167 $this->assertEquals($val, apply_filters($tag, $val)); 177 168 // call cound should remain at 1 178 169 $this->assertEquals(1, $a->get_call_count());
Note: See TracChangeset
for help on using the changeset viewer.