Changeset 51817 for trunk/tests/phpunit/tests/option/option.php
- Timestamp:
- 09/15/2021 09:21:58 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/option/option.php
r48996 r51817 90 90 /** 91 91 * @ticket 23289 92 * 93 * @dataProvider data_bad_option_names 94 * 95 * @param mixed $option_name Option name. 92 96 */ 93 function test_bad_option_names() { 94 foreach ( array( '', '0', ' ', 0, false, null ) as $empty ) { 95 $this->assertFalse( get_option( $empty ) ); 96 $this->assertFalse( add_option( $empty, '' ) ); 97 $this->assertFalse( update_option( $empty, '' ) ); 98 $this->assertFalse( delete_option( $empty ) ); 99 } 97 public function test_get_option_bad_option_name( $option_name ) { 98 $this->assertFalse( get_option( $option_name ) ); 99 } 100 101 /** 102 * @ticket 23289 103 * 104 * @dataProvider data_bad_option_names 105 * 106 * @param mixed $option_name Option name. 107 */ 108 public function test_add_option_bad_option_name( $option_name ) { 109 $this->assertFalse( add_option( $option_name, '' ) ); 110 } 111 112 /** 113 * @ticket 23289 114 * 115 * @dataProvider data_bad_option_names 116 * 117 * @param mixed $option_name Option name. 118 */ 119 public function test_update_option_bad_option_name( $option_name ) { 120 $this->assertFalse( update_option( $option_name, '' ) ); 121 } 122 123 /** 124 * @ticket 23289 125 * 126 * @dataProvider data_bad_option_names 127 * 128 * @param mixed $option_name Option name. 129 */ 130 public function test_delete_option_bad_option_name( $option_name ) { 131 $this->assertFalse( delete_option( $option_name ) ); 132 } 133 134 /** 135 * Data provider. 136 * 137 * @return array 138 */ 139 public function data_bad_option_names() { 140 return array( 141 'empty string' => array( '' ), 142 'string 0' => array( '0' ), 143 'string single space' => array( ' ' ), 144 'integer 0' => array( 0 ), 145 'float 0.0' => array( 0.0 ), 146 'boolean false' => array( false ), 147 'null' => array( null ), 148 ); 100 149 } 101 150
Note: See TracChangeset
for help on using the changeset viewer.