Inheritance: extends ApiSetup
Exemplo n.º 1
0
 public function __construct()
 {
     $this->model_class = "App\\Role";
     $this->model_short = 'Role';
     $this->friendly_identifier = 'name';
     parent::__construct();
 }
Exemplo n.º 2
0
 public function __construct()
 {
     $this->model_class = "App\\User";
     $this->model_short = 'User';
     $this->friendly_identifier = 'username';
     parent::__construct();
 }
 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.º 4
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"))));
 }
Exemplo n.º 5
0
 public static function setUpBeforeClass()
 {
     self::$browserstackApi = new Api('phpunit', 'phpunit');
 }
Exemplo n.º 6
0
        // the child token should also have 1 child, which should be its actual
        // text, i.e. a string with the contents 'text'
        assert($top['children'][0]['token_name'] === 'child');
        assert(count($top['children'][0]['children']) === 1);
        assert($top['children'][0]['children'][0] === 'text');
        // now let's pop, and we should be back to the initial state
        $this->popState();
        $top = $this->getTopToken();
        assert($top['token_name'] === 'initial');
        // now let's test that we can't pop the initial state
        $exception = false;
        try {
            $this->popState();
        } catch (Exception $e) {
            $exception = true;
        }
        assert($exception);
        $top = $this->getTopToken();
        // now record some text into the initial state's child array
        $c = count($top['children']);
        $this->record('some text');
        $top = $this->getTopToken();
        $c1 = count($top['children']);
        assert($c + 1 === $c1);
        assert($top['children'][$c1 - 1] === 'some text');
    }
}
$t = new LanguageTest();
$t->test();
$t = new ApiTest();
$t->test();
Exemplo n.º 7
0
 public function testQuote()
 {
     if (self::$_photoUrl) {
         $endpoint = 'api/rest/customconfigurable/quote';
         $url = $this->_callbackUrl . $endpoint;
         $options = $this->_model->getOptions();
         $params = array();
         foreach ($options as $code => $option) {
             if ($option['required']) {
                 $value = reset($option['values']);
                 $params[$code] = (int) $value['id'];
             }
         }
         $params[$this->_photoCode] = self::$_photoUrl;
         $data = json_encode($params);
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_POST, true);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
         curl_setopt($ch, CURLOPT_HEADER, 1);
         curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data)));
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         $response = curl_exec($ch);
         $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
         $headerStr = substr($response, 0, $headerSize);
         $headersAr = Mage::helper('aydus_customconfigurable')->getHeadersArray($headerStr);
         curl_close($ch);
         $gotLocation = false;
         if (is_array($headersAr) && count($headersAr) > 0) {
             $location = '';
             foreach ($headersAr as $headerAr) {
                 foreach ($headerAr as $headerKey => $headerValue) {
                     if ($headerKey == 'Location') {
                         $location = $headerValue;
                         $parsedUrlAr = parse_url($location);
                         if (is_array($parsedUrlAr) && count($parsedUrlAr) > 0) {
                             if (is_numeric(strpos($location, $url))) {
                                 $gotLocation = true;
                             }
                         }
                     }
                 }
             }
         }
         $this->assertTrue($gotLocation);
         $hash = substr($location, strlen($url) + 1);
         $hash = substr($hash, 0, -1);
         $getQuoteUrl = $url . '/' . $hash;
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $getQuoteUrl);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         $response = curl_exec($ch);
         curl_close($ch);
         $params = json_decode($response, true);
         $this->assertEquals($hash, $params['hash']);
         $quoteId = (int) $params['quote'];
         $gotQuote = $quoteId > 0 ? true : false;
         $this->assertTrue($gotQuote);
         self::$_quoteId = $quoteId;
     }
 }
Exemplo n.º 8
0
 public static function setUpBeforeClass()
 {
     $init = new \Chicoco\Init();
     $_SERVER['REQUEST_URI'] = '';
     self::$api = new apiController();
 }