setCredentials($login, $password); if ($proxy = getenv('REMOTE_PROXY')) { static::$_client->setProxy($proxy); } } public static function tearDownAfterClass(): void { foreach (self::$webspaces as $webspace) { try { static::$_client->webspace()->delete('id', $webspace->id); } catch (\Exception $e) { } } foreach (self::$servicePlans as $servicePlan) { try { static::$_client->servicePlan()->delete('id', $servicePlan->id); } catch (\Exception $e) { } } } /** * @return string */ protected static function _getIpAddress() { $ips = static::$_client->ip()->get(); $ipInfo = reset($ips); return $ipInfo->ipAddress; } /** * @return \PleskX\Api\Struct\Webspace\Info */ protected static function _createWebspace() { $id = uniqid(); $webspace = static::$_client->webspace()->create( [ 'name' => "test{$id}.test", 'ip_address' => static::_getIpAddress(), ], [ 'ftp_login' => "u{$id}", 'ftp_password' => PasswordProvider::STRONG_PASSWORD, ] ); self::$webspaces[] = $webspace; return $webspace; } protected static function _createServicePlan() { $id = uniqid(); $servicePlan = static::$_client->servicePlan()->create(['name' => "test{$id}plan"]); self::$servicePlans[] = $servicePlan; return $servicePlan; } }