| 210 | $this->assertArrayHasKey( 'title-tag', $properties['theme_supports']['properties'] ); |
| 211 | $this->assertArrayHasKey( 'wp-block-styles', $properties['theme_supports']['properties'] ); |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * @ticket 49037 |
| 216 | */ |
| 217 | public function test_theme_supports_disable_custom_colors_false() { |
| 218 | remove_theme_support( 'disable-custom-colors' ); |
| 219 | $response = self::perform_active_theme_request(); |
| 220 | $result = $response->get_data(); |
| 221 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 222 | $this->assertTrue( isset( $result[0]['theme_supports']['disable-custom-colors'] ) ); |
| 223 | $this->assertFalse( $result[0]['theme_supports']['disable-custom-colors'] ); |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * @ticket 49037 |
| 228 | */ |
| 229 | public function test_theme_supports_disable_custom_colors_true() { |
| 230 | remove_theme_support( 'disable-custom-colors' ); |
| 231 | add_theme_support( 'disable-custom-colors' ); |
| 232 | $response = self::perform_active_theme_request(); |
| 233 | $result = $response->get_data(); |
| 234 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 235 | $this->assertTrue( $result[0]['theme_supports']['disable-custom-colors'] ); |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * @ticket 49037 |
| 240 | */ |
| 241 | public function test_theme_supports_disable_custom_font_sizes_false() { |
| 242 | remove_theme_support( 'disable-custom-font-sizes' ); |
| 243 | $response = self::perform_active_theme_request(); |
| 244 | $result = $response->get_data(); |
| 245 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 246 | $this->assertTrue( isset( $result[0]['theme_supports']['disable-custom-font-sizes'] ) ); |
| 247 | $this->assertFalse( $result[0]['theme_supports']['disable-custom-font-sizes'] ); |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * @ticket 49037 |
| 252 | */ |
| 253 | public function test_theme_supports_disable_custom_font_sizes_true() { |
| 254 | remove_theme_support( 'disable-custom-font-sizes' ); |
| 255 | add_theme_support( 'disable-custom-font-sizes' ); |
| 256 | $response = self::perform_active_theme_request(); |
| 257 | $result = $response->get_data(); |
| 258 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 259 | $this->assertTrue( $result[0]['theme_supports']['disable-custom-font-sizes'] ); |
| 260 | } |
| 261 | |
| 262 | /** |
| 263 | * @ticket 49037 |
| 264 | */ |
| 265 | public function test_theme_supports_editor_font_sizes_false() { |
| 266 | remove_theme_support( 'editor-font-sizes' ); |
| 267 | $response = self::perform_active_theme_request(); |
| 268 | $result = $response->get_data(); |
| 269 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 270 | $this->assertTrue( isset( $result[0]['theme_supports']['editor-font-sizes'] ) ); |
| 271 | $this->assertFalse( $result[0]['theme_supports']['editor-font-sizes'] ); |
| 272 | } |
| 273 | |
| 274 | /** |
| 275 | * @ticket 49037 |
| 276 | */ |
| 277 | public function test_theme_supports_editor_font_sizes_array() { |
| 278 | remove_theme_support( 'editor-font-sizes' ); |
| 279 | $tiny = array( |
| 280 | 'name' => 'Tiny', |
| 281 | 'size' => 8, |
| 282 | 'slug' => 'tiny', |
| 283 | ); |
| 284 | add_theme_support( 'editor-font-sizes', array( $tiny ) ); |
| 285 | $response = self::perform_active_theme_request(); |
| 286 | $result = $response->get_data(); |
| 287 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 288 | $this->assertTrue( isset( $result[0]['theme_supports']['editor-font-sizes'] ) ); |
| 289 | $this->assertEquals( array( $tiny ), $result[0]['theme_supports']['editor-font-sizes'] ); |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * @ticket 49037 |
| 294 | */ |
| 295 | public function test_theme_supports_editor_color_palette_false() { |
| 296 | remove_theme_support( 'editor-color-palette' ); |
| 297 | $response = self::perform_active_theme_request(); |
| 298 | $result = $response->get_data(); |
| 299 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 300 | $this->assertTrue( isset( $result[0]['theme_supports']['editor-color-palette'] ) ); |
| 301 | $this->assertFalse( $result[0]['theme_supports']['editor-color-palette'] ); |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * @ticket 49037 |
| 306 | */ |
| 307 | public function test_theme_supports_editor_color_palette_array() { |
| 308 | remove_theme_support( 'editor-color-palette' ); |
| 309 | $wordpress_blue = array( |
| 310 | 'name' => 'WordPress Blue', |
| 311 | 'slug' => 'wordpress-blue', |
| 312 | 'color' => '#0073AA', |
| 313 | ); |
| 314 | add_theme_support( 'editor-color-palette', array( $wordpress_blue ) ); |
| 315 | $response = self::perform_active_theme_request(); |
| 316 | $result = $response->get_data(); |
| 317 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 318 | $this->assertEquals( array( $wordpress_blue ), $result[0]['theme_supports']['editor-color-palette'] ); |
| 319 | } |
| 320 | |
| 321 | /** |
| 322 | * @ticket 49037 |
| 323 | */ |
| 324 | public function test_theme_supports_enable_automatic_feed_links() { |
| 325 | remove_theme_support( 'automatic-feed-links' ); |
| 326 | add_theme_support( 'automatic-feed-links' ); |
| 327 | $response = self::perform_active_theme_request(); |
| 328 | $result = $response->get_data(); |
| 329 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 330 | $this->assertTrue( $result[0]['theme_supports']['automatic-feed-links'] ); |
| 331 | } |
| 332 | |
| 333 | /** |
| 334 | * @ticket 49037 |
| 335 | */ |
| 336 | public function test_theme_supports_does_not_enable_automatic_feed_links() { |
| 337 | remove_theme_support( 'automatic-feed-links' ); |
| 338 | $response = self::perform_active_theme_request(); |
| 339 | $result = $response->get_data(); |
| 340 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 341 | $this->assertTrue( isset( $result[0]['theme_supports']['automatic-feed-links'] ) ); |
| 342 | $this->assertFalse( $result[0]['theme_supports']['automatic-feed-links'] ); |
| 343 | } |
| 344 | |
| 345 | /** |
| 346 | * @ticket 49037 |
| 347 | */ |
| 348 | public function test_theme_does_not_support_custom_logo() { |
| 349 | remove_theme_support( 'custom-logo' ); |
| 350 | $response = self::perform_active_theme_request(); |
| 351 | $result = $response->get_data(); |
| 352 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 353 | $this->assertTrue( isset( $result[0]['theme_supports']['custom-logo'] ) ); |
| 354 | $this->assertFalse( $result[0]['theme_supports']['custom-logo'] ); |
| 355 | } |
| 356 | |
| 357 | /** |
| 358 | * @ticket 49037 |
| 359 | */ |
| 360 | public function test_theme_supports_custom_logo() { |
| 361 | remove_theme_support( 'custom-logo' ); |
| 362 | $wordpress_logo = array( |
| 363 | 'height' => 100, |
| 364 | 'width' => 400, |
| 365 | 'flex-height' => true, |
| 366 | 'flex-width' => true, |
| 367 | 'header-text' => array( 'site-title', 'site-description' ), |
| 368 | ); |
| 369 | add_theme_support( 'custom-logo', $wordpress_logo ); |
| 370 | $response = self::perform_active_theme_request(); |
| 371 | $result = $response->get_data(); |
| 372 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 373 | $this->assertEquals( $wordpress_logo, $result[0]['theme_supports']['custom-logo'] ); |
| 374 | } |
| 375 | |
| 376 | /** |
| 377 | * @ticket 49037 |
| 378 | */ |
| 379 | public function test_theme_does_not_support_custom_header() { |
| 380 | remove_theme_support( 'custom-header' ); |
| 381 | $response = self::perform_active_theme_request(); |
| 382 | $result = $response->get_data(); |
| 383 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 384 | $this->assertTrue( isset( $result[0]['theme_supports']['custom-header'] ) ); |
| 385 | $this->assertFalse( $result[0]['theme_supports']['custom-header'] ); |
| 386 | } |
| 387 | |
| 388 | /** |
| 389 | * @ticket 49037 |
| 390 | */ |
| 391 | public function test_theme_supports_custom_header() { |
| 392 | remove_theme_support( 'custom-header' ); |
| 393 | $wordpress_header = array( |
| 394 | 'default-image' => 'https://s.w.org/style/images/wporg-logo.svg', |
| 395 | 'random-default' => false, |
| 396 | 'width' => 0, |
| 397 | 'height' => 0, |
| 398 | 'flex-height' => false, |
| 399 | 'flex-width' => false, |
| 400 | 'default-text-color' => '', |
| 401 | 'header-text' => true, |
| 402 | 'uploads' => true, |
| 403 | 'wp-head-callback' => '', |
| 404 | 'admin-head-callback' => '', |
| 405 | 'admin-preview-callback' => '', |
| 406 | 'video' => false, |
| 407 | 'video-active-callback' => 'is_front_page', |
| 408 | ); |
| 409 | $excluded = array( |
| 410 | 'wp-head-callback', |
| 411 | 'admin-head-callback', |
| 412 | 'admin-preview-callback', |
| 413 | 'video-active-callback', |
| 414 | ); |
| 415 | add_theme_support( 'custom-header', $wordpress_header ); |
| 416 | $response = self::perform_active_theme_request(); |
| 417 | $result = $response->get_data(); |
| 418 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 419 | |
| 420 | $expected = array_diff_key( $wordpress_header, array_flip( $excluded ) ); |
| 421 | $this->assertEquals( $expected, $result[0]['theme_supports']['custom-header'] ); |
| 422 | } |
| 423 | |
| 424 | /** |
| 425 | * @ticket 49037 |
| 426 | */ |
| 427 | public function test_theme_does_not_support_custom_background() { |
| 428 | remove_theme_support( 'custom-background' ); |
| 429 | $response = self::perform_active_theme_request(); |
| 430 | $result = $response->get_data(); |
| 431 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 432 | $this->assertTrue( isset( $result[0]['theme_supports']['custom-background'] ) ); |
| 433 | $this->assertFalse( $result[0]['theme_supports']['custom-background'] ); |
| 434 | } |
| 435 | |
| 436 | /** |
| 437 | * @ticket 49037 |
| 438 | */ |
| 439 | public function test_theme_supports_custom_background() { |
| 440 | remove_theme_support( 'custom-background' ); |
| 441 | $background = array( |
| 442 | 'default-image' => '', |
| 443 | 'default-preset' => 'default', |
| 444 | 'default-position-x' => 'left', |
| 445 | 'default-position-y' => 'top', |
| 446 | 'default-size' => 'auto', |
| 447 | 'default-repeat' => 'repeat', |
| 448 | 'default-attachment' => 'scroll', |
| 449 | 'default-color' => '', |
| 450 | 'wp-head-callback' => '_custom_background_cb', |
| 451 | 'admin-head-callback' => '', |
| 452 | 'admin-preview-callback' => '', |
| 453 | ); |
| 454 | $excluded = array( |
| 455 | 'wp-head-callback', |
| 456 | 'admin-head-callback', |
| 457 | 'admin-preview-callback', |
| 458 | ); |
| 459 | add_theme_support( 'custom-background', $background ); |
| 460 | $response = self::perform_active_theme_request(); |
| 461 | $result = $response->get_data(); |
| 462 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 463 | |
| 464 | $expected = array_diff_key( $background, array_flip( $excluded ) ); |
| 465 | $this->assertEquals( $expected, $result[0]['theme_supports']['custom-background'] ); |
| 466 | } |
| 467 | |
| 468 | /** |
| 469 | * @ticket 49037 |
| 470 | */ |
| 471 | public function test_theme_does_not_support_html5() { |
| 472 | remove_theme_support( 'html5' ); |
| 473 | $response = self::perform_active_theme_request(); |
| 474 | $result = $response->get_data(); |
| 475 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 476 | $this->assertTrue( isset( $result[0]['theme_supports']['html5'] ) ); |
| 477 | $this->assertFalse( $result[0]['theme_supports']['html5'] ); |
| 478 | } |
| 479 | |
| 480 | /** |
| 481 | * @ticket 49037 |
| 482 | */ |
| 483 | public function test_theme_supports_html5() { |
| 484 | remove_theme_support( 'html5' ); |
| 485 | $html5 = array( |
| 486 | 'search-form', |
| 487 | 'comment-form', |
| 488 | 'comment-list', |
| 489 | 'gallery', |
| 490 | 'caption', |
| 491 | 'script', |
| 492 | 'style', |
| 493 | ); |
| 494 | add_theme_support( 'html5', $html5 ); |
| 495 | $response = self::perform_active_theme_request(); |
| 496 | $result = $response->get_data(); |
| 497 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 498 | $this->assertEquals( $html5, $result[0]['theme_supports']['html5'] ); |
| 499 | } |
| 500 | |
| 501 | /** |
| 502 | * @ticket 49037 |
| 503 | */ |
| 504 | public function test_theme_cannot_manage_title_tag() { |
| 505 | remove_theme_support( 'title-tag' ); |
| 506 | $response = self::perform_active_theme_request(); |
| 507 | $result = $response->get_data(); |
| 508 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 509 | $this->assertTrue( isset( $result[0]['theme_supports']['title-tag'] ) ); |
| 510 | $this->assertFalse( $result[0]['theme_supports']['title-tag'] ); |
| 511 | } |
| 512 | |
| 513 | /** |
| 514 | * @ticket 49037 |
| 515 | */ |
| 516 | public function test_theme_can_manage_title_tag() { |
| 517 | global $_wp_theme_features; |
| 518 | $_wp_theme_features['title-tag'] = true; |
| 519 | $response = self::perform_active_theme_request(); |
| 520 | $result = $response->get_data(); |
| 521 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 522 | $this->assertTrue( $result[0]['theme_supports']['title-tag'] ); |
| 523 | } |
| 524 | |
| 525 | /** |
| 526 | * @ticket 49037 |
| 527 | */ |
| 528 | public function test_theme_cannot_manage_selective_refresh_for_widgets() { |
| 529 | remove_theme_support( 'customize-selective-refresh-widgets' ); |
| 530 | $response = self::perform_active_theme_request(); |
| 531 | $result = $response->get_data(); |
| 532 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 533 | $this->assertTrue( isset( $result[0]['theme_supports']['customize-selective-refresh-widgets'] ) ); |
| 534 | $this->assertFalse( $result[0]['theme_supports']['customize-selective-refresh-widgets'] ); |
| 535 | } |
| 536 | |
| 537 | /** |
| 538 | * @ticket 49037 |
| 539 | */ |
| 540 | public function test_theme_can_manage_selective_refresh_for_widgets() { |
| 541 | remove_theme_support( 'customize-selective-refresh-widgets' ); |
| 542 | add_theme_support( 'customize-selective-refresh-widgets' ); |
| 543 | $response = self::perform_active_theme_request(); |
| 544 | $result = $response->get_data(); |
| 545 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 546 | $this->assertTrue( $result[0]['theme_supports']['customize-selective-refresh-widgets'] ); |
| 547 | } |
| 548 | |
| 549 | /** |
| 550 | * @ticket 49037 |
| 551 | */ |
| 552 | public function test_theme_no_wp_block_styles() { |
| 553 | remove_theme_support( 'wp-block-styles' ); |
| 554 | $response = self::perform_active_theme_request(); |
| 555 | $result = $response->get_data(); |
| 556 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 557 | $this->assertTrue( isset( $result[0]['theme_supports']['wp-block-styles'] ) ); |
| 558 | $this->assertFalse( $result[0]['theme_supports']['wp-block-styles'] ); |
| 559 | } |
| 560 | |
| 561 | /** |
| 562 | * @ticket 49037 |
| 563 | */ |
| 564 | public function test_theme_wp_block_styles_optin() { |
| 565 | remove_theme_support( 'wp-block-styles' ); |
| 566 | add_theme_support( 'wp-block-styles' ); |
| 567 | $response = self::perform_active_theme_request(); |
| 568 | $result = $response->get_data(); |
| 569 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 570 | $this->assertTrue( $result[0]['theme_supports']['wp-block-styles'] ); |
| 571 | } |
| 572 | |
| 573 | /** |
| 574 | * @ticket 49037 |
| 575 | */ |
| 576 | public function test_theme_no_align_wide() { |
| 577 | remove_theme_support( 'align-wide' ); |
| 578 | $response = self::perform_active_theme_request(); |
| 579 | $result = $response->get_data(); |
| 580 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 581 | $this->assertTrue( isset( $result[0]['theme_supports']['align-wide'] ) ); |
| 582 | $this->assertFalse( $result[0]['theme_supports']['align-wide'] ); |
| 583 | } |
| 584 | |
| 585 | /** |
| 586 | * @ticket 49037 |
| 587 | */ |
| 588 | public function test_theme_align_wide_optin() { |
| 589 | remove_theme_support( 'align-wide' ); |
| 590 | add_theme_support( 'align-wide' ); |
| 591 | $response = self::perform_active_theme_request(); |
| 592 | $result = $response->get_data(); |
| 593 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 594 | $this->assertTrue( $result[0]['theme_supports']['align-wide'] ); |
| 595 | } |
| 596 | |
| 597 | /** |
| 598 | * @ticket 49037 |
| 599 | */ |
| 600 | public function test_theme_no_editor_styles() { |
| 601 | remove_theme_support( 'editor-styles' ); |
| 602 | $response = self::perform_active_theme_request(); |
| 603 | $result = $response->get_data(); |
| 604 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 605 | $this->assertTrue( isset( $result[0]['theme_supports']['editor-styles'] ) ); |
| 606 | $this->assertFalse( $result[0]['theme_supports']['editor-styles'] ); |
| 607 | } |
| 608 | |
| 609 | /** |
| 610 | * @ticket 49037 |
| 611 | */ |
| 612 | public function test_theme_editor_styles_optin() { |
| 613 | remove_theme_support( 'editor-styles' ); |
| 614 | add_theme_support( 'editor-styles' ); |
| 615 | $response = self::perform_active_theme_request(); |
| 616 | $result = $response->get_data(); |
| 617 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 618 | $this->assertTrue( $result[0]['theme_supports']['editor-styles'] ); |
| 619 | } |
| 620 | |
| 621 | /** |
| 622 | * @ticket 49037 |
| 623 | */ |
| 624 | public function test_theme_no_dark_editor_style() { |
| 625 | remove_theme_support( 'dark-editor-style' ); |
| 626 | $response = self::perform_active_theme_request(); |
| 627 | $result = $response->get_data(); |
| 628 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 629 | $this->assertTrue( isset( $result[0]['theme_supports']['dark-editor-style'] ) ); |
| 630 | $this->assertFalse( $result[0]['theme_supports']['dark-editor-style'] ); |
| 631 | } |
| 632 | |
| 633 | /** |
| 634 | * @ticket 49037 |
| 635 | */ |
| 636 | public function test_theme_dark_editor_style_optin() { |
| 637 | remove_theme_support( 'dark-editor-style' ); |
| 638 | add_theme_support( 'dark-editor-style' ); |
| 639 | $response = self::perform_active_theme_request(); |
| 640 | $result = $response->get_data(); |
| 641 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 642 | $this->assertTrue( $result[0]['theme_supports']['dark-editor-style'] ); |
| 643 | } |
| 644 | |
| 645 | /** |
| 646 | * @ticket 49037 |
| 647 | */ |
| 648 | public function test_theme_no_disable_custom_gradients() { |
| 649 | remove_theme_support( 'disable-custom-gradients' ); |
| 650 | $response = self::perform_active_theme_request(); |
| 651 | $result = $response->get_data(); |
| 652 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 653 | $this->assertTrue( isset( $result[0]['theme_supports']['disable-custom-gradients'] ) ); |
| 654 | $this->assertFalse( $result[0]['theme_supports']['disable-custom-gradients'] ); |
| 655 | } |
| 656 | |
| 657 | /** |
| 658 | * @ticket 49037 |
| 659 | */ |
| 660 | public function test_theme_disable_custom_gradients() { |
| 661 | remove_theme_support( 'disable-custom-gradients' ); |
| 662 | add_theme_support( 'disable-custom-gradients' ); |
| 663 | $response = self::perform_active_theme_request(); |
| 664 | $result = $response->get_data(); |
| 665 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 666 | $this->assertTrue( $result[0]['theme_supports']['disable-custom-gradients'] ); |
| 667 | } |
| 668 | |
| 669 | /** |
| 670 | * @ticket 49037 |
| 671 | */ |
| 672 | public function test_theme_supports_editor_gradient_presets_array() { |
| 673 | remove_theme_support( 'editor-gradient-presets' ); |
| 674 | $gradient = array( |
| 675 | 'name' => __( 'Vivid cyan blue to vivid purple', 'themeLangDomain' ), |
| 676 | 'gradient' => 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)', |
| 677 | 'slug' => 'vivid-cyan-blue-to-vivid-purple', |
| 678 | ); |
| 679 | add_theme_support( 'editor-gradient-presets', array( $gradient ) ); |
| 680 | $response = self::perform_active_theme_request(); |
| 681 | $result = $response->get_data(); |
| 682 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 683 | $this->assertEquals( array( $gradient ), $result[0]['theme_supports']['editor-gradient-presets'] ); |