public function testGetPosts()
{
$params = array('title' => 'My test post is here', 'content_type' => 'post', 'is_active' => 1);
//saving
$new_post_id = save_content($params);
$get_posts = get_posts($params);
$post_found = false;
if (is_array($get_posts)) {
foreach ($get_posts as $post) {
if ($post['id'] == $new_post_id) {
$post_found = true;
$this->assertEquals('post', $post['content_type']);
$this->assertEquals('post', $post['subtype']);
}
//PHPUnit
$this->assertEquals(true, intval($post['id']) > 0);
}
}
//clean
$delete_sub_page = delete_content($new_post_id);
//PHPUnit
$this->assertEquals(true, $post_found);
$this->assertEquals(true, intval($new_post_id) > 0);
$this->assertEquals(true, is_array($get_posts));
$this->assertEquals(true, is_array($delete_sub_page));
}