Cloudinary\Api::root_folders PHP Method

root_folders() public method

public root_folders ( $options = [] )
    function root_folders($options = array())
    {
        return $this->call_api("get", array("folders"), array(), $options);
    }

Usage Example

Example #1
0
 function test32_folder_listing()
 {
     $this->markTestSkipped("For this test to work, 'Auto-create folders' should be enabled in the Upload Settings, and the account should be empty of folders. Comment out this line if you really want to test it.");
     Uploader::upload(self::LOGO_PNG, array("public_id" => "test_folder1/item"));
     Uploader::upload(self::LOGO_PNG, array("public_id" => "test_folder2/item"));
     Uploader::upload(self::LOGO_PNG, array("public_id" => "test_folder1/test_subfolder1/item"));
     Uploader::upload(self::LOGO_PNG, array("public_id" => "test_folder1/test_subfolder2/item"));
     $result = $this->api->root_folders();
     $this->assertContains(array("name" => "test_folder1", "path" => "test_folder1"), $result["folders"]);
     $this->assertContains(array("name" => "test_folder2", "path" => "test_folder2"), $result["folders"]);
     $result = $this->api->subfolders("test_folder1");
     $this->assertContains(array("name" => "test_subfolder1", "path" => "test_folder1/test_subfolder1"), $result["folders"]);
     $this->assertContains(array("name" => "test_subfolder2", "path" => "test_folder1/test_subfolder2"), $result["folders"]);
 }