<?php include 'util/test_config.php'; include 'util/string_utils.php'; $api = apiAsJDoe(); $rand = generateRandomString(); $job_id = "test-job-$rand"; $job_command = new HelixWebServices\Model\JobCommand([ "Job" => $job_id, "User" => 'jdoe', "Description" => "test $job_id", "Status" => 'open' ]); $api->serverJobsPost("localhost", $job_command); $all_jobs = $api->serverJobsGet('localhost'); $has_job_id = array_filter($all_jobs, function($b) { global $job_id; return $b['Job'] == $job_id; }); assert(count($has_job_id) == 1); $saved_job = $api->serverJobsJobGet('localhost', $job_id); assert(trim($saved_job['Description']) == trim($job_command['Description'])); assert($saved_job['User'] == $job_command['User']); assert($saved_job['Status'] == $job_command['Status']); $to_update = new HelixWebServices\Model\JobCommand([ "Status" => 'closed' ]); $api->serverJobsJobPatch('localhost', $job_id, $to_update); $updated = $api->serverJobsJobGet('localhost', $job_id); assert($updated['Status'] == 'closed'); $api->serverJobsJobDelete('localhost', $job_id); $all_jobs2 = $api->serverJobsGet('localhost'); if (!empty($all_jobs2)) { $has_job_id2 = array_filter($all_jobs2, function($b) { global $job_id; return $b['Job'] == $job_id; }); assert(count($has_job_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_jobs.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. |