Changeset 38762 for trunk/tests/phpunit/tests/filters.php
- Timestamp:
- 10/09/2016 01:11:14 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/filters.php
r38571 r38762 10 10 function test_simple_filter() { 11 11 $a = new MockAction(); 12 $tag = rand_str();13 $val = rand_str();12 $tag = __FUNCTION__; 13 $val = __FUNCTION__ . '_val'; 14 14 15 15 add_filter($tag, array($a, 'filter')); … … 28 28 function test_remove_filter() { 29 29 $a = new MockAction(); 30 $tag = rand_str();31 $val = rand_str();30 $tag = __FUNCTION__; 31 $val = __FUNCTION__ . '_val'; 32 32 33 33 add_filter($tag, array($a, 'filter')); … … 47 47 48 48 function test_has_filter() { 49 $tag = rand_str();50 $func = rand_str();49 $tag = __FUNCTION__; 50 $func = __FUNCTION__ . '_func'; 51 51 52 52 $this->assertFalse( has_filter($tag, $func) ); … … 64 64 $a1 = new MockAction(); 65 65 $a2 = new MockAction(); 66 $tag = rand_str();67 $val = rand_str();66 $tag = __FUNCTION__; 67 $val = __FUNCTION__ . '_val'; 68 68 69 69 // add both filters to the hook … … 80 80 function test_filter_args_1() { 81 81 $a = new MockAction(); 82 $tag = rand_str();83 $val = rand_str();84 $arg1 = rand_str();82 $tag = __FUNCTION__; 83 $val = __FUNCTION__ . '_val'; 84 $arg1 = __FUNCTION__ . '_arg1'; 85 85 86 86 add_filter($tag, array($a, 'filter'), 10, 2); … … 96 96 $a1 = new MockAction(); 97 97 $a2 = new MockAction(); 98 $tag = rand_str();99 $val = rand_str();100 $arg1 = rand_str();101 $arg2 = rand_str();98 $tag = __FUNCTION__; 99 $val = __FUNCTION__ . '_val'; 100 $arg1 = __FUNCTION__ . '_arg1'; 101 $arg2 = __FUNCTION__ . '_arg2'; 102 102 103 103 // a1 accepts two arguments, a2 doesn't … … 120 120 function test_filter_priority() { 121 121 $a = new MockAction(); 122 $tag = rand_str();123 $val = rand_str();122 $tag = __FUNCTION__; 123 $val = __FUNCTION__ . '_val'; 124 124 125 125 // make two filters with different priorities … … 151 151 function test_all_filter() { 152 152 $a = new MockAction(); 153 $tag1 = rand_str();154 $tag2 = rand_str();155 $val = rand_str();153 $tag1 = __FUNCTION__ . '_1'; 154 $tag2 = __FUNCTION__ . '_2'; 155 $val = __FUNCTION__ . '_val'; 156 156 157 157 // add an 'all' filter … … 175 175 function test_remove_all_filter() { 176 176 $a = new MockAction(); 177 $tag = rand_str();178 $val = rand_str();177 $tag = __FUNCTION__; 178 $val = __FUNCTION__ . '_val'; 179 179 180 180 add_filter('all', array($a, 'filterall')); … … 202 202 function test_remove_all_filters_should_respect_the_priority_argument() { 203 203 $a = new MockAction(); 204 $tag = rand_str();205 $val = rand_str();204 $tag = __FUNCTION__; 205 $val = __FUNCTION__ . '_val'; 206 206 207 207 add_filter( $tag, array( $a, 'filter' ), 12 ); … … 222 222 $obj = new stdClass(); 223 223 $a = new MockAction(); 224 $tag = rand_str();224 $tag = __FUNCTION__; 225 225 226 226 add_action($tag, array($a, 'filter')); … … 242 242 $a = new MockAction(); 243 243 $b = new MockAction(); 244 $tag = rand_str();244 $tag = __FUNCTION__; 245 245 246 246 add_action($tag, array($a, 'filter_append'), 10, 2); … … 275 275 function test_has_filter_after_remove_all_filters() { 276 276 $a = new MockAction(); 277 $tag = rand_str();278 $val = rand_str();277 $tag = __FUNCTION__; 278 $val = __FUNCTION__ . '_val'; 279 279 280 280 // No priority
Note: See TracChangeset
for help on using the changeset viewer.