ability to delete options
This commit is contained in:
parent
169690082b
commit
8311aa87e6
@ -229,8 +229,12 @@ class PostFixtures {
|
||||
function process_blog_options($options, $categories) {
|
||||
$this->_category = $categories;
|
||||
foreach ($options as $option => $value) {
|
||||
$value = preg_replace_callback('#\$\{([^\}]+)\}#', array(&$this, '_process_blog_options_callback'), $value);
|
||||
update_option($option, $value);
|
||||
if ($value === false) {
|
||||
delete_option($option);
|
||||
} else {
|
||||
$value = preg_replace_callback('#\$\{([^\}]+)\}#', array(&$this, '_process_blog_options_callback'), $value);
|
||||
update_option($option, $value);
|
||||
}
|
||||
}
|
||||
unset($this->_category);
|
||||
}
|
||||
|
@ -272,6 +272,10 @@ class PostFixturesTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
foreach ($expected_fields as $name => $value) {
|
||||
$this->assertEquals($value, get_option($name));
|
||||
if ($value === false) {
|
||||
$all_options = get_alloptions();
|
||||
$this->assertTrue(!isset($all_options[$name]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user