Пример #1
0
 protected function setUp()
 {
     $host = getenv('REMOTE_HOST');
     $login = getenv('REMOTE_LOGIN');
     $password = getenv('REMOTE_PASSWORD');
     $this->_client = new PleskX\Api\Client($host);
     $this->_client->setCredentials($login, $password);
 }
Пример #2
0
 /**
  * @expectedException \PleskX\Api\Exception
  * @expectedExceptionCode 11003
  */
 public function testInvalidSecretKey()
 {
     $host = getenv('REMOTE_HOST');
     $client = new PleskX\Api\Client($host);
     $client->setSecretKey('bad-key');
     $packet = $this->_client->getPacket();
     $packet->addChild('server')->addChild('get_protos');
     $client->request($packet);
 }
Пример #3
0
<?php

// Copyright 1999-2016. Parallels IP Holdings GmbH.
set_include_path(get_include_path() . ':src');
function autoload($className)
{
    $path = str_replace('\\', DIRECTORY_SEPARATOR, $className);
    include $path . '.php';
}
spl_autoload_register('autoload');
if ($executionLogFile = getenv('EXECUTION_LOG')) {
    PleskX\Api\Client::enableExecutionLog();
    register_shutdown_function(function () use($executionLogFile) {
        $executionLog = PleskX\Api\Client::getExecutionLog();
        file_put_contents($executionLogFile, json_encode($executionLog));
    });
}
Пример #4
0
 public function testGetProtocol()
 {
     $client = new \PleskX\Api\Client('example.dom', 8880, 'http');
     $this->assertEquals('http', $client->getProtocol());
 }
Пример #5
0
 /**
  * @expectedException \PleskX\Api\Client\Exception
  */
 public function testConnectionError()
 {
     $client = new \PleskX\Api\Client('invalid-host.dom');
     $client->server()->getProtos();
 }
Пример #6
0
 /**
  * @param string $name
  * @return \PleskX\Api\Struct\Webspace\Info
  */
 protected static function _createWebspace($name)
 {
     return static::$_client->webspace()->create(['name' => $name, 'ip_address' => static::_getIpAddress()], ['ftp_login' => 'test-login', 'ftp_password' => 'test-password']);
 }