1--TEST--
2Function snmp_get_valueretrieval / snmp_set_valueretrieval
3--CREDITS--
4Olivier Doucet
5--SKIPIF--
6<?php
7require_once(dirname(__FILE__).'/skipif.inc');
8?>
9--FILE--
10<?php
11require_once(dirname(__FILE__).'/snmp_include.inc');
12
13echo "Checking error handling\n";
14var_dump(snmp_get_valueretrieval('noarg'));
15var_dump(snmp_set_valueretrieval());
16var_dump(snmp_set_valueretrieval('noarg'));
17var_dump(snmp_set_valueretrieval(67));
18
19echo "Checking working\n";
20var_dump(snmp_get_valueretrieval());
21snmp_set_valueretrieval(SNMP_VALUE_LIBRARY);
22var_dump(snmp_get_valueretrieval() === SNMP_VALUE_LIBRARY);
23snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
24var_dump(snmp_get_valueretrieval() === SNMP_VALUE_PLAIN);
25snmp_set_valueretrieval(SNMP_VALUE_OBJECT);
26var_dump(snmp_get_valueretrieval() === SNMP_VALUE_OBJECT);
27snmp_set_valueretrieval(SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT);
28var_dump(snmp_get_valueretrieval() === (SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT));
29snmp_set_valueretrieval(SNMP_VALUE_LIBRARY|SNMP_VALUE_OBJECT);
30var_dump(snmp_get_valueretrieval() === (SNMP_VALUE_LIBRARY|SNMP_VALUE_OBJECT));
31
32?>
33--EXPECTF--
34Checking error handling
35
36Warning: snmp_get_valueretrieval() expects exactly 0 parameters, 1 given in %s on line %d
37bool(false)
38
39Warning: snmp_set_valueretrieval() expects exactly 1 parameter, 0 given in %s on line %d
40bool(false)
41
42Warning: snmp_set_valueretrieval() expects parameter 1 to be int, %s given in %s on line %d
43bool(false)
44
45Warning: snmp_set_valueretrieval(): Unknown SNMP value retrieval method '67' in %s on line %d
46bool(false)
47Checking working
48int(%d)
49bool(true)
50bool(true)
51bool(true)
52bool(true)
53bool(true)
54