Microweber\tests\ContentTest::testGetProducts PHP Method

testGetProducts() public method

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