function test_separator_output() { $output = P2P_List_Renderer::render(self::$list, array('separator' => __FUNCTION__, 'echo' => false)); $this->assertNotEmpty($output); // 'separator' should appear n-1 times in the output $this->assertEquals(count(self::$list->items) - 1, self::count_occurences($output, __FUNCTION__)); // 'before_list' and 'after_list' should be ignored $this->assertStringStartsNotWith('<ul>', $output); $this->assertStringEndsNotWith('</ul>', $output); }
/** * List some items. * * @param object|array A P2P_List instance, a WP_Query instance, or a list of post objects * @param array $args (optional) */ function p2p_list_posts($posts, $args = array()) { if (is_a($posts, 'P2P_List')) { $list = $posts; } else { if (is_a($posts, 'WP_Query')) { $posts = $posts->posts; } $list = new P2P_List($posts, 'P2P_Item_Post'); } return P2P_List_Renderer::render($list, $args); }