From bddf7c76ece52c65f41460fd4e30b882ad2304b0 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sun, 30 Aug 2015 03:42:49 +0000 Subject: [PATCH] Add some theme mod unit tests. Props MikeHansenMe. See #28637. git-svn-id: https://develop.svn.wordpress.org/trunk@33812 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/option/themeMods.php | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/phpunit/tests/option/themeMods.php diff --git a/tests/phpunit/tests/option/themeMods.php b/tests/phpunit/tests/option/themeMods.php new file mode 100644 index 0000000000..8bd8f5d85c --- /dev/null +++ b/tests/phpunit/tests/option/themeMods.php @@ -0,0 +1,35 @@ +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' ) ); + } + +}