コード例 #1
0
ファイル: Config.php プロジェクト: ramon/cloudcaster-php
 public function testSeUmaAuthKeyNaoForConfiguraUmaDeveraSerRequisitadaViaAPI()
 {
     $this->assertEquals(
         CloudCaster\Config::getAuthKey(),
         "mock"
     );
 }
コード例 #2
0
ファイル: test.php プロジェクト: ramon/cloudcaster-php
<?php
require '../lib/cloudcaster.php';

CloudCaster\Config::set(function($v) {
    $v->client_code = "sandbox";
    $v->appid       = "abc";
    $v->appkey      = "def";
});

print "AUTH\r\n";
try {
    $auth = new CloudCaster\Auth();
    print $auth->getAuthKey(); print "\n\r";
} catch (CloudCaster\NotExistsException $e) {
    print $e->getMessage();
} catch (CloudCaster\AuthFailedException $e) {
    print $e->getMessage();
}

print "\r\nCATEGORIES - 2 Resultados Esperado\r\n";
$category = new CloudCaster\Category();
$categories = $category->find_all(array('limit' => 2));

foreach($categories as $c) {
    print $c->name; print "\n\r";
}

print "\r\nCATEGORIA\r\n";
$c = $category->find(2);
print $c->name; print "\n\r";