source: web/old/remctl-2.14/php/tests/003.phpt @ f6f3e91

web
Last change on this file since f6f3e91 was f6f3e91, checked in by Jessica B. Hamrick <jhamrick@…>, 15 years ago

Preserve directory hierarchy (not sure what happened to it)

  • Property mode set to 100644
File size: 1.7 KB
Line 
1--TEST--
2Check full remctl API
3--SKIPIF--
4<?php
5    if (!file_exists("remctl-test.pid"))
6        echo "skip remctld not running";
7?>
8--FILE--
9<?php
10    $fh = fopen("remctl-test.princ", "r");
11    $principal = rtrim(fread($fh, filesize("remctl-test.princ")));
12    $r = remctl_new();
13    if ($r == null) {
14        echo "remctl_new failed\n";
15        exit(2);
16    }
17    echo "Created object\n";
18    if (!remctl_open($r, "localhost", 14373, $principal)) {
19        echo "remctl_open failed\n";
20        exit(2);
21    }
22    echo "Opened connection\n";
23    $args = array("test", "test");
24    if (!remctl_command($r, $args)) {
25        echo "remctl_command failed\n";
26        exit(2);
27    }
28    echo "Sent command\n";
29    $output = remctl_output($r);
30    echo "1: $output->type\n";
31    echo "1: (stream $output->stream) $output->data\n";
32    $output = remctl_output($r);
33    echo "2: $output->type\n";
34    echo "2: $output->status\n";
35    $output = remctl_output($r);
36    echo "3: $output->type\n";
37
38    $args = array("test", "status", "2");
39    if (!remctl_command($r, $args)) {
40        echo "remctl_command failed\n";
41        exit(2);
42    }
43    echo "Sent status command\n";
44    $output = remctl_output($r);
45    echo "1: $output->type\n";
46    echo "1: $output->status\n";
47
48    $args = array("test", "bad-command");
49    if (!remctl_command($r, $args)) {
50        echo "remctl_command failed\n";
51        exit(2);
52    }
53    echo "Sent bad command\n";
54    $output = remctl_output($r);
55    echo "1: $output->type\n";
56    echo "1: $output->data\n";
57    echo "1: $output->error\n";
58    remctl_close($r);
59?>
60--EXPECT--
61Created object
62Opened connection
63Sent command
641: output
651: (stream 1) hello world
66
672: status
682: 0
693: done
70Sent status command
711: status
721: 2
73Sent bad command
741: error
751: Unknown command
761: 5
Note: See TracBrowser for help on using the repository browser.