Exemplo n.º 1
0
 public function testBatch()
 {
     $expected = 'api_key=' . $this->key . '&api_action=batch&api_requestArray=[{"api_action":"linode.create","DatacenterID":"1","PlanID":"1","PaymentTerm":"1"},{"api_action":"linode.create","DatacenterID":"2","PlanID":"1","PaymentTerm":"1"},{"api_action":"linode.create","DatacenterID":"3","PlanID":"1","PaymentTerm":"1"}]';
     $batch = new Batch($this->key);
     $api = new LinodeApi($batch);
     for ($i = 1; $i <= 3; ++$i) {
         $api->create($i, 1, PaymentTerm::ONE_MONTH);
     }
     $result = $batch->execute(true);
     self::assertEquals($expected, $result);
     self::assertFalse($batch->execute(true));
 }
Exemplo n.º 2
0
 public function testWebConsoleToken()
 {
     $LinodeID = mt_rand(1, PHP_INT_MAX);
     $expected = "api_key={$this->key}&api_action=linode.webconsoletoken&LinodeID={$LinodeID}";
     $query = $this->api->webConsoleToken($LinodeID);
     self::assertEquals($expected, $query);
 }