summaryrefslogtreecommitdiffstats
path: root/php/extension/guestfs_php_002.phpt
blob: 48ee0b6036affa34d94802e1521716c5e4b779de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--TEST--
Launch the appliance.
--FILE--
<?php

// See comment in php/run-php-tests.sh.
//putenv ('LIBGUESTFS_DEBUG=1');

$g = guestfs_create ();
if ($g == false) {
  echo ("Failed to create guestfs_php handle.\n");
  exit;
}
if (guestfs_add_drive ($g, "/dev/null") == false) {
  echo ("Error: ".guestfs_last_error ($g)."\n");
  exit;
}
if (guestfs_launch ($g) == false) {
  echo ("Error: ".guestfs_last_error ($g)."\n");
  exit;
}
$version = guestfs_version ($g);
if ($version == false) {
  echo ("Error: ".guestfs_last_error ($g)."\n");
  exit;
}
if (!is_int ($version["major"]) ||
    !is_int ($version["minor"]) ||
    !is_int ($version["release"]) ||
    !is_string ($version["extra"])) {
  echo ("Error: incorrect return type from guestfs_version\n");
}
echo ("OK\n");
?>
--EXPECT--
OK