| 204 | * Test when a theme does not disable custom colors. |
| 205 | * |
| 206 | * @ticket 48798 |
| 207 | */ |
| 208 | public function test_theme_supports_disable_custom_colors_false() { |
| 209 | remove_theme_support( 'disable-custom-colors' ); |
| 210 | $response = self::perform_active_theme_request(); |
| 211 | |
| 212 | $result = $response->get_data(); |
| 213 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 214 | $this->assertTrue( isset( $result[0]['theme_supports']['disable-custom-colors'] ) ); |
| 215 | $this->assertFalse( $result[0]['theme_supports']['disable-custom-colors'] ); |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * Test when a theme disables custom colors. |
| 220 | * |
| 221 | * @ticket 48798 |
| 222 | */ |
| 223 | public function test_theme_supports_disable_custom_colors_true() { |
| 224 | remove_theme_support( 'disable-custom-colors' ); |
| 225 | add_theme_support( 'disable-custom-colors' ); |
| 226 | $response = self::perform_active_theme_request(); |
| 227 | $result = $response->get_data(); |
| 228 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 229 | $this->assertTrue( $result[0]['theme_supports']['disable-custom-colors'] ); |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * Test when a theme does not disable custom font sizes. |
| 234 | * |
| 235 | * @ticket 48798 |
| 236 | */ |
| 237 | public function test_theme_supports_disable_custom_font_sizes_false() { |
| 238 | remove_theme_support( 'disable-custom-font-sizes' ); |
| 239 | $response = self::perform_active_theme_request(); |
| 240 | |
| 241 | $result = $response->get_data(); |
| 242 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 243 | $this->assertTrue( isset( $result[0]['theme_supports']['disable-custom-font-sizes'] ) ); |
| 244 | $this->assertFalse( $result[0]['theme_supports']['disable-custom-font-sizes'] ); |
| 245 | } |
| 246 | |
| 247 | /** |
| 248 | * Test when a theme disables custom font sizes. |
| 249 | * |
| 250 | * @ticket 48798 |
| 251 | */ |
| 252 | public function test_theme_supports_disable_custom_font_sizes_true() { |
| 253 | remove_theme_support( 'disable-custom-font-sizes' ); |
| 254 | add_theme_support( 'disable-custom-font-sizes' ); |
| 255 | $response = self::perform_active_theme_request(); |
| 256 | $result = $response->get_data(); |
| 257 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 258 | $this->assertTrue( $result[0]['theme_supports']['disable-custom-font-sizes'] ); |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * Test when a theme doesn't support custom font sizes. |
| 263 | * |
| 264 | * @ticket 48798 |
| 265 | */ |
| 266 | public function test_theme_supports_editor_font_sizes_false() { |
| 267 | remove_theme_support( 'editor-font-sizes' ); |
| 268 | $response = self::perform_active_theme_request(); |
| 269 | |
| 270 | $result = $response->get_data(); |
| 271 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 272 | $this->assertTrue( isset( $result[0]['theme_supports']['editor-font-sizes'] ) ); |
| 273 | $this->assertFalse( $result[0]['theme_supports']['editor-font-sizes'] ); |
| 274 | } |
| 275 | |
| 276 | /** |
| 277 | * Test when a theme supports custom font sizes. |
| 278 | * |
| 279 | * @ticket 48798 |
| 280 | */ |
| 281 | public function test_theme_supports_editor_font_sizes_array() { |
| 282 | remove_theme_support( 'editor-font-sizes' ); |
| 283 | $tiny = array( |
| 284 | 'name' => 'Tiny', |
| 285 | 'size' => 8, |
| 286 | 'slug' => 'tiny', |
| 287 | ); |
| 288 | add_theme_support( 'editor-font-sizes', array( $tiny ) ); |
| 289 | $response = self::perform_active_theme_request(); |
| 290 | |
| 291 | $result = $response->get_data(); |
| 292 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 293 | $this->assertEquals( array( $tiny), $result[0]['theme_supports']['editor-font-sizes'] ); |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * Test when a theme doesn't support a custom color palette. |
| 298 | * |
| 299 | * @ticket 48798 |
| 300 | */ |
| 301 | public function test_theme_supports_editor_color_palette_false() { |
| 302 | remove_theme_support( 'editor-color-palette' ); |
| 303 | $response = self::perform_active_theme_request(); |
| 304 | |
| 305 | $result = $response->get_data(); |
| 306 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 307 | $this->assertTrue( isset( $result[0]['theme_supports']['editor-color-palette'] ) ); |
| 308 | $this->assertFalse( $result[0]['theme_supports']['editor-color-palette'] ); |
| 309 | } |
| 310 | |
| 311 | /** |
| 312 | * Test when a theme supports a custom color palette. |
| 313 | * |
| 314 | * @ticket 48798 |
| 315 | */ |
| 316 | public function test_theme_supports_editor_color_palette_array() { |
| 317 | remove_theme_support( 'editor-color-palette' ); |
| 318 | $wordpress_blue = array( |
| 319 | 'name' => 'WordPress Blue', |
| 320 | 'slug' => 'wordpress-blue', |
| 321 | 'color' => '#0073AA', |
| 322 | ); |
| 323 | add_theme_support( 'editor-color-palette', array( $wordpress_blue ) ); |
| 324 | $response = self::perform_active_theme_request(); |
| 325 | |
| 326 | $result = $response->get_data(); |
| 327 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 328 | $this->assertEquals( array( $wordpress_blue), $result[0]['theme_supports']['editor-color-palette'] ); |
| 329 | } |
| 330 | |
| 331 | /** |
| 332 | * Test when a theme enables automatic feed links. |
| 333 | * |
| 334 | * @ticket 49037 |
| 335 | */ |
| 336 | public function test_theme_supports_enable_automatic_feed_links() { |
| 337 | remove_theme_support( 'automatic-feed-links' ); |
| 338 | add_theme_support( 'automatic-feed-links' ); |
| 339 | $response = self::perform_active_theme_request(); |
| 340 | $result = $response->get_data(); |
| 341 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 342 | $this->assertTrue( $result[0]['theme_supports']['automatic-feed-links'] ); |
| 343 | } |
| 344 | |
| 345 | /** |
| 346 | * Test when a theme does not enable automatic feed links. |
| 347 | * |
| 348 | * @ticket 49037 |
| 349 | */ |
| 350 | public function test_theme_supports_does_not_enable_automatic_feed_links() { |
| 351 | remove_theme_support( 'automatic-feed-links' ); |
| 352 | $response = self::perform_active_theme_request(); |
| 353 | |
| 354 | $result = $response->get_data(); |
| 355 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 356 | $this->assertTrue( isset( $result[0]['theme_supports']['automatic-feed-links'] ) ); |
| 357 | $this->assertFalse( $result[0]['theme_supports']['automatic-feed-links'] ); |
| 358 | } |
| 359 | |
| 360 | /** |
| 361 | * Test when a theme doesn't support a custom logo. |
| 362 | * |
| 363 | * @ticket 49037 |
| 364 | */ |
| 365 | public function test_theme_does_not_support_custom_logo() { |
| 366 | remove_theme_support( 'custom-logo' ); |
| 367 | $response = self::perform_active_theme_request(); |
| 368 | |
| 369 | $result = $response->get_data(); |
| 370 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 371 | $this->assertTrue( isset( $result[0]['theme_supports']['custom-logo'] ) ); |
| 372 | $this->assertFalse( $result[0]['theme_supports']['custom-logo'] ); |
| 373 | } |
| 374 | |
| 375 | /** |
| 376 | * Test when a theme supports a custom logo. |
| 377 | * |
| 378 | * @ticket 49037 |
| 379 | */ |
| 380 | public function test_theme_supports_custom_logo() { |
| 381 | remove_theme_support( 'custom-logo' ); |
| 382 | $wordpress_logo = array( |
| 383 | 'height' => 100, |
| 384 | 'width' => 400, |
| 385 | 'flex-height' => true, |
| 386 | 'flex-width' => true, |
| 387 | 'header-text' => array( 'site-title', 'site-description' ), |
| 388 | ); |
| 389 | add_theme_support( 'custom-logo', $wordpress_logo ); |
| 390 | $response = self::perform_active_theme_request(); |
| 391 | |
| 392 | $result = $response->get_data(); |
| 393 | $this->assertTrue( isset( $result[0]['theme_supports'] ) ); |
| 394 | $this->assertEquals( $wordpress_logo, $result[0]['theme_supports']['custom-logo'] ); |
| 395 | } |
| 396 | |
| 397 | /** |