public static function setUpBeforeClass()
 {
     if (Cloudinary::config_get("api_secret")) {
         $api = new \Cloudinary\Api();
         self::delete_resources($api);
         self::delete_transformations($api);
         self::delete_presets($api);
         self::$timestamp_tag = "api_test_tag_" . time();
         self::upload_sample_resources();
     } else {
         self::markTestSkipped('Please setup environment for Api test to run');
     }
 }
Exemplo n.º 2
0
 public function setUp()
 {
     if (!Cloudinary::config_get("api_secret")) {
         $this->markTestSkipped('Please setup environment for API test to run');
     }
     $this->api = new \Cloudinary\Api();
     if (self::$initialized) {
         return;
     }
     self::$initialized = TRUE;
     try {
         $this->api->delete_resources(array("api_test", "api_test2", "api_test3", "api_test5"));
     } catch (Exception $e) {
     }
     try {
         $this->api->delete_transformation("api_test_transformation");
     } catch (Exception $e) {
     }
     try {
         $this->api->delete_transformation("api_test_transformation2");
     } catch (Exception $e) {
     }
     try {
         $this->api->delete_transformation("api_test_transformation3");
     } catch (Exception $e) {
     }
     try {
         $this->api->delete_transformation("api_test_upload_preset");
     } catch (Exception $e) {
     }
     try {
         $this->api->delete_transformation("api_test_upload_preset2");
     } catch (Exception $e) {
     }
     try {
         $this->api->delete_transformation("api_test_upload_preset3");
     } catch (Exception $e) {
     }
     try {
         $this->api->delete_transformation("api_test_upload_preset4");
     } catch (Exception $e) {
     }
     self::$timestamp_tag = "api_test_tag_" . time();
     \Cloudinary\Uploader::upload("tests/logo.png", array("public_id" => "api_test", "tags" => array("api_test_tag", self::$timestamp_tag), "context" => "key=value", "eager" => array("transformation" => array("width" => 100, "crop" => "scale"))));
     \Cloudinary\Uploader::upload("tests/logo.png", array("public_id" => "api_test2", "tags" => array("api_test_tag", self::$timestamp_tag), "context" => "key=value", "eager" => array("transformation" => array("width" => 100, "crop" => "scale"))));
 }