forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththemeMods.php
More file actions
35 lines (28 loc) · 906 Bytes
/
themeMods.php
File metadata and controls
35 lines (28 loc) · 906 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
<?php
/**
* @group option
*/
class Tests_Option_Theme_Mods extends WP_UnitTestCase {
function test_theme_mod_default() {
$this->assertEquals( '', get_theme_mod( 'non_existent' ) );
}
function test_theme_mod_defined_default() {
$this->assertEquals( 'default', get_theme_mod( 'non_existent', 'default' ) );
}
function test_theme_mod_set() {
$expected = 'value';
set_theme_mod( 'test_name', $expected );
$this->assertEquals( $expected, get_theme_mod( 'test_name' ) );
}
function test_theme_mod_update() {
set_theme_mod( 'test_update', 'first_value' );
$expected = 'updated_value';
set_theme_mod( 'test_update', $expected );
$this->assertEquals( $expected, get_theme_mod( 'test_update' ) );
}
function test_theme_mod_remove() {
set_theme_mod( 'test_remove', 'value' );
remove_theme_mod( 'test_remove' );
$this->assertEquals( '', get_theme_mod( 'test_remove' ) );
}
}