Annotation of embedaddon/php/ext/snmp/tests/snmp2_set-nomib.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--                                 
                      2: Function snmp2_set (without MIBs loading)
                      3: --CREDITS--
                      4: Boris Lytockin
                      5: --SKIPIF--
                      6: <?php
                      7: require_once(dirname(__FILE__).'/skipif.inc');
                      8: ?>
                      9: --ENV--
                     10: return <<<END
                     11: MIBS=
                     12: END;
                     13: --FILE--
                     14: <?php
                     15: require_once(dirname(__FILE__).'/snmp_include.inc');
                     16: 
                     17: //EXPECTF format is quickprint OFF
                     18: snmp_set_quick_print(false);
                     19: snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
                     20: 
                     21: echo "Check error handing\n";
                     22: echo "Nonexisting OID\n";
                     23: $z = snmp2_set($hostname, $communityWrite, '.1.3.6.777.888.999.444.0', 's', 'bbb', $timeout, $retries);
                     24: var_dump($z);
                     25: 
                     26: echo "Bogus OID\n";
                     27: $z = snmp2_set($hostname, $communityWrite, '.1.3.6...777.888.999.444.0', 's', 'bbb', $timeout, $retries);
                     28: var_dump($z);
                     29: 
                     30: echo "Checking working\n";
                     31: $oid1 = '.1.3.6.1.2.1.1.4.0';
                     32: $oldvalue1 = snmpget($hostname, $communityWrite, $oid1, $timeout, $retries);
                     33: $newvalue1 = $oldvalue1 . '0';
                     34: 
                     35: echo "Single OID\n";
                     36: $z = snmp2_set($hostname, $communityWrite, $oid1, 's', $newvalue1, $timeout, $retries);
                     37: var_dump($z);
                     38: var_dump((snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $newvalue1));
                     39: $z = snmp2_set($hostname, $communityWrite, $oid1, 's', $oldvalue1, $timeout, $retries);
                     40: var_dump($z);
                     41: var_dump((snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $oldvalue1));
                     42: 
                     43: ?>
                     44: --EXPECTF--
                     45: Check error handing
                     46: Nonexisting OID
                     47: 
                     48: Warning: snmp2_set(): Error in packet at '%s': notWritable (That object does not support modification) in %s on line %d
                     49: bool(false)
                     50: Bogus OID
                     51: 
                     52: Warning: snmp2_set(): Invalid object identifier: %s in %s on line %d
                     53: bool(false)
                     54: Checking working
                     55: Single OID
                     56: bool(true)
                     57: bool(true)
                     58: bool(true)
                     59: bool(true)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>