forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwpSupportsAI.php
More file actions
40 lines (35 loc) · 916 Bytes
/
wpSupportsAI.php
File metadata and controls
40 lines (35 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Tests for wp_supports_ai().
*
* @group ai-client
* @covers ::wp_supports_ai
*/
class Tests_WP_Supports_AI extends WP_UnitTestCase {
/**
* {@inheritDoc}
*/
public function tear_down() {
// Remove the WP_DISABLE_AI constant if it was defined during tests.
remove_all_filters( 'wp_supports_ai' );
parent::tear_down();
}
/**
* Test that wp_supports_ai() defaults to true.
*
* @ticket 64591
*/
public function test_defaults_to_true() {
$this->assertTrue( wp_supports_ai() );
}
/**
* Tests that the wp_supports_ai filter can disable/enable AI features.
*/
public function test_filter_can_disable_ai_features() {
add_filter( 'wp_supports_ai', '__return_false' );
$this->assertFalse( wp_supports_ai() );
// Try a later filter to re-enable AI and confirm that it works.
add_filter( 'wp_supports_ai', '__return_true' );
$this->assertTrue( wp_supports_ai() );
}
}