summaryrefslogtreecommitdiff
path: root/ext/snmp/tests/snmp_getvalue.phpt
diff options
context:
space:
mode:
authorBoris Lytochkin <lytboris@php.net>2011-01-31 11:41:33 +0000
committerBoris Lytochkin <lytboris@php.net>2011-01-31 11:41:33 +0000
commit5e82e334ddffcf577542a74a37f3388d14790686 (patch)
tree4478948ab10f10f102620b9c4973a7a5d576ae45 /ext/snmp/tests/snmp_getvalue.phpt
parentf0d42e74a94689ff6702da075e66814204169d01 (diff)
downloadphp-git-5e82e334ddffcf577542a74a37f3388d14790686.tar.gz
Improved SNMP extension. FR #53594
Diffstat (limited to 'ext/snmp/tests/snmp_getvalue.phpt')
-rw-r--r--ext/snmp/tests/snmp_getvalue.phpt46
1 files changed, 46 insertions, 0 deletions
diff --git a/ext/snmp/tests/snmp_getvalue.phpt b/ext/snmp/tests/snmp_getvalue.phpt
new file mode 100644
index 0000000000..0eefbb335e
--- /dev/null
+++ b/ext/snmp/tests/snmp_getvalue.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Function snmp_getvalue
+--CREDITS--
+Boris Lytochkin
+--SKIPIF--
+<?php
+require_once(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+require_once(dirname(__FILE__).'/snmp_include.inc');
+
+//EXPECTF format is quickprint OFF
+snmp_set_quick_print(false);
+
+echo "Get with SNMP_VALUE_LIBRARY\n";
+snmp_set_valueretrieval(SNMP_VALUE_LIBRARY);
+var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries));
+
+echo "Get with SNMP_VALUE_PLAIN\n";
+snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
+var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries));
+
+echo "Get with SNMP_VALUE_OBJECT\n";
+snmp_set_valueretrieval(SNMP_VALUE_OBJECT);
+$z = snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries);
+echo gettype($z)."\n";
+var_dump($z->type);
+var_dump($z->value);
+
+echo "Check parsing of different OID types\n";
+snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
+var_dump(count(snmp2_walk($hostname, $community, '.', $timeout, $retries)));
+
+?>
+--EXPECTF--
+Get with SNMP_VALUE_LIBRARY
+string(%d) "STRING: %s"
+Get with SNMP_VALUE_PLAIN
+string(%d) "%s"
+Get with SNMP_VALUE_OBJECT
+object
+int(4)
+string(%d) "%s"
+Check parsing of different OID types
+int(%d)