Changeset 43571 for trunk/tests/phpunit/tests/term/getTerms.php
- Timestamp:
- 08/17/2018 01:50:26 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/getTerms.php
r42343 r43571 222 222 223 223 $terms_id_parent = get_terms( 224 'post_tag', array( 224 'post_tag', 225 array( 225 226 'hide_empty' => false, 226 227 'fields' => 'id=>parent', … … 231 232 $term_id1 => 0, 232 233 $term_id2 => $term_id1, 233 ), $terms_id_parent 234 ), 235 $terms_id_parent 234 236 ); 235 237 236 238 $terms_ids = get_terms( 237 'post_tag', array( 239 'post_tag', 240 array( 238 241 'hide_empty' => false, 239 242 'fields' => 'ids', … … 243 246 244 247 $terms_name = get_terms( 245 'post_tag', array( 248 'post_tag', 249 array( 246 250 'hide_empty' => false, 247 251 'fields' => 'names', … … 251 255 252 256 $terms_id_name = get_terms( 253 'post_tag', array( 257 'post_tag', 258 array( 254 259 'hide_empty' => false, 255 260 'fields' => 'id=>name', … … 260 265 $term_id1 => 'WOO!', 261 266 $term_id2 => 'HOO!', 262 ), $terms_id_name 267 ), 268 $terms_id_name 263 269 ); 264 270 265 271 $terms_id_slug = get_terms( 266 'post_tag', array( 272 'post_tag', 273 array( 267 274 'hide_empty' => false, 268 275 'fields' => 'id=>slug', … … 273 280 $term_id1 => 'woo', 274 281 $term_id2 => 'hoo', 275 ), $terms_id_slug 282 ), 283 $terms_id_slug 276 284 ); 277 285 } … … 286 294 $term_id2 = self::factory()->tag->create(); 287 295 $inc_terms = get_terms( 288 'post_tag', array( 296 'post_tag', 297 array( 289 298 'include' => array( $term_id1, $term_id2 ), 290 299 'hide_empty' => false, … … 294 303 295 304 $exc_terms = get_terms( 296 'post_tag', array( 305 'post_tag', 306 array( 297 307 'exclude' => array( $term_id1, $term_id2 ), 298 308 'hide_empty' => false, … … 303 313 // These should not generate query errors. 304 314 get_terms( 305 'post_tag', array( 315 'post_tag', 316 array( 306 317 'exclude' => array( 0 ), 307 318 'hide_empty' => false, … … 311 322 312 323 get_terms( 313 'post_tag', array( 324 'post_tag', 325 array( 314 326 'exclude' => array( 'unexpected-string' ), 315 327 'hide_empty' => false, … … 319 331 320 332 get_terms( 321 'post_tag', array( 333 'post_tag', 334 array( 322 335 'include' => array( 'unexpected-string' ), 323 336 'hide_empty' => false, … … 334 347 335 348 $terms = self::factory()->term->create_many( 336 2, array( 349 2, 350 array( 337 351 'taxonomy' => 'wptests_tax', 338 352 ) … … 340 354 341 355 $found = get_terms( 342 'wptests_tax', array( 356 'wptests_tax', 357 array( 343 358 'taxonomy' => 'wptests_tax', 344 359 'hide_empty' => false, … … 366 381 367 382 $terms = get_terms( 368 'category', array( 383 'category', 384 array( 369 385 'exclude' => $term_id_uncategorized, 370 386 'fields' => 'ids', … … 375 391 376 392 $terms = get_terms( 377 'category', array( 393 'category', 394 array( 378 395 'fields' => 'ids', 379 396 'exclude_tree' => "$term_id1,$term_id_uncategorized", … … 395 412 396 413 $terms = get_terms( 397 'post_tag', array( 414 'post_tag', 415 array( 398 416 'hide_empty' => false, 399 417 'search' => 'bur', … … 422 440 423 441 $terms = get_terms( 424 'post_tag', array( 442 'post_tag', 443 array( 425 444 'hide_empty' => false, 426 445 'name__like' => 'bur', … … 431 450 432 451 $terms2 = get_terms( 433 'post_tag', array( 452 'post_tag', 453 array( 434 454 'hide_empty' => false, 435 455 'description__like' => 'bur', … … 440 460 441 461 $terms3 = get_terms( 442 'post_tag', array( 462 'post_tag', 463 array( 443 464 'hide_empty' => false, 444 465 'name__like' => 'Bur', … … 449 470 450 471 $terms4 = get_terms( 451 'post_tag', array( 472 'post_tag', 473 array( 452 474 'hide_empty' => false, 453 475 'description__like' => 'Bur', … … 458 480 459 481 $terms5 = get_terms( 460 'post_tag', array( 482 'post_tag', 483 array( 461 484 'hide_empty' => false, 462 485 'name__like' => 'ENCHILADA', … … 467 490 468 491 $terms6 = get_terms( 469 'post_tag', array( 492 'post_tag', 493 array( 470 494 'hide_empty' => false, 471 495 'description__like' => 'ENCHILADA', … … 476 500 477 501 $terms7 = get_terms( 478 'post_tag', array( 502 'post_tag', 503 array( 479 504 'hide_empty' => false, 480 505 'name__like' => 'o', … … 485 510 486 511 $terms8 = get_terms( 487 'post_tag', array( 512 'post_tag', 513 array( 488 514 'hide_empty' => false, 489 515 'description__like' => '.', … … 585 611 586 612 $terms = get_terms( 587 $tax, array( 613 $tax, 614 array( 588 615 'parent' => 0, 589 616 'cache_domain' => $tax, … … 627 654 628 655 $terms = get_terms( 629 $tax, array( 656 $tax, 657 array( 630 658 'parent' => 0, 631 659 'cache_domain' => $tax, … … 662 690 663 691 $terms = get_terms( 664 $tax, array( 692 $tax, 693 array( 665 694 'parent' => 0, 666 695 'cache_domain' => $tax, … … 681 710 682 711 $terms = get_terms( 683 'category', array( 712 'category', 713 array( 684 714 'child_of' => $parent, 685 715 'hide_empty' => false, … … 702 732 703 733 $found = get_terms( 704 'wptests_tax', array( 734 'wptests_tax', 735 array( 705 736 'hide_empty' => false, 706 737 'child_of' => $terms[0], … … 729 760 730 761 $found = get_terms( 731 array( 'wptests_tax1', 'wptests_tax2' ), array( 762 array( 'wptests_tax1', 'wptests_tax2' ), 763 array( 732 764 'fields' => 'ids', 733 765 'hide_empty' => false, … … 800 832 801 833 $found = get_terms( 802 'post_tag', array( 834 'post_tag', 835 array( 803 836 'hide_empty' => false, 804 837 'fields' => 'ids', … … 819 852 820 853 $found = get_terms( 821 'post_tag', array( 854 'post_tag', 855 array( 822 856 'hide_empty' => false, 823 857 'fields' => 'ids', … … 837 871 838 872 $found = get_terms( 839 'post_tag', array( 873 'post_tag', 874 array( 840 875 'hide_empty' => false, 841 876 'fields' => 'ids', … … 856 891 857 892 $found = get_terms( 858 'post_tag', array( 893 'post_tag', 894 array( 859 895 'hide_empty' => false, 860 896 'fields' => 'ids', … … 881 917 882 918 $found = get_terms( 883 'wptests_tax', array( 919 'wptests_tax', 920 array( 884 921 'hide_empty' => false, 885 922 'fields' => 'ids', … … 891 928 // array format. 892 929 $found = get_terms( 893 'wptests_tax', array( 930 'wptests_tax', 931 array( 894 932 'hide_empty' => false, 895 933 'fields' => 'ids', … … 920 958 921 959 $found = get_terms( 922 'wptests_tax', array( 960 'wptests_tax', 961 array( 923 962 'hide_empty' => false, 924 963 'fields' => 'ids', … … 957 996 958 997 $terms = get_terms( 959 $flat_tax, array( 998 $flat_tax, 999 array( 960 1000 'childless' => true, 961 1001 'hide_empty' => false, … … 1049 1089 1050 1090 $terms = get_terms( 1051 $tax, array( 1091 $tax, 1092 array( 1052 1093 'childless' => true, 1053 1094 'hide_empty' => false, … … 1116 1157 1117 1158 $terms = get_terms( 1118 $tax, array( 1159 $tax, 1160 array( 1119 1161 'childless' => true, 1120 1162 'child_of' => $quebec, … … 1150 1192 1151 1193 $found = get_terms( 1152 array( 'wptests_tax1', 'wptests_tax2' ), array( 1194 array( 'wptests_tax1', 'wptests_tax2' ), 1195 array( 1153 1196 'fields' => 'ids', 1154 1197 'hide_empty' => false, … … 1168 1211 1169 1212 $found = get_terms( 1170 $tax, array( 1213 $tax, 1214 array( 1171 1215 'hide_empty' => false, 1172 1216 'fields' => 'ids', … … 1195 1239 1196 1240 $found = get_terms( 1197 $tax, array( 1241 $tax, 1242 array( 1198 1243 'hide_empty' => true, 1199 1244 'fields' => 'ids', … … 1220 1265 1221 1266 $found = get_terms( 1222 $tax, array( 1267 $tax, 1268 array( 1223 1269 'hide_empty' => true, 1224 1270 'fields' => 'ids', … … 1245 1291 1246 1292 $found = get_terms( 1247 $tax, array( 1293 $tax, 1294 array( 1248 1295 'hide_empty' => false, 1249 1296 'fields' => 'names', … … 1272 1319 1273 1320 $found = get_terms( 1274 $tax, array( 1321 $tax, 1322 array( 1275 1323 'hide_empty' => true, 1276 1324 'fields' => 'names', … … 1297 1345 1298 1346 $found = get_terms( 1299 $tax, array( 1347 $tax, 1348 array( 1300 1349 'hide_empty' => true, 1301 1350 'fields' => 'names', … … 1322 1371 1323 1372 $found = get_terms( 1324 $tax, array( 1373 $tax, 1374 array( 1325 1375 'hide_empty' => false, 1326 1376 'fields' => 'count', … … 1341 1391 1342 1392 $found = get_terms( 1343 $tax, array( 1393 $tax, 1394 array( 1344 1395 'hide_empty' => true, 1345 1396 'fields' => 'count', … … 1361 1412 1362 1413 $found = get_terms( 1363 $tax, array( 1414 $tax, 1415 array( 1364 1416 'hide_empty' => true, 1365 1417 'fields' => 'count', … … 1381 1433 1382 1434 $found = get_terms( 1383 $tax, array( 1435 $tax, 1436 array( 1384 1437 'hide_empty' => false, 1385 1438 'fields' => 'id=>parent', … … 1408 1461 1409 1462 $found = get_terms( 1410 $tax, array( 1463 $tax, 1464 array( 1411 1465 'hide_empty' => true, 1412 1466 'fields' => 'id=>parent', … … 1433 1487 1434 1488 $found = get_terms( 1435 $tax, array( 1489 $tax, 1490 array( 1436 1491 'hide_empty' => true, 1437 1492 'fields' => 'id=>parent', … … 1458 1513 1459 1514 $found = get_terms( 1460 $tax, array( 1515 $tax, 1516 array( 1461 1517 'hide_empty' => false, 1462 1518 'fields' => 'id=>slug', … … 1488 1544 1489 1545 $found = get_terms( 1490 $tax, array( 1546 $tax, 1547 array( 1491 1548 'hide_empty' => true, 1492 1549 'fields' => 'id=>slug', … … 1513 1570 1514 1571 $found = get_terms( 1515 $tax, array( 1572 $tax, 1573 array( 1516 1574 'hide_empty' => true, 1517 1575 'fields' => 'id=>slug', … … 1538 1596 1539 1597 $found = get_terms( 1540 $tax, array( 1598 $tax, 1599 array( 1541 1600 'hide_empty' => false, 1542 1601 'fields' => 'id=>name', … … 1568 1627 1569 1628 $found = get_terms( 1570 $tax, array( 1629 $tax, 1630 array( 1571 1631 'hide_empty' => true, 1572 1632 'fields' => 'id=>name', … … 1593 1653 1594 1654 $found = get_terms( 1595 $tax, array( 1655 $tax, 1656 array( 1596 1657 'hide_empty' => true, 1597 1658 'fields' => 'id=>name', … … 1651 1712 1652 1713 $found = get_terms( 1653 array( 'wptests_tax1', 'wptests_tax2' ), array( 1714 array( 'wptests_tax1', 'wptests_tax2' ), 1715 array( 1654 1716 'hierarchical' => true, 1655 1717 'hide_empty' => true, … … 1687 1749 1688 1750 $found = get_terms( 1689 $tax, array( 1751 $tax, 1752 array( 1690 1753 'fields' => 'ids', 1691 1754 'include' => array( $t4, $t1, $t2 ), … … 1733 1796 1734 1797 $found = get_terms( 1735 $tax, array( 1798 $tax, 1799 array( 1736 1800 'fields' => 'ids', 1737 1801 'orderby' => 'description', … … 1770 1834 1771 1835 $found = get_terms( 1772 'wptests_tax', array( 1836 'wptests_tax', 1837 array( 1773 1838 'orderby' => 'term_id', 1774 1839 'hide_empty' => false, … … 1795 1860 // Matches the first meta query clause. 1796 1861 $found = get_terms( 1797 'wptests_tax', array( 1862 'wptests_tax', 1863 array( 1798 1864 'hide_empty' => false, 1799 1865 'meta_query' => array( … … 1832 1898 // Matches the first meta query clause. 1833 1899 $found = get_terms( 1834 'wptests_tax', array( 1900 'wptests_tax', 1901 array( 1835 1902 'hide_empty' => false, 1836 1903 'meta_query' => array( … … 1871 1938 1872 1939 $found = get_terms( 1873 'wptests_tax', array( 1940 'wptests_tax', 1941 array( 1874 1942 'hide_empty' => false, 1875 1943 'meta_key' => 'fee', … … 1883 1951 1884 1952 $found = get_terms( 1885 'wptests_tax', array( 1953 'wptests_tax', 1954 array( 1886 1955 'hide_empty' => false, 1887 1956 'meta_query' => array( … … 1902 1971 // Matches the first meta query clause. 1903 1972 $found = get_terms( 1904 'wptests_tax', array( 1973 'wptests_tax', 1974 array( 1905 1975 'hide_empty' => false, 1906 1976 'meta_query' => array( … … 1926 1996 // Matches the meta query clause corresponding to the 'meta_key' param. 1927 1997 $found = get_terms( 1928 'wptests_tax', array( 1998 'wptests_tax', 1999 array( 1929 2000 'hide_empty' => false, 1930 2001 'meta_query' => array( … … 1966 2037 1967 2038 $found = get_terms( 1968 'wptests_tax', array( 2039 'wptests_tax', 2040 array( 1969 2041 'hide_empty' => false, 1970 2042 'meta_key' => 'fee', … … 1978 2050 1979 2051 $found = get_terms( 1980 'wptests_tax', array( 2052 'wptests_tax', 2053 array( 1981 2054 'hide_empty' => false, 1982 2055 'meta_query' => array( … … 1996 2069 1997 2070 $found = get_terms( 1998 'wptests_tax', array( 2071 'wptests_tax', 2072 array( 1999 2073 'hide_empty' => false, 2000 2074 'meta_query' => array( … … 2019 2093 2020 2094 $found = get_terms( 2021 'wptests_tax', array( 2095 'wptests_tax', 2096 array( 2022 2097 'hide_empty' => false, 2023 2098 'meta_query' => array( … … 2056 2131 2057 2132 $found = get_terms( 2058 'wptests_tax', array( 2133 'wptests_tax', 2134 array( 2059 2135 'hide_empty' => false, 2060 2136 'meta_query' => array( … … 2078 2154 2079 2155 $found = get_terms( 2080 'wptests_tax', array( 2156 'wptests_tax', 2157 array( 2081 2158 'hide_empty' => false, 2082 2159 'meta_query' => array( … … 2100 2177 2101 2178 $expected = get_terms( 2102 'wptests_tax', array( 2179 'wptests_tax', 2180 array( 2103 2181 'hide_empty' => false, 2104 2182 'meta_query' => array( … … 2118 2196 2119 2197 $found = get_terms( 2120 'wptests_tax', array( 2198 'wptests_tax', 2199 array( 2121 2200 'hide_empty' => false, 2122 2201 'meta_query' => array( … … 2144 2223 // Case where hierarchical is false 2145 2224 $terms = get_terms( 2146 'category', array( 2225 'category', 2226 array( 2147 2227 'hierarchical' => false, 2148 2228 'parent' => $initial_terms['one_term']['term_id'], … … 2162 2242 // Case where hierarchical is true 2163 2243 $terms = get_terms( 2164 'category', array( 2244 'category', 2245 array( 2165 2246 'hierarchical' => true, 2166 2247 'parent' => $initial_terms['one_term']['term_id'], … … 2188 2269 // Case where hierarchical is false 2189 2270 $terms = get_terms( 2190 'category', array( 2271 'category', 2272 array( 2191 2273 'hierarchical' => false, 2192 2274 'child_of' => $initial_terms['one_term']['term_id'], … … 2207 2289 // Case where hierarchical is false 2208 2290 $terms = get_terms( 2209 'category', array( 2291 'category', 2292 array( 2210 2293 'hierarchical' => false, 2211 2294 'child_of' => $initial_terms['one_term']['term_id'], … … 2222 2305 // Case where hierarchical is true 2223 2306 $terms = get_terms( 2224 'category', array( 2307 'category', 2308 array( 2225 2309 'hierarchical' => true, 2226 2310 'child_of' => $initial_terms['one_term']['term_id'], … … 2242 2326 2243 2327 $terms = get_terms( 2244 'category', array( 2328 'category', 2329 array( 2245 2330 'hide_empty' => false, 2246 2331 'child_of' => $initial_terms['one_term']['term_id'], … … 2272 2357 2273 2358 $found = get_terms( 2274 'wptests_tax', array( 2359 'wptests_tax', 2360 array( 2275 2361 'hide_empty' => false, 2276 2362 'parent' => $terms[0], … … 2299 2385 2300 2386 $found = get_terms( 2301 array( 'wptests_tax1', 'wptests_tax2' ), array( 2387 array( 'wptests_tax1', 'wptests_tax2' ), 2388 array( 2302 2389 'fields' => 'ids', 2303 2390 'hide_empty' => false, … … 2314 2401 // Case where hierarchical is false 2315 2402 $terms = get_terms( 2316 'category', array( 2403 'category', 2404 array( 2317 2405 'hierarchical' => false, 2318 2406 'child_of' => $initial_terms['one_term']['term_id'], … … 2333 2421 // Case where hierarchical is true 2334 2422 $terms = get_terms( 2335 'category', array( 2423 'category', 2424 array( 2336 2425 'hierarchical' => true, 2337 2426 'child_of' => $initial_terms['one_term']['term_id'], … … 2377 2466 2378 2467 $found = get_terms( 2379 'wptests_tax_1', array( 2468 'wptests_tax_1', 2469 array( 2380 2470 'pad_counts' => true, 2381 2471 ) … … 2414 2504 2415 2505 $terms = get_terms( 2416 'category', array( 2506 'category', 2507 array( 2417 2508 'pad_counts' => true, 2418 2509 ) … … 2448 2539 2449 2540 $found = get_terms( 2450 array( 'wptests_tax1', 'wptests_tax2' ), array( 2541 array( 'wptests_tax1', 'wptests_tax2' ), 2542 array( 2451 2543 'pad_counts' => true, 2452 2544 ) … … 2479 2571 2480 2572 $found = get_terms( 2481 'wptests_tax', array( 2573 'wptests_tax', 2574 array( 2482 2575 'hide_empty' => false, 2483 2576 'include' => $terms, … … 2507 2600 2508 2601 $found = get_terms( 2509 'wptests_tax', array( 2602 'wptests_tax', 2603 array( 2510 2604 'hide_empty' => false, 2511 2605 'include' => $terms, … … 2535 2629 2536 2630 $found = get_terms( 2537 'wptests_tax', array( 2631 'wptests_tax', 2632 array( 2538 2633 'hide_empty' => false, 2539 2634 'meta_query' => array( … … 2560 2655 2561 2656 $found = get_terms( 2562 'wptests_tax', array( 2657 'wptests_tax', 2658 array( 2563 2659 'hide_empty' => false, 2564 2660 'meta_query' => array( … … 2584 2680 2585 2681 $found = get_terms( 2586 'wptests_tax', array( 2682 'wptests_tax', 2683 array( 2587 2684 'hide_empty' => false, 2588 2685 'fields' => 'all', … … 2609 2706 // Prime the cache. 2610 2707 get_terms( 2611 'wptests_tax', array( 2708 'wptests_tax', 2709 array( 2612 2710 'hide_empty' => false, 2613 2711 'fields' => 'all', … … 2618 2716 2619 2717 $found = get_terms( 2620 'wptests_tax', array( 2718 'wptests_tax', 2719 array( 2621 2720 'hide_empty' => false, 2622 2721 'fields' => 'all', … … 2643 2742 2644 2743 $found = get_terms( 2645 'wptests_tax', array( 2744 'wptests_tax', 2745 array( 2646 2746 'hide_empty' => false, 2647 2747 'fields' => 'all', … … 2663 2763 2664 2764 $found = get_terms( 2665 'wptests_tax', array( 2765 'wptests_tax', 2766 array( 2666 2767 'hide_empty' => false, 2667 2768 'fields' => 'id=>parent', … … 2685 2786 2686 2787 $found = get_terms( 2687 'wptests_tax', array( 2788 'wptests_tax', 2789 array( 2688 2790 'number' => 3, 2689 2791 'offset' => 0, … … 2704 2806 2705 2807 $found = get_terms( 2706 'wptests_tax', array( 2808 'wptests_tax', 2809 array( 2707 2810 'number' => 1, 2708 2811 'offset' => 1, … … 2725 2828 2726 2829 $found = get_terms( 2727 'wptests_tax', array( 2830 'wptests_tax', 2831 array( 2728 2832 'number' => 2, 2729 2833 'offset' => 1, … … 2746 2850 2747 2851 $found = get_terms( 2748 'wptests_tax', array( 2852 'wptests_tax', 2853 array( 2749 2854 'number' => 100, 2750 2855 'offset' => 3,
Note: See TracChangeset
for help on using the changeset viewer.