<?php
include 'util/test_config.php';
include 'util/string_utils.php';
$api = apiAsSuper();
$rand = generateRandomString();
$user_id = "test-user-$rand";
$user_command = new HelixWebServices\Model\UserCommand([
"user" => $user_id,
"full_name" => "Test User",
"email" => "$user_id@example.com",
"job_view" => "Owned-By=$user_id&status=open",
"reviews" => ['//depot/dev/...', '//depot/main/...']
]);
$api->serverUsersPost("localhost", $user_command);
$all_users = $api->serverUsersGet('localhost');
$has_user_id = array_filter($all_users, function($b) {
global $user_id;
return $b->getUser() == $user_id;
});
assert(count($has_user_id) == 1);
$saved_user = $api->serverUsersUserGet('localhost', $user_id);
assert($saved_user->getFullName() == $user_command->getFullName());
assert($saved_user->getJobView() == $user_command->getJobView());
assert($saved_user->getReviews() == $user_command->getReviews());
$to_update = new HelixWebServices\Model\UserCommand([
"full_name" => "Update $rand"
]);
$api->serverUsersUserPatch('localhost', $user_id, $to_update);
$updated = $api->serverUsersUserGet('localhost', $user_id);
assert($updated->getFullName() == $to_update->getFullName());
$api->serverUsersUserDelete('localhost', $user_id);
$all_users2 = $api->serverUsersGet('localhost');
$has_user_id2 = array_filter($all_users2, function($b) {
global $user_id;
return $b->getUser() == $user_id;
});
assert(count($has_user_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_users.crud.php |
#1
|
19259 |
tjuricek |
PHP Client SDK tests: labels, paths, protections, servers, triggers, users |
|
|