Changeset 52010 for trunk/tests/phpunit/tests/option/siteOption.php
- Timestamp:
- 11/04/2021 03:22:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/option/siteOption.php
r48937 r52010 5 5 */ 6 6 class Tests_Option_SiteOption extends WP_UnitTestCase { 7 function __return_foo() {7 public function __return_foo() { 8 8 return 'foo'; 9 9 } 10 10 11 function test_get_site_option_returns_false_if_option_does_not_exist() {11 public function test_get_site_option_returns_false_if_option_does_not_exist() { 12 12 $this->assertFalse( get_site_option( 'doesnotexist' ) ); 13 13 } 14 14 15 function test_get_site_option_returns_false_after_deletion() {15 public function test_get_site_option_returns_false_after_deletion() { 16 16 $key = __FUNCTION__; 17 17 $value = __FUNCTION__; … … 21 21 } 22 22 23 function test_get_site_option_returns_value() {23 public function test_get_site_option_returns_value() { 24 24 $key = __FUNCTION__; 25 25 $value = __FUNCTION__; … … 28 28 } 29 29 30 function test_get_site_option_returns_updated_value() {30 public function test_get_site_option_returns_updated_value() { 31 31 $key = __FUNCTION__; 32 32 $value = __FUNCTION__ . '_1'; … … 37 37 } 38 38 39 function test_get_site_option_does_not_exist_returns_filtered_default_with_no_default_provided() {39 public function test_get_site_option_does_not_exist_returns_filtered_default_with_no_default_provided() { 40 40 add_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) ); 41 41 $site_option = get_site_option( 'doesnotexist' ); … … 44 44 } 45 45 46 function test_get_site_option_does_not_exist_returns_filtered_default_with_default_provided() {46 public function test_get_site_option_does_not_exist_returns_filtered_default_with_default_provided() { 47 47 add_filter( 'default_site_option_doesnotexist', array( $this, '__return_foo' ) ); 48 48 $site_option = get_site_option( 'doesnotexist', 'bar' ); … … 51 51 } 52 52 53 function test_get_site_option_does_not_exist_returns_provided_default() {53 public function test_get_site_option_does_not_exist_returns_provided_default() { 54 54 $this->assertSame( 'bar', get_site_option( 'doesnotexist', 'bar' ) ); 55 55 } 56 56 57 function test_get_site_option_exists_does_not_return_provided_default() {57 public function test_get_site_option_exists_does_not_return_provided_default() { 58 58 $key = __FUNCTION__; 59 59 $value = __FUNCTION__; … … 62 62 } 63 63 64 function test_get_site_option_exists_does_not_return_filtered_default() {64 public function test_get_site_option_exists_does_not_return_filtered_default() { 65 65 $key = __FUNCTION__; 66 66 $value = __FUNCTION__; … … 72 72 } 73 73 74 function test_add_site_option_returns_true_for_new_option() {74 public function test_add_site_option_returns_true_for_new_option() { 75 75 $key = __FUNCTION__; 76 76 $value = __FUNCTION__; … … 78 78 } 79 79 80 function test_add_site_option_returns_false_for_existing_option() {80 public function test_add_site_option_returns_false_for_existing_option() { 81 81 $key = __FUNCTION__; 82 82 $value = __FUNCTION__; … … 85 85 } 86 86 87 function test_update_site_option_returns_false_for_same_value() {87 public function test_update_site_option_returns_false_for_same_value() { 88 88 $key = __FUNCTION__; 89 89 $value = __FUNCTION__; … … 92 92 } 93 93 94 function test_update_site_option_returns_true_for_new_value() {94 public function test_update_site_option_returns_true_for_new_value() { 95 95 $key = 'key'; 96 96 $value = 'value1'; … … 100 100 } 101 101 102 function test_delete_site_option_returns_true_if_option_exists() {102 public function test_delete_site_option_returns_true_if_option_exists() { 103 103 $key = __FUNCTION__; 104 104 $value = __FUNCTION__; … … 107 107 } 108 108 109 function test_delete_site_option_returns_false_if_option_does_not_exist() {109 public function test_delete_site_option_returns_false_if_option_does_not_exist() { 110 110 $key = __FUNCTION__; 111 111 $value = __FUNCTION__; … … 115 115 } 116 116 117 function test_site_option_add_and_get_serialized_array() {117 public function test_site_option_add_and_get_serialized_array() { 118 118 $key = __FUNCTION__; 119 119 $value = array( … … 125 125 } 126 126 127 function test_site_option_add_and_get_serialized_object() {127 public function test_site_option_add_and_get_serialized_object() { 128 128 $key = __FUNCTION__; 129 129 $value = new stdClass(); … … 139 139 * @ticket 15497 140 140 */ 141 function test_update_adds_falsey_value() {141 public function test_update_adds_falsey_value() { 142 142 $key = __FUNCTION__; 143 143 $value = 0; … … 154 154 * @ticket 18955 155 155 */ 156 function test_get_doesnt_cache_default_value() {156 public function test_get_doesnt_cache_default_value() { 157 157 $option = __FUNCTION__; 158 158 $default = 'a default';
Note: See TracChangeset
for help on using the changeset viewer.