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) {
|
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);
|
||||||
}
|
}
|
||||||
|
@ -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]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user