<?php
include 'util/test_config.php';
include 'util/string_utils.php';
$api = apiAsJDoe();
$rand = generateRandomString();
$label_id = "test-label-$rand";
$label_command = new HelixWebServices\Model\LabelCommand([
"label" => $label_id,
"description" => "test $label_id",
"view" => [
"//depot/main/$label_id/..."
]
]);
$api->serverLabelsPost("localhost", $label_command);
$all_labels = $api->serverLabelsGet('localhost');
$has_label_id = array_filter($all_labels, function($b) {
global $label_id;
return $b->getLabel() == $label_id;
});
assert(count($has_label_id) == 1);
$saved_label = $api->serverLabelsLabelGet('localhost', $label_id);
assert($saved_label->getView() == $label_command->getView(), "view was not saved");
$to_update = new HelixWebServices\Model\LabelCommand([
"description" => "Update $rand"
]);
$api->serverLabelsLabelPatch('localhost', $label_id, $to_update);
$updated = $api->serverLabelsLabelGet('localhost', $label_id);
assert(trim($updated->getDescription()) == trim($to_update->getDescription()));
$api->serverLabelsLabelDelete('localhost', $label_id);
$all_labels2 = $api->serverLabelsGet('localhost');
if (!empty($all_labels2)) {
$has_label_id2 = array_filter($all_labels2, function($b) {
global $label_id;
return $b->getLabel() == $label_id;
});
assert(count($has_label_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_labels.crud.php |
#1
|
19258 |
tjuricek |
PHP Client SDK tests: labels, paths, protections, servers, triggers, users |
|
|