示例#1
0
 public function testSetter()
 {
     $s = new Secret();
     $s->setUsername(TEST_API_USERNAME);
     $s->setPassword(TEST_API_PASSWORD);
     $s->setTenantName(TEST_API_TENANT_NAME);
     $s->setTenantId(TEST_API_TENANT_ID);
     $s->setAuthUrl(TEST_IDENTITY_ENDPOINT);
     $this->assertEquals(TEST_API_USERNAME, $s->getUsername());
     $this->assertEquals(TEST_API_PASSWORD, $s->getPassword());
     $this->assertEquals(TEST_API_TENANT_NAME, $s->getTenantName());
     $this->assertEquals(TEST_API_TENANT_ID, $s->getTenantId());
     $this->assertEquals(TEST_IDENTITY_ENDPOINT, $s->getAuthUrl());
 }
示例#2
0
function __get_test_access()
{
    static $access;
    if (!$access) {
        $secret = new Secret();
        $secret->setUsername(TEST_API_USERNAME);
        $secret->setPassword(TEST_API_PASSWORD);
        $secret->setTenantName(TEST_API_TENANT_NAME);
        $secret->setTenantId(TEST_API_TENANT_ID);
        $secret->setAuthUrl(TEST_IDENTITY_ENDPOINT);
        $c = new ConoHa();
        $access = $c->auth($secret);
    }
    return $access;
}