Annotation of embedaddon/php/ext/snmp/tests/snmpset-nomib.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Function snmpset (without MIBs loading)
! 3: --CREDITS--
! 4: Boris Lytochkin
! 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 = snmpset($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 = snmpset($hostname, $communityWrite, '.1.3...6.777.888.999.444.0', 's', 'bbb', $timeout, $retries);
! 28: var_dump($z);
! 29:
! 30:
! 31: echo "Checking working\n";
! 32: $oid1 = '.1.3.6.1.2.1.1.4.0';
! 33: $oldvalue1 = snmpget($hostname, $communityWrite, $oid1, $timeout, $retries);
! 34: $newvalue1 = $oldvalue1 . '0';
! 35:
! 36: echo "Single OID\n";
! 37: $z = snmpset($hostname, $communityWrite, $oid1, 's', $newvalue1, $timeout, $retries);
! 38: var_dump($z);
! 39: var_dump((snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $newvalue1));
! 40: $z = snmpset($hostname, $communityWrite, $oid1, 's', $oldvalue1, $timeout, $retries);
! 41: var_dump($z);
! 42: var_dump((snmpget($hostname, $communityWrite, $oid1, $timeout, $retries) === $oldvalue1));
! 43:
! 44: ?>
! 45: --EXPECTF--
! 46: Check error handing
! 47: Nonexisting OID
! 48:
! 49: Warning: snmpset(): Error in packet at '%s': (noSuchName) There is no such variable name in this MIB. in %s on line %d
! 50: bool(false)
! 51: Bogus OID
! 52:
! 53: Warning: snmpset(): Invalid object identifier: %s in %s on line %d
! 54: bool(false)
! 55: Checking working
! 56: Single OID
! 57: bool(true)
! 58: bool(true)
! 59: bool(true)
! 60: bool(true)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>