Annotation of embedaddon/php/ext/sybase_ct/tests/test_appname.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Sybase-CT application name
! 3: --SKIPIF--
! 4: <?php require('skipif.inc'); ?>
! 5: --FILE--
! 6: <?php
! 7: /* This file is part of PHP test framework for ext/sybase_ct
! 8: *
! 9: * $Id: test_appname.phpt 268571 2008-11-08 11:46:06Z thekid $
! 10: */
! 11:
! 12: require('test.inc');
! 13:
! 14: // {{{ bool compare_string(string expect, string actual)
! 15: // Compares expect to a trimmed version of actual
! 16: function compare_string($expect, $actual) {
! 17: $trimmed= rtrim($actual, ' ');
! 18: return (0 == strncmp($expect, $trimmed, strlen($trimmed)));
! 19: }
! 20: // }}}
! 21:
! 22: $program_name= 'phpt_test';
! 23: $hostname= 'php.net';
! 24: ini_set('sybct.hostname', $hostname);
! 25:
! 26: $db= sybase_connect_ex(NULL, $program_name);
! 27: $r= sybase_select_ex($db, '
! 28: select
! 29: hostname,
! 30: program_name
! 31: from
! 32: master..sysprocesses
! 33: where
! 34: program_name = "'.$program_name.'"'
! 35: );
! 36:
! 37: var_dump(
! 38: compare_string($program_name, $r[0]['program_name']),
! 39: compare_string($hostname, $r[0]['hostname'])
! 40: );
! 41:
! 42: sybase_close($db);
! 43: ?>
! 44: --EXPECTF--
! 45: >>> Query:
! 46: select
! 47: hostname,
! 48: program_name
! 49: from
! 50: master..sysprocesses
! 51: where
! 52: program_name = "phpt_test"
! 53: <<< Return: resource
! 54: bool(true)
! 55: bool(true)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>