| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @group option |
| 5 | */ |
| 6 | class Tests_Option_Theme_Mods extends WP_UnitTestCase { |
| 7 | |
| 8 | function test_theme_mod_default() { |
| 9 | $this->assertEquals( '', get_theme_mod( 'non_existent' ) ); |
| 10 | } |
| 11 | |
| 12 | function test_theme_mod_defined_default() { |
| 13 | $this->assertEquals( 'default', get_theme_mod( 'non_existent', 'default' ) ); |
| 14 | } |
| 15 | |
| 16 | function test_theme_mod_set() { |
| 17 | $expected = 'value'; |
| 18 | set_theme_mod( 'test_name', $expected ); |
| 19 | $this->assertEquals( $expected, get_theme_mod( 'test_name' ) ); |
| 20 | } |
| 21 | |
| 22 | function test_theme_mod_update() { |
| 23 | set_theme_mod( 'test_update', 'first_value' ); |
| 24 | $expected = 'updated_value'; |
| 25 | set_theme_mod( 'test_update', $expected ); |
| 26 | $this->assertEquals( $expected, get_theme_mod( 'test_update' ) ); |
| 27 | } |
| 28 | |
| 29 | function test_theme_mod_remove() { |
| 30 | set_theme_mod( 'test_remove', 'value' ); |
| 31 | remove_theme_mod( 'test_remove' ); |
| 32 | $this->assertEquals( '', get_theme_mod( 'test_remove' ) ); |
| 33 | } |
| 34 | |
| 35 | } |