From 8311aa87e65eb4d7427fc9ab1af923fefa286707 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Thu, 14 Jan 2010 15:42:45 -0500 Subject: [PATCH] ability to delete options --- classes/PostFixtures.inc | 8 ++++++-- test/PostFixturesTest.php | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/classes/PostFixtures.inc b/classes/PostFixtures.inc index 095f42a..022b1c5 100644 --- a/classes/PostFixtures.inc +++ b/classes/PostFixtures.inc @@ -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); } diff --git a/test/PostFixturesTest.php b/test/PostFixturesTest.php index 93275a2..6d0089b 100644 --- a/test/PostFixturesTest.php +++ b/test/PostFixturesTest.php @@ -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])); + } } } }