Return to get_browser_error.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / misc |
1.1 misho 1: --TEST-- 2: Test get_browser() function : error functionality 3: --INI-- 4: browscap={PWD}/browscap.ini 5: --SKIPIF-- 6: <?php 7: /** 8: * Basic test, it would be pretty much coincidence if there's 9: * a browscap.ini on another place that isn't valid. 10: */ 11: if(! is_readable( ini_get( 'browscap' ) ) ) { 12: die( 'skip: browscap.ini file ' . ini_get('browscap') . " not readable" ); 13: } 14: ?> 15: --FILE-- 16: <?php 17: /* Prototype : mixed get_browser([string browser_name [, bool return_array]]) 18: * Description: Get information about the capabilities of a browser. 19: * If browser_name is omitted or null, HTTP_USER_AGENT is used. 20: * Returns an object by default; if return_array is true, returns an array. 21: * 22: * Source code: ext/standard/browscap.c 23: * Alias to functions: 24: */ 25: 26: $browsers = include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'browsernames.inc'; 27: 28: echo "*** Testing get_browser() : error functionality ***\n"; 29: 30: /* Unknown browser uses defaults. */ 31: var_dump( get_browser( 'foobar', true ) ); 32: 33: /* More than expected arguments */ 34: var_dump( get_browser( 'foobar', true, 15 ) ); 35: 36: /* Some wrong parameters, no HTTP_USER_AGENT set */ 37: var_dump( get_browser( null, 'foobar' ) ); 38: 39: ?> 40: ===DONE=== 41: --EXPECTF-- 42: *** Testing get_browser() : error functionality *** 43: array(34) { 44: ["browser_name_regex"]=> 45: string(6) "§^.*$§" 46: ["browser_name_pattern"]=> 47: string(1) "*" 48: ["browser"]=> 49: string(15) "Default Browser" 50: ["version"]=> 51: string(1) "0" 52: ["majorver"]=> 53: string(1) "0" 54: ["minorver"]=> 55: string(1) "0" 56: ["platform"]=> 57: string(7) "unknown" 58: ["alpha"]=> 59: string(0) "" 60: ["beta"]=> 61: string(0) "" 62: ["win16"]=> 63: string(0) "" 64: ["win32"]=> 65: string(0) "" 66: ["win64"]=> 67: string(0) "" 68: ["frames"]=> 69: string(1) "1" 70: ["iframes"]=> 71: string(0) "" 72: ["tables"]=> 73: string(1) "1" 74: ["cookies"]=> 75: string(0) "" 76: ["backgroundsounds"]=> 77: string(0) "" 78: ["authenticodeupdate"]=> 79: string(1) "0" 80: ["cdf"]=> 81: string(0) "" 82: ["vbscript"]=> 83: string(0) "" 84: ["javaapplets"]=> 85: string(0) "" 86: ["javascript"]=> 87: string(0) "" 88: ["activexcontrols"]=> 89: string(0) "" 90: ["stripper"]=> 91: string(0) "" 92: ["isbanned"]=> 93: string(0) "" 94: ["wap"]=> 95: string(0) "" 96: ["ismobiledevice"]=> 97: string(0) "" 98: ["issyndicationreader"]=> 99: string(0) "" 100: ["crawler"]=> 101: string(0) "" 102: ["css"]=> 103: string(1) "0" 104: ["cssversion"]=> 105: string(1) "0" 106: ["supportscss"]=> 107: string(0) "" 108: ["aol"]=> 109: string(0) "" 110: ["aolversion"]=> 111: string(1) "0" 112: } 113: 114: Warning: get_browser() expects at most 2 parameters, 3 given in %s on line %d 115: NULL 116: 117: Warning: get_browser(): HTTP_USER_AGENT variable is not set, cannot determine user agent name in %s on line %d 118: bool(false) 119: ===DONE===