ability to delete options

This commit is contained in:
John Bintz 2010-01-14 15:42:45 -05:00
parent 169690082b
commit 8311aa87e6
2 changed files with 10 additions and 2 deletions

View File

@ -229,8 +229,12 @@ class PostFixtures {
function process_blog_options($options, $categories) { function process_blog_options($options, $categories) {
$this->_category = $categories; $this->_category = $categories;
foreach ($options as $option => $value) { foreach ($options as $option => $value) {
$value = preg_replace_callback('#\$\{([^\}]+)\}#', array(&$this, '_process_blog_options_callback'), $value); if ($value === false) {
update_option($option, $value); delete_option($option);
} else {
$value = preg_replace_callback('#\$\{([^\}]+)\}#', array(&$this, '_process_blog_options_callback'), $value);
update_option($option, $value);
}
} }
unset($this->_category); unset($this->_category);
} }

View File

@ -272,6 +272,10 @@ class PostFixturesTest extends PHPUnit_Framework_TestCase {
foreach ($expected_fields as $name => $value) { foreach ($expected_fields as $name => $value) {
$this->assertEquals($value, get_option($name)); $this->assertEquals($value, get_option($name));
if ($value === false) {
$all_options = get_alloptions();
$this->assertTrue(!isset($all_options[$name]));
}
} }
} }
} }