$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); }