Microweber\tests\ContentTest::testPosts PHP Method

testPosts() public method

public testPosts ( )
    public function testPosts()
    {
        $params = array('title' => 'this-is-my-test-post', 'content_type' => 'post', 'is_active' => 1);
        //saving
        $save_post = save_content($params);
        //getting
        $get_post = get_content($params);
        foreach ($get_post as $item) {
            $del_params = array('id' => $item['id'], 'forever' => true);
            //delete content
            $delete = delete_content($del_params);
            //check if deleted
            $content = get_content_by_id($item['id']);
            //PHPUnit
            $this->assertEquals(true, is_array($delete));
            $this->assertEquals(false, $content);
            $this->assertEquals('this-is-my-test-post', $item['title']);
        }
        //PHPUnit
        $this->assertEquals(true, $save_post);
        $this->assertEquals(true, is_array($get_post));
    }