/** * @dataProvider providerTestWidget */ function testWidget($instance, $expected_xpath, $is_home = false) { global $post; $post = (object) array('ID' => 1, 'guid' => 'Post url'); wp_insert_post($post); $w = new ComicPressBookmarkWidget(); _set_bloginfo('url', 'Blog url'); _set_current_option('is_home', $is_home); ob_start(); $w->widget(array('before_widget' => '', 'after_widget' => '', 'before_title' => '<p>', 'after_title' => '</p>'), $instance); $content = ob_get_clean(); $this->assertTrue(($xml = _to_xml($content, true)) !== false); foreach ($expected_xpath as $xpath => $value) { $this->assertTrue(_xpath_test($xml, $xpath, $value), $xpath); } }
function testEnsureValidURIInvalidType() { _set_bloginfo('url', 'wordpress'); $cpmh = $this->getMock('ComicPressMediaHandling', array('_bundle_global_variables')); $cpmh->expects($this->any())->method('_bundle_global_variables')->will($this->returnValue(array('comic' => 'comic-dir'))); $this->assertEquals('', $cpmh->_ensure_valid_uri('%type-folder%', 'test')); }