File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / sybase_ct / tests / test_appname.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:45 2012 UTC (12 years, 7 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, HEAD
php 5.4.3+patches

--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: test_appname.phpt,v 1.1.1.2 2012/05/29 12:34:45 misho Exp $ 
 */

  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= 'phpt_test';
  $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(
    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 = "phpt_test"
<<< Return: resource
bool(true)
bool(true)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>