function test_inherit_and_restore_success() { $mods = new Mods($this->parent_slug, array('name1' => 'val1-parent', 'name2' => 'val2-parent'), $this->child_slug, array('name1' => 'val1-child', 'name3' => 'val3-child')); Inherit_theme_mods::set_theme_mods_of($this->parent_slug, $mods->assigned()->parent); Inherit_theme_mods::set_theme_mods_of($this->child_slug, $mods->assigned()->child); switch_theme($this->child_slug); $itm = new Inherit_Theme_Mods(); //test if inheritted $this->assertTrue($itm->inherit()); $this->assertArrayDeepEquals(array('name1' => 'val1-parent', 'name2' => 'val2-parent', 'name3' => 'val3-child'), $mods->actual()->child); // test if automatically stored $this->assertArrayDeepEquals($mods->assigned()->child, $mods->actual()->trashed); //test if restored $this->assertTrue($itm->restore()); $this->assertArrayDeepEquals($mods->assigned()->child, $mods->actual()->child); //clean up. switch_theme($this->parent_slug); foreach ($mods->actual()->parent as $key => $value) { remove_theme_mod($key); } switch_theme($this->child_slug); foreach ($mods->actual()->parent as $key => $value) { remove_theme_mod($key); } }