Changeset 43571 for trunk/tests/phpunit/tests/functions/listFilter.php
- Timestamp:
- 08/17/2018 01:50:26 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/functions/listFilter.php
r42527 r43571 43 43 function test_filter_object_list_and() { 44 44 $list = wp_filter_object_list( 45 $this->object_list, array( 45 $this->object_list, 46 array( 46 47 'field1' => true, 47 48 'field2' => true, 48 ), 'AND' 49 ), 50 'AND' 49 51 ); 50 52 $this->assertEquals( 2, count( $list ) ); … … 55 57 function test_filter_object_list_or() { 56 58 $list = wp_filter_object_list( 57 $this->object_list, array( 59 $this->object_list, 60 array( 58 61 'field1' => true, 59 62 'field2' => true, 60 ), 'OR' 63 ), 64 'OR' 61 65 ); 62 66 $this->assertEquals( 3, count( $list ) ); … … 68 72 function test_filter_object_list_not() { 69 73 $list = wp_filter_object_list( 70 $this->object_list, array( 71 'field2' => true, 72 'field3' => true, 73 ), 'NOT' 74 $this->object_list, 75 array( 76 'field2' => true, 77 'field3' => true, 78 ), 79 'NOT' 74 80 ); 75 81 $this->assertEquals( 1, count( $list ) ); … … 79 85 function test_filter_object_list_and_field() { 80 86 $list = wp_filter_object_list( 81 $this->object_list, array( 87 $this->object_list, 88 array( 82 89 'field1' => true, 83 90 'field2' => true, 84 ), 'AND', 'name' 91 ), 92 'AND', 93 'name' 85 94 ); 86 95 $this->assertEquals( … … 88 97 'foo' => 'foo', 89 98 'bar' => 'bar', 90 ), $list 99 ), 100 $list 91 101 ); 92 102 } … … 94 104 function test_filter_object_list_or_field() { 95 105 $list = wp_filter_object_list( 96 $this->object_list, array( 97 'field2' => true, 98 'field3' => true, 99 ), 'OR', 'name' 106 $this->object_list, 107 array( 108 'field2' => true, 109 'field3' => true, 110 ), 111 'OR', 112 'name' 100 113 ); 101 114 $this->assertEquals( … … 103 116 'foo' => 'foo', 104 117 'bar' => 'bar', 105 ), $list 118 ), 119 $list 106 120 ); 107 121 } … … 109 123 function test_filter_object_list_not_field() { 110 124 $list = wp_filter_object_list( 111 $this->object_list, array( 112 'field2' => true, 113 'field3' => true, 114 ), 'NOT', 'name' 125 $this->object_list, 126 array( 127 'field2' => true, 128 'field3' => true, 129 ), 130 'NOT', 131 'name' 115 132 ); 116 133 $this->assertEquals( array( 'baz' => 'baz' ), $list ); … … 124 141 'bar' => 'bar', 125 142 'baz' => 'baz', 126 ), $list 143 ), 144 $list 127 145 ); 128 146 … … 133 151 'bar' => 'bar', 134 152 'baz' => 'baz', 135 ), $list 153 ), 154 $list 136 155 ); 137 156 } … … 147 166 'b' => 'bar', 148 167 'z' => 'baz', 149 ), $list 168 ), 169 $list 150 170 ); 151 171 } … … 161 181 'b' => 'bar', 162 182 'z' => 'baz', 163 ), $list 183 ), 184 $list 164 185 ); 165 186 } … … 175 196 1 => 'bar', 176 197 2 => 'baz', 177 ), $list 198 ), 199 $list 178 200 ); 179 201 } … … 191 213 0 => 'bar', 192 214 'z' => 'baz', 193 ), $list 215 ), 216 $list 194 217 ); 195 218 } … … 207 230 'b' => 'bar', 208 231 'z' => 'baz', 209 ), $list 232 ), 233 $list 210 234 ); 211 235 } … … 276 300 function test_filter_object_list_nested_array_or() { 277 301 $list = wp_filter_object_list( 278 $this->object_list, array( 302 $this->object_list, 303 array( 279 304 'field3' => true, 280 305 'field4' => array( 'blue' ), 281 ), 'OR' 306 ), 307 'OR' 282 308 ); 283 309 $this->assertEquals( 2, count( $list ) ); … … 304 330 'foo' => 'foo', 305 331 'baz' => 'baz', 306 ), $list 332 ), 333 $list 307 334 ); 308 335 } … … 310 337 function test_filter_object_list_nested_array_or_field() { 311 338 $list = wp_filter_object_list( 312 $this->object_list, array( 339 $this->object_list, 340 array( 313 341 'field3' => true, 314 342 'field4' => array( 'blue' ), 315 ), 'OR', 'name' 343 ), 344 'OR', 345 'name' 316 346 ); 317 347 $this->assertEquals( … … 319 349 'foo' => 'foo', 320 350 'baz' => 'baz', 321 ), $list 351 ), 352 $list 322 353 ); 323 354 }
Note: See TracChangeset
for help on using the changeset viewer.