<?php
include 'util/test_config.php';
include 'util/string_utils.php';
$api = apiAsSuper();
$rand = generateRandomString();
$server_id = "test-serverId-$rand";
$server_command = new HelixWebServices\Model\ServerCommand([
"server_id" => $server_id,
"description" => "test $server_id",
"type" => "server",
"services" => "standard"
]);
$api->serverServersPost("localhost", $server_command);
$all_servers = $api->serverServersGet('localhost');
$has_serverId_id = array_filter($all_servers, function($b) {
global $server_id;
return $b->getServerId() == $server_id;
});
assert(count($has_serverId_id) == 1);
$saved_server = $api->serverServersServerIdGet('localhost', $server_id);
assert(trim($saved_server->getDescription()) == trim($server_command->getDescription()));
$to_update = new HelixWebServices\Model\ServerCommand([
"description" => "Update $rand"
]);
$api->serverServersServerIdPatch('localhost', $server_id, $to_update);
$updated = $api->serverServersServerIdGet('localhost', $server_id);
assert(trim($updated->getDescription()) == trim($to_update->getDescription()));
$api->serverServersServerIdDelete('localhost', $server_id);
$all_servers2 = $api->serverServersGet('localhost');
if (!empty($all_servers2)) {
$has_serverId_id2 = array_filter($all_servers2, function($b) {
global $server_id;
return $b->getServerId() == $server_id;
});
assert(count($has_serverId_id2) == 0);
}
# |
Change |
User |
Description |
Committed |
|
#1
|
19553 |
swellard |
Move and rename clients |
|
|
//guest/perforce_software/helix-web-services/main/source/clients/2016.1.0/php/tests/default_api.server_servers.crud.php |
#1
|
19259 |
tjuricek |
PHP Client SDK tests: labels, paths, protections, servers, triggers, users |
|
|