private function _createuser() { $result = $this->_api->createUser($this->_userName, $this->_email, $this->_password); $imap = new CCImap($this->_email, $this->_imapPassword); $activationCode = $imap->getNewestActivationCode(); $this->_api->activateUser($this->_userName, $activationCode); $this->_api->createAndSetToken($this->_email, $this->_password); }
public function testGetAllAddonList() { $result = self::$_api->getAllAddonList(); foreach ($result as $addonInfo) { if (strpos($addonInfo->name, 'mysql') !== false) { $this->assertEquals('mysql', $addonInfo->name); $this->assertEquals('mysql.free', $addonInfo->options[0]->name); } if (strpos($addonInfo->name, 'alias') !== false) { $this->assertEquals('alias', $addonInfo->name); $this->assertEquals('alias.free', $addonInfo->options[0]->name); } } }
<?php include_once 'phpcclib.php'; $applicationName = "worker"; $deploymentName = "default"; $userEmail = "*****@*****.**"; $userPassword = "******"; $workerFilePath = "worker.php"; /** * pay attention, your worker have to run at least one second * you can run your worker in infinite loop ( while(true){...} ) * or exit with exitcodes 0 (success) or 2 (failure) */ $api = new CCAPI(); $api->createAndSetToken($userEmail, $userPassword); /* add the worker addon, if you haven't already */ $result = $api->addAddon($applicationName, $deploymentName, 'worker.free'); print_r($result); /* add a worker */ $workerDetail = $api->addWorker($applicationName, $deploymentName, $workerFilePath); print_r($workerDetail); /* get workers details */ $workerDetail = $api->getWorkerDetails($applicationName, $deploymentName, $workerDetail->wrk_id); print_r($workerDetail); /* get workers list */ $workerList = $api->getWorkerList($applicationName, $deploymentName); foreach ($workerList as $worker) { /* remove worker */ $api->removeWorker($applicationName, $deploymentName, $worker->wrk_id); }