function sandwich_tag_cloud_widget() { add_shortcode('pbs_tag_cloud_widget', 'sandwich_tag_cloud_widget_shortcode'); // Check if Shortcake exists if (!function_exists('shortcode_ui_register_for_shortcode')) { return; } if (!is_admin()) { return; } shortcode_ui_register_for_shortcode('pbs_tag_cloud_widget', array('label' => __('Widget - Tag Cloud', 'pbsandwich'), 'listItemImage' => 'dashicons-wordpress', 'attrs' => array(array('label' => __('Title', 'pbsandwich'), 'attr' => 'title', 'type' => 'text', 'value' => __('Tag Cloud', 'pbsandwich'), 'description' => __('The title to display for this widget', 'pbsandwich')), array('label' => __('Taxonomy', 'pbsandwich'), 'attr' => 'taxonomy', 'type' => 'select', 'value' => '', 'options' => sandwich_functions_taxonomy_list('tag'))))); }
function testReturns() { // replace this with some actual testing code $this->assertInternalType('array', sandwich_functions_display_order()); $this->assertInternalType('array', sandwich_functions_display_dir()); $this->assertInternalType('array', sandwich_functions_posttype_list('post')); $this->assertCount(1, sandwich_functions_posttype_list('post'), 'Should have the first element as the "select one" element'); $this->factory->post->create(); $this->assertCount(2, sandwich_functions_posttype_list('post')); $this->factory->post->create_many(8); $this->assertCount(10, sandwich_functions_posttype_list('post')); $this->assertInternalType('array', sandwich_functions_taxonomy_list()); $this->assertInternalType('array', sandwich_functions_term_list('invalid_term'), 'Invalid taxonomy should not error'); $this->assertInternalType('array', sandwich_functions_term_list('post_tag')); $this->assertCount(1, sandwich_functions_term_list('post_tag')); }