Annotation of embedaddon/php/ext/pgsql/tests/80_bug36625.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Bug #36625 (pg_trace() does not work)
                      3: --SKIPIF--
                      4: <?php
                      5: require_once('skipif.inc');
                      6: ?>
                      7: --FILE--
                      8: <?php
                      9: 
                     10: require_once('config.inc');
                     11:        
                     12: $dbh = @pg_connect($conn_str);
                     13: if (!$dbh) {
                     14:        die ('Could not connect to the server');
                     15: }
                     16: 
                     17: $tracefile = dirname(__FILE__) . '/trace.tmp';
                     18: 
                     19: @unlink($tracefile);
                     20: var_dump(file_exists($tracefile));
                     21: 
                     22: pg_trace($tracefile, 'w', $dbh);
                     23: $res = pg_query($dbh, 'select 1');
                     24: var_dump($res);
                     25: pg_close($dbh);
                     26: 
                     27: $found = 0;
                     28: function search_trace_file($line)
                     29: {
                     30:        if (strpos($line, '"select 1"') !== false || strpos($line, "'select 1'") !== false) {
                     31:                $GLOBALS['found']++;
                     32:        }
                     33: }
                     34: 
                     35: $trace = file($tracefile);
                     36: array_walk($trace, 'search_trace_file');
                     37: var_dump($found > 0);
                     38: var_dump(file_exists($tracefile));
                     39: 
1.1.1.2 ! misho      40: @unlink($tracefile);
        !            41: 
1.1       misho      42: ?>
                     43: ===DONE===
                     44: --CLEAN--
                     45: <?php unlink($tracefile); ?>
                     46: --EXPECTF--
                     47: bool(false)
                     48: resource(%d) of type (pgsql result)
                     49: bool(true)
                     50: bool(true)
                     51: ===DONE===

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