summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Friebe <thekid@php.net>2004-01-24 02:42:26 +0000
committerTimm Friebe <thekid@php.net>2004-01-24 02:42:26 +0000
commit96b80f86a1c0cbda51b73dbcb7ef1f5568295e89 (patch)
treee91642366bba464f1662a0f8874ddb1fb5b9fefa
parent095e82fe280e371883a385d600d7b5c5665c0739 (diff)
downloadphp-git-96b80f86a1c0cbda51b73dbcb7ef1f5568295e89.tar.gz
- Initial release
-rw-r--r--ext/sybase_ct/tests/test_appname.phpt65
1 files changed, 65 insertions, 0 deletions
diff --git a/ext/sybase_ct/tests/test_appname.phpt b/ext/sybase_ct/tests/test_appname.phpt
new file mode 100644
index 0000000000..529ce38597
--- /dev/null
+++ b/ext/sybase_ct/tests/test_appname.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Sybase-CT application name
+--SKIPIF--
+<?php require('skipif.inc'); ?>
+--FILE--
+<?php
+/* This file is part of PHP test framework for ext/sybase_ct
+ *
+ * $Id$
+ */
+
+ require('test.inc');
+
+ // {{{ bool compare_string(string expect, string actual)
+ // Compares expect to a trimmed version of actual
+ function compare_string($expect, $actual) {
+ $trimmed= rtrim($actual, ' ');
+ return (0 == strncmp($expect, $trimmed, strlen($trimmed)));
+ }
+ // }}}
+
+ $program_name= basename(__FILE__, '.php');
+ $hostname= 'php.net';
+ ini_set('sybct.hostname', $hostname);
+
+ $db= sybase_connect_ex(NULL, $program_name);
+ $r= sybase_select_ex($db, '
+ select
+ hostname,
+ program_name
+ from
+ master..sysprocesses
+ where
+ program_name = "'.$program_name.'"'
+ );
+
+ var_dump(
+ $r,
+ compare_string($program_name, $r[0]['program_name']),
+ compare_string($hostname, $r[0]['hostname'])
+ );
+
+ sybase_close($db);
+?>
+--EXPECTF--
+>>> Query:
+ select
+ hostname,
+ program_name
+ from
+ master..sysprocesses
+ where
+ program_name = "test_appname"
+<<< Return: resource
+array(1) {
+ [0]=>
+ array(2) {
+ ["hostname"]=>
+ string(10) "php.net%s"
+ ["program_name"]=>
+ string(16) "test_appname%s"
+ }
+}
+bool(true)
+bool(true)