Changeset 51666 for trunk/tests/phpunit/tests/functions/wpListFilter.php
- Timestamp:
- 08/26/2021 04:20:57 PM (3 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/functions/wpListFilter.php
r51664 r51666 2 2 3 3 /** 4 * Test wp_list_filter(). 5 * 4 6 * @group functions.php 7 * @covers ::wp_list_filter 5 8 */ 6 class Tests_Functions_wpListUtil extends WP_UnitTestCase { 7 8 public function data_test_wp_list_filter() { 9 return array( 10 'string instead of array' => array( 11 'foo', 12 array(), 13 'AND', 14 array(), 15 ), 16 'object instead of array' => array( 17 (object) array( 'foo' ), 18 array(), 19 'AND', 20 array(), 21 ), 22 'empty args' => array( 23 array( 'foo', 'bar' ), 24 array(), 25 'AND', 26 array( 'foo', 'bar' ), 27 ), 28 'invalid operator' => array( 29 array( 30 (object) array( 'foo' => 'bar' ), 31 (object) array( 'foo' => 'baz' ), 32 ), 33 array( 'foo' => 'bar' ), 34 'XOR', 35 array(), 36 ), 37 'single argument to match' => array( 38 array( 39 (object) array( 40 'foo' => 'bar', 41 'bar' => 'baz', 42 'abc' => 'xyz', 43 'key' => 'foo', 44 ), 45 (object) array( 46 'foo' => 'foo', 47 '123' => '456', 48 'lorem' => 'ipsum', 49 'key' => 'bar', 50 ), 51 (object) array( 52 'foo' => 'baz', 53 'key' => 'value', 54 ), 55 (object) array( 56 'foo' => 'bar', 57 'key' => 'value', 58 ), 59 ), 60 array( 'foo' => 'bar' ), 61 'AND', 62 array( 63 0 => (object) array( 64 'foo' => 'bar', 65 'bar' => 'baz', 66 'abc' => 'xyz', 67 'key' => 'foo', 68 ), 69 3 => (object) array( 70 'foo' => 'bar', 71 'key' => 'value', 72 ), 73 ), 74 ), 75 'all must match' => array( 76 array( 77 (object) array( 78 'foo' => 'bar', 79 'bar' => 'baz', 80 'abc' => 'xyz', 81 'key' => 'foo', 82 ), 83 (object) array( 84 'foo' => 'foo', 85 '123' => '456', 86 'lorem' => 'ipsum', 87 'key' => 'bar', 88 ), 89 (object) array( 90 'foo' => 'baz', 91 'key' => 'value', 92 'bar' => 'baz', 93 ), 94 (object) array( 95 'foo' => 'bar', 96 'key' => 'value', 97 ), 98 ), 99 array( 100 'foo' => 'bar', 101 'bar' => 'baz', 102 ), 103 'AND', 104 array( 105 0 => (object) array( 106 'foo' => 'bar', 107 'bar' => 'baz', 108 'abc' => 'xyz', 109 'key' => 'foo', 110 ), 111 ), 112 ), 113 'any must match' => array( 114 array( 115 (object) array( 116 'foo' => 'bar', 117 'bar' => 'baz', 118 'abc' => 'xyz', 119 'key' => 'foo', 120 ), 121 (object) array( 122 'foo' => 'foo', 123 '123' => '456', 124 'lorem' => 'ipsum', 125 'key' => 'bar', 126 ), 127 (object) array( 128 'foo' => 'baz', 129 'key' => 'value', 130 'bar' => 'baz', 131 ), 132 (object) array( 133 'foo' => 'bar', 134 'key' => 'value', 135 ), 136 ), 137 array( 138 'key' => 'value', 139 'bar' => 'baz', 140 ), 141 'OR', 142 array( 143 0 => (object) array( 144 'foo' => 'bar', 145 'bar' => 'baz', 146 'abc' => 'xyz', 147 'key' => 'foo', 148 ), 149 2 => (object) array( 150 'foo' => 'baz', 151 'key' => 'value', 152 'bar' => 'baz', 153 ), 154 3 => (object) array( 155 'foo' => 'bar', 156 'key' => 'value', 157 ), 158 ), 159 ), 160 'none must match' => array( 161 array( 162 (object) array( 163 'foo' => 'bar', 164 'bar' => 'baz', 165 'abc' => 'xyz', 166 'key' => 'foo', 167 ), 168 (object) array( 169 'foo' => 'foo', 170 '123' => '456', 171 'lorem' => 'ipsum', 172 'key' => 'bar', 173 ), 174 (object) array( 175 'foo' => 'baz', 176 'key' => 'value', 177 ), 178 (object) array( 179 'foo' => 'bar', 180 'key' => 'value', 181 ), 182 ), 183 array( 184 'key' => 'value', 185 'bar' => 'baz', 186 ), 187 'NOT', 188 array( 189 1 => (object) array( 190 'foo' => 'foo', 191 '123' => '456', 192 'lorem' => 'ipsum', 193 'key' => 'bar', 194 ), 195 ), 196 ), 197 ); 198 } 9 class Tests_Functions_wpListFilter extends WP_UnitTestCase { 199 10 200 11 /** 201 12 * @dataProvider data_test_wp_list_filter 202 *203 * @covers ::wp_list_filter204 13 * 205 14 * @param array $list An array of objects to filter. … … 213 22 } 214 23 215 public function data_test_wp_list_ sort() {24 public function data_test_wp_list_filter() { 216 25 return array( 217 'single orderby ascending' => array( 218 array( 219 array( 220 'foo' => 'bar', 221 'bar' => 'baz', 222 'key' => 'foo', 223 ), 224 array( 225 'foo' => 'foo', 226 'lorem' => 'ipsum', 227 'key' => 'bar', 228 ), 229 array( 230 'foo' => 'baz', 231 'key' => 'value', 232 ), 233 ), 26 'string instead of array' => array( 234 27 'foo', 235 'ASC', 236 array( 237 array( 238 'foo' => 'bar', 239 'bar' => 'baz', 240 'key' => 'foo', 241 ), 242 array( 243 'foo' => 'baz', 244 'key' => 'value', 245 ), 246 array( 247 'foo' => 'foo', 248 'lorem' => 'ipsum', 249 'key' => 'bar', 250 ), 251 ), 252 ), 253 'single orderby descending' => array( 254 array( 255 array( 256 'foo' => 'bar', 257 'bar' => 'baz', 258 'key' => 'foo', 259 ), 260 array( 261 'foo' => 'foo', 262 'lorem' => 'ipsum', 263 'key' => 'bar', 264 ), 265 array( 266 'foo' => 'baz', 267 'key' => 'value', 268 ), 269 ), 270 'foo', 271 'DESC', 272 array( 273 array( 274 'foo' => 'foo', 275 'lorem' => 'ipsum', 276 'key' => 'bar', 277 ), 278 array( 279 'foo' => 'baz', 280 'key' => 'value', 281 ), 282 array( 283 'foo' => 'bar', 284 'bar' => 'baz', 285 'key' => 'foo', 286 ), 287 ), 288 ), 289 'single orderby array ascending' => array( 290 array( 291 array( 292 'foo' => 'bar', 293 'bar' => 'baz', 294 'key' => 'foo', 295 ), 296 array( 297 'foo' => 'foo', 298 'lorem' => 'ipsum', 299 'key' => 'bar', 300 ), 301 array( 302 'foo' => 'baz', 303 'key' => 'value', 304 ), 305 ), 306 array( 'foo' => 'ASC' ), 307 'IGNORED', 308 array( 309 array( 310 'foo' => 'bar', 311 'bar' => 'baz', 312 'key' => 'foo', 313 ), 314 array( 315 'foo' => 'baz', 316 'key' => 'value', 317 ), 318 array( 319 'foo' => 'foo', 320 'lorem' => 'ipsum', 321 'key' => 'bar', 322 ), 323 ), 324 ), 325 'single orderby array descending' => array( 326 array( 327 array( 328 'foo' => 'bar', 329 'bar' => 'baz', 330 'key' => 'foo', 331 ), 332 array( 333 'foo' => 'foo', 334 'lorem' => 'ipsum', 335 'key' => 'bar', 336 ), 337 array( 338 'foo' => 'baz', 339 'key' => 'value', 340 ), 341 ), 342 array( 'foo' => 'DESC' ), 343 'IGNORED', 344 array( 345 array( 346 'foo' => 'foo', 347 'lorem' => 'ipsum', 348 'key' => 'bar', 349 ), 350 array( 351 'foo' => 'baz', 352 'key' => 'value', 353 ), 354 array( 355 'foo' => 'bar', 356 'bar' => 'baz', 357 'key' => 'foo', 358 ), 359 ), 360 ), 361 'multiple orderby ascending' => array( 362 array( 363 array( 364 'foo' => 'bar', 365 'bar' => 'baz', 366 'key' => 'foo', 367 ), 368 array( 369 'foo' => 'foo', 370 'lorem' => 'ipsum', 371 'key' => 'bar', 372 ), 373 array( 374 'foo' => 'foo', 375 'key' => 'key', 376 ), 377 array( 378 'foo' => 'baz', 379 'key' => 'key', 380 ), 381 array( 382 'foo' => 'bar', 383 'key' => 'value', 384 ), 385 ), 386 array( 387 'key' => 'ASC', 388 'foo' => 'ASC', 389 ), 390 'IGNORED', 391 array( 392 array( 393 'foo' => 'foo', 394 'lorem' => 'ipsum', 395 'key' => 'bar', 396 ), 397 array( 398 'foo' => 'bar', 399 'bar' => 'baz', 400 'key' => 'foo', 401 ), 402 array( 403 'foo' => 'baz', 404 'key' => 'key', 405 ), 406 array( 407 'foo' => 'foo', 408 'key' => 'key', 409 ), 410 array( 411 'foo' => 'bar', 412 'key' => 'value', 413 ), 414 ), 415 ), 416 'multiple orderby descending' => array( 417 array( 418 array( 419 'foo' => 'bar', 420 'bar' => 'baz', 421 'key' => 'foo', 422 ), 423 array( 424 'foo' => 'foo', 425 'lorem' => 'ipsum', 426 'key' => 'bar', 427 ), 428 array( 429 'foo' => 'foo', 430 'key' => 'key', 431 ), 432 array( 433 'foo' => 'baz', 434 'key' => 'key', 435 ), 436 array( 437 'foo' => 'bar', 438 'key' => 'value', 439 ), 440 ), 441 array( 442 'key' => 'DESC', 443 'foo' => 'DESC', 444 ), 445 'IGNORED', 446 array( 447 array( 448 'foo' => 'bar', 449 'key' => 'value', 450 ), 451 array( 452 'foo' => 'foo', 453 'key' => 'key', 454 ), 455 array( 456 'foo' => 'baz', 457 'key' => 'key', 458 ), 459 array( 460 'foo' => 'bar', 461 'bar' => 'baz', 462 'key' => 'foo', 463 ), 464 array( 465 'foo' => 'foo', 466 'lorem' => 'ipsum', 467 'key' => 'bar', 468 ), 469 ), 470 ), 471 'multiple orderby mixed' => array( 472 array( 473 array( 474 'foo' => 'bar', 475 'bar' => 'baz', 476 'key' => 'foo', 477 ), 478 array( 479 'foo' => 'foo', 480 'lorem' => 'ipsum', 481 'key' => 'bar', 482 ), 483 array( 484 'foo' => 'foo', 485 'key' => 'key', 486 ), 487 array( 488 'foo' => 'baz', 489 'key' => 'key', 490 ), 491 array( 492 'foo' => 'bar', 493 'key' => 'value', 494 ), 495 ), 496 array( 497 'key' => 'DESC', 498 'foo' => 'ASC', 499 ), 500 'IGNORED', 501 array( 502 array( 503 'foo' => 'bar', 504 'key' => 'value', 505 ), 506 array( 507 'foo' => 'baz', 508 'key' => 'key', 509 ), 510 array( 511 'foo' => 'foo', 512 'key' => 'key', 513 ), 514 array( 515 'foo' => 'bar', 516 'bar' => 'baz', 517 'key' => 'foo', 518 ), 519 array( 520 'foo' => 'foo', 28 array(), 29 'AND', 30 array(), 31 ), 32 'object instead of array' => array( 33 (object) array( 'foo' ), 34 array(), 35 'AND', 36 array(), 37 ), 38 'empty args' => array( 39 array( 'foo', 'bar' ), 40 array(), 41 'AND', 42 array( 'foo', 'bar' ), 43 ), 44 'invalid operator' => array( 45 array( 46 (object) array( 'foo' => 'bar' ), 47 (object) array( 'foo' => 'baz' ), 48 ), 49 array( 'foo' => 'bar' ), 50 'XOR', 51 array(), 52 ), 53 'single argument to match' => array( 54 array( 55 (object) array( 56 'foo' => 'bar', 57 'bar' => 'baz', 58 'abc' => 'xyz', 59 'key' => 'foo', 60 ), 61 (object) array( 62 'foo' => 'foo', 63 '123' => '456', 64 'lorem' => 'ipsum', 65 'key' => 'bar', 66 ), 67 (object) array( 68 'foo' => 'baz', 69 'key' => 'value', 70 ), 71 (object) array( 72 'foo' => 'bar', 73 'key' => 'value', 74 ), 75 ), 76 array( 'foo' => 'bar' ), 77 'AND', 78 array( 79 0 => (object) array( 80 'foo' => 'bar', 81 'bar' => 'baz', 82 'abc' => 'xyz', 83 'key' => 'foo', 84 ), 85 3 => (object) array( 86 'foo' => 'bar', 87 'key' => 'value', 88 ), 89 ), 90 ), 91 'all must match' => array( 92 array( 93 (object) array( 94 'foo' => 'bar', 95 'bar' => 'baz', 96 'abc' => 'xyz', 97 'key' => 'foo', 98 ), 99 (object) array( 100 'foo' => 'foo', 101 '123' => '456', 102 'lorem' => 'ipsum', 103 'key' => 'bar', 104 ), 105 (object) array( 106 'foo' => 'baz', 107 'key' => 'value', 108 'bar' => 'baz', 109 ), 110 (object) array( 111 'foo' => 'bar', 112 'key' => 'value', 113 ), 114 ), 115 array( 116 'foo' => 'bar', 117 'bar' => 'baz', 118 ), 119 'AND', 120 array( 121 0 => (object) array( 122 'foo' => 'bar', 123 'bar' => 'baz', 124 'abc' => 'xyz', 125 'key' => 'foo', 126 ), 127 ), 128 ), 129 'any must match' => array( 130 array( 131 (object) array( 132 'foo' => 'bar', 133 'bar' => 'baz', 134 'abc' => 'xyz', 135 'key' => 'foo', 136 ), 137 (object) array( 138 'foo' => 'foo', 139 '123' => '456', 140 'lorem' => 'ipsum', 141 'key' => 'bar', 142 ), 143 (object) array( 144 'foo' => 'baz', 145 'key' => 'value', 146 'bar' => 'baz', 147 ), 148 (object) array( 149 'foo' => 'bar', 150 'key' => 'value', 151 ), 152 ), 153 array( 154 'key' => 'value', 155 'bar' => 'baz', 156 ), 157 'OR', 158 array( 159 0 => (object) array( 160 'foo' => 'bar', 161 'bar' => 'baz', 162 'abc' => 'xyz', 163 'key' => 'foo', 164 ), 165 2 => (object) array( 166 'foo' => 'baz', 167 'key' => 'value', 168 'bar' => 'baz', 169 ), 170 3 => (object) array( 171 'foo' => 'bar', 172 'key' => 'value', 173 ), 174 ), 175 ), 176 'none must match' => array( 177 array( 178 (object) array( 179 'foo' => 'bar', 180 'bar' => 'baz', 181 'abc' => 'xyz', 182 'key' => 'foo', 183 ), 184 (object) array( 185 'foo' => 'foo', 186 '123' => '456', 187 'lorem' => 'ipsum', 188 'key' => 'bar', 189 ), 190 (object) array( 191 'foo' => 'baz', 192 'key' => 'value', 193 ), 194 (object) array( 195 'foo' => 'bar', 196 'key' => 'value', 197 ), 198 ), 199 array( 200 'key' => 'value', 201 'bar' => 'baz', 202 ), 203 'NOT', 204 array( 205 1 => (object) array( 206 'foo' => 'foo', 207 '123' => '456', 521 208 'lorem' => 'ipsum', 522 209 'key' => 'bar', … … 526 213 ); 527 214 } 528 529 /**530 * @dataProvider data_test_wp_list_sort531 *532 * @covers ::wp_list_sort533 *534 * @param string|array $orderby Either the field name to order by or an array535 * of multiple orderby fields as $orderby => $order.536 * @param string $order Either 'ASC' or 'DESC'.537 */538 public function test_wp_list_sort( $list, $orderby, $order, $expected ) {539 $this->assertSame( $expected, wp_list_sort( $list, $orderby, $order ) );540 }541 542 public function data_test_wp_list_sort_preserve_keys() {543 return array(544 'single orderby ascending' => array(545 array(546 'foobar' => array(547 'foo' => 'bar',548 'bar' => 'baz',549 'key' => 'foo',550 ),551 'foofoo' => array(552 'foo' => 'foo',553 'lorem' => 'ipsum',554 'key' => 'bar',555 ),556 'foobaz' => array(557 'foo' => 'baz',558 'key' => 'value',559 ),560 ),561 'foo',562 'ASC',563 array(564 'foobar' => array(565 'foo' => 'bar',566 'bar' => 'baz',567 'key' => 'foo',568 ),569 'foobaz' => array(570 'foo' => 'baz',571 'key' => 'value',572 ),573 'foofoo' => array(574 'foo' => 'foo',575 'lorem' => 'ipsum',576 'key' => 'bar',577 ),578 ),579 ),580 'single orderby descending' => array(581 array(582 'foobar' => array(583 'foo' => 'bar',584 'bar' => 'baz',585 'key' => 'foo',586 ),587 'foofoo' => array(588 'foo' => 'foo',589 'lorem' => 'ipsum',590 'key' => 'bar',591 ),592 'foobaz' => array(593 'foo' => 'baz',594 'key' => 'value',595 ),596 ),597 'foo',598 'DESC',599 array(600 'foofoo' => array(601 'foo' => 'foo',602 'lorem' => 'ipsum',603 'key' => 'bar',604 ),605 'foobaz' => array(606 'foo' => 'baz',607 'key' => 'value',608 ),609 'foobar' => array(610 'foo' => 'bar',611 'bar' => 'baz',612 'key' => 'foo',613 ),614 ),615 ),616 'single orderby array ascending' => array(617 array(618 'foobar' => array(619 'foo' => 'bar',620 'bar' => 'baz',621 'key' => 'foo',622 ),623 'foofoo' => array(624 'foo' => 'foo',625 'lorem' => 'ipsum',626 'key' => 'bar',627 ),628 'foobaz' => array(629 'foo' => 'baz',630 'key' => 'value',631 ),632 ),633 array( 'foo' => 'ASC' ),634 'IGNORED',635 array(636 'foobar' => array(637 'foo' => 'bar',638 'bar' => 'baz',639 'key' => 'foo',640 ),641 'foobaz' => array(642 'foo' => 'baz',643 'key' => 'value',644 ),645 'foofoo' => array(646 'foo' => 'foo',647 'lorem' => 'ipsum',648 'key' => 'bar',649 ),650 ),651 ),652 'single orderby array descending' => array(653 array(654 'foobar' => array(655 'foo' => 'bar',656 'bar' => 'baz',657 'key' => 'foo',658 ),659 'foofoo' => array(660 'foo' => 'foo',661 'lorem' => 'ipsum',662 'key' => 'bar',663 ),664 'foobaz' => array(665 'foo' => 'baz',666 'key' => 'value',667 ),668 ),669 array( 'foo' => 'DESC' ),670 'IGNORED',671 array(672 'foofoo' => array(673 'foo' => 'foo',674 'lorem' => 'ipsum',675 'key' => 'bar',676 ),677 'foobaz' => array(678 'foo' => 'baz',679 'key' => 'value',680 ),681 'foobar' => array(682 'foo' => 'bar',683 'bar' => 'baz',684 'key' => 'foo',685 ),686 ),687 ),688 'multiple orderby ascending' => array(689 array(690 'foobarfoo' => array(691 'foo' => 'bar',692 'bar' => 'baz',693 'key' => 'foo',694 ),695 'foofoobar' => array(696 'foo' => 'foo',697 'lorem' => 'ipsum',698 'key' => 'bar',699 ),700 'foofookey' => array(701 'foo' => 'foo',702 'key' => 'key',703 ),704 'foobazkey' => array(705 'foo' => 'baz',706 'key' => 'key',707 ),708 'foobarvalue' => array(709 'foo' => 'bar',710 'key' => 'value',711 ),712 ),713 array(714 'key' => 'ASC',715 'foo' => 'ASC',716 ),717 'IGNORED',718 array(719 'foofoobar' => array(720 'foo' => 'foo',721 'lorem' => 'ipsum',722 'key' => 'bar',723 ),724 'foobarfoo' => array(725 'foo' => 'bar',726 'bar' => 'baz',727 'key' => 'foo',728 ),729 'foobazkey' => array(730 'foo' => 'baz',731 'key' => 'key',732 ),733 'foofookey' => array(734 'foo' => 'foo',735 'key' => 'key',736 ),737 'foobarvalue' => array(738 'foo' => 'bar',739 'key' => 'value',740 ),741 ),742 ),743 'multiple orderby descending' => array(744 array(745 'foobarfoo' => array(746 'foo' => 'bar',747 'bar' => 'baz',748 'key' => 'foo',749 ),750 'foofoobar' => array(751 'foo' => 'foo',752 'lorem' => 'ipsum',753 'key' => 'bar',754 ),755 'foofookey' => array(756 'foo' => 'foo',757 'key' => 'key',758 ),759 'foobazkey' => array(760 'foo' => 'baz',761 'key' => 'key',762 ),763 'foobarvalue' => array(764 'foo' => 'bar',765 'key' => 'value',766 ),767 ),768 array(769 'key' => 'DESC',770 'foo' => 'DESC',771 ),772 'IGNORED',773 array(774 'foobarvalue' => array(775 'foo' => 'bar',776 'key' => 'value',777 ),778 'foofookey' => array(779 'foo' => 'foo',780 'key' => 'key',781 ),782 'foobazkey' => array(783 'foo' => 'baz',784 'key' => 'key',785 ),786 'foobarfoo' => array(787 'foo' => 'bar',788 'bar' => 'baz',789 'key' => 'foo',790 ),791 'foofoobar' => array(792 'foo' => 'foo',793 'lorem' => 'ipsum',794 'key' => 'bar',795 ),796 ),797 ),798 'multiple orderby mixed' => array(799 array(800 'foobarfoo' => array(801 'foo' => 'bar',802 'bar' => 'baz',803 'key' => 'foo',804 ),805 'foofoobar' => array(806 'foo' => 'foo',807 'lorem' => 'ipsum',808 'key' => 'bar',809 ),810 'foofookey' => array(811 'foo' => 'foo',812 'key' => 'key',813 ),814 'foobazkey' => array(815 'foo' => 'baz',816 'key' => 'key',817 ),818 'foobarvalue' => array(819 'foo' => 'bar',820 'key' => 'value',821 ),822 ),823 array(824 'key' => 'DESC',825 'foo' => 'ASC',826 ),827 'IGNORED',828 array(829 'foobarvalue' => array(830 'foo' => 'bar',831 'key' => 'value',832 ),833 'foobazkey' => array(834 'foo' => 'baz',835 'key' => 'key',836 ),837 'foofookey' => array(838 'foo' => 'foo',839 'key' => 'key',840 ),841 'foobarfoo' => array(842 'foo' => 'bar',843 'bar' => 'baz',844 'key' => 'foo',845 ),846 'foofoobar' => array(847 'foo' => 'foo',848 'lorem' => 'ipsum',849 'key' => 'bar',850 ),851 ),852 ),853 );854 }855 856 /**857 * @dataProvider data_test_wp_list_sort_preserve_keys858 *859 * @covers ::wp_list_sort860 *861 * @param string|array $orderby Either the field name to order by or an array862 * of multiple orderby fields as $orderby => $order.863 * @param string $order Either 'ASC' or 'DESC'.864 */865 public function test_wp_list_sort_preserve_keys( $list, $orderby, $order, $expected ) {866 $this->assertSame( $expected, wp_list_sort( $list, $orderby, $order, true ) );867 }868 869 /**870 * @covers WP_List_Util::get_input871 */872 public function test_wp_list_util_get_input() {873 $input = array( 'foo', 'bar' );874 $util = new WP_List_Util( $input );875 876 $this->assertSameSets( $input, $util->get_input() );877 }878 879 /**880 * @covers WP_List_Util::get_output881 */882 public function test_wp_list_util_get_output_immediately() {883 $input = array( 'foo', 'bar' );884 $util = new WP_List_Util( $input );885 886 $this->assertSameSets( $input, $util->get_output() );887 }888 889 /**890 * @covers WP_List_Util::get_output891 */892 public function test_wp_list_util_get_output() {893 $expected = array(894 (object) array(895 'foo' => 'bar',896 'bar' => 'baz',897 ),898 );899 900 $util = new WP_List_Util(901 array(902 (object) array(903 'foo' => 'bar',904 'bar' => 'baz',905 ),906 (object) array( 'bar' => 'baz' ),907 )908 );909 $actual = $util->filter( array( 'foo' => 'bar' ) );910 911 $this->assertEqualSets( $expected, $actual );912 $this->assertEqualSets( $expected, $util->get_output() );913 }914 215 }
Note: See TracChangeset
for help on using the changeset viewer.