default_api.server_depots.crud.php #1

  • //
  • guest/
  • perforce_software/
  • helix-web-services/
  • main/
  • source/
  • client-php/
  • tests/
  • default_api.server_depots.crud.php
  • View
  • Commits
  • Open Download .zip Download (1 KB)
<?php

include 'util/test_config.php';
include 'util/string_utils.php';

$api = apiAsSuper();

$rand = generateRandomString();

$depot_id = "test-depot-$rand";

$depot_command = new HelixWebServices\Model\DepotCommand([
    "depot" => $depot_id,
    'type' => 'local',
    'map' => "$depot_id/...",
    'description' => "test $rand"
]);

$api->serverDepotsPost("localhost", $depot_command);

$all_depots = $api->serverDepotsGet('localhost');

$has_depot_id = array_filter($all_depots, function($b) {
    global $depot_id;
    return $b->getDepot() == $depot_id;
});
assert(count($has_depot_id) == 1);

$saved_depot = $api->serverDepotsDepotGet('localhost', $depot_id);

assert(trim($saved_depot->getDescription()) == trim($depot_command->getDescription()));

$to_update = new HelixWebServices\Model\DepotCommand([
    "description" => "Update $rand"
]);

$api->serverDepotsDepotPatch('localhost', $depot_id, $to_update);

$updated = $api->serverDepotsDepotGet('localhost', $depot_id);

assert(trim($updated->getDescription()) == trim($to_update->getDescription()));

$api->serverDepotsDepotDelete('localhost', $depot_id);

$all_depots2 = $api->serverDepotsGet('localhost');

$has_depot_id2 = array_filter($all_depots2, function($b) {
    global $depot_id;
    return $b->getDepot() == $depot_id;
});
assert(count($has_depot_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_depots.crud.php
#1 19255 tjuricek Change, client, command tests for PHP Client SDK.

Changed how array-like query parameters were passed to the server to be consistent with other SDKs.