Annotation of embedaddon/php/ext/standard/tests/general_functions/getservbyport_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test function getservbyport() by calling it more than or less than its expected arguments
! 3: --CREDITS--
! 4: Italian PHP TestFest 2009 Cesena 19-20-21 june
! 5: Fabio Fabbrucci (fabbrucci@grupporetina.com)
! 6: Michele Orselli (mo@ideato.it)
! 7: Simone Gentili (sensorario@gmail.com)
! 8: --FILE--
! 9: <?php
! 10: if(stristr(PHP_OS, "linux")) $file = "/etc/services";
! 11: elseif(stristr(PHP_OS, "Darwin")) $file = "/etc/services";
! 12: elseif(substr(PHP_OS,0,3) == "WIN") $file = "C:/WINDOWS/system32/drivers/etc/services";
! 13: else die(PHP_OS. " unsupported");
! 14:
! 15: if(file_exists($file)){
! 16: $services = file_get_contents($file);
! 17: $service = getservbyport( 80, "tcp" );
! 18: if(preg_match("/$service\s+80\/tcp/", $services)) {
! 19: echo "PASS\n";
! 20: }
! 21: }else{
! 22: echo "Services file not found in expected location\n";
! 23: }
! 24: ?>
! 25: --EXPECT--
! 26: PASS
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>