function test_xhtml_mode_set_by_upgrade() { // set pre-upgrade options $this->update_theme_option($this->pre_upgrade_opt); // run upgrade routine - function is hooked to admin_init thematic_opt_init(); $this->assertEquals('right-sidebar', thematic_get_theme_opt('layout')); $this->assertTrue(thematic_is_legacy_xhtml()); $this->delete_theme_option(); }
function test_thematic_opt_init_upgrade_from_v1() { /* filter the validation so the old theme options will save */ add_filter('thematic_theme_opt_validation', array($this, 'upgrade_pre_v2_validation')); $previous_defaults = array('index_insert' => 2, 'author_info' => 0, 'footer_txt' => 'Powered by [wp-link]. Built on the [theme-link].', 'del_legacy_opt' => 0); add_option('thematic_theme_opt', $previous_defaults); /* Theme options now equals the 1.0.4 defaults */ $this->assertEquals($previous_defaults, get_option('thematic_theme_opt'), 'Theme options should be 1.x defaults'); /* reset the validation filter */ remove_filter('thematic_theme_opt_validation', array($this, 'upgrade_pre_v2_validation')); /* Run upgrading routine */ thematic_opt_init(); $new_options = get_option('thematic_theme_opt'); $this->assertArrayHasKey('layout', $new_options); $this->assertEquals($new_options['legacy_xhtml'], 1, 'Theme options should set xhtml mode to true'); }