<?php
include 'util/test_config.php';
include 'util/string_utils.php';
$api = apiAsSuper();
$rand = generateRandomString();
$counter_id = "test-counter-$rand";
$counter = new HelixWebServices\Model\Counter(["value" => "1"]);
$api->serverCountersCounterPut('localhost', $counter_id, $counter);
$all_counters = $api->serverCountersGet('localhost');
$counter_id_counters = array_filter($all_counters, function ($x) {
    global $counter_id;
    return $x->getCounter() == $counter_id;
});
assert(!empty($counter_id_counters));
$saved_counter = $api->serverCountersCounterGet('localhost', $counter_id);
assert($saved_counter->getValue() == $counter->getValue());
$api->serverCountersCounterIncrementPost('localhost', $counter_id);
$updated = $api->serverCountersCounterGet('localhost', $counter_id);
assert($updated->getValue() == '2');
$api->serverCountersCounterDelete('localhost', $counter_id);
$all_counters = $api->serverCountersGet('localhost');
$counter_id_counters = array_filter($all_counters, function ($x) {
    global $counter_id;
    return $x->getCounter() == $counter_id;
});
assert(empty($counter_id_counters));
                    | # | 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_counters.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.  | 
                ||