helly           Sat Dec 27 16:45:51 2003 EDT

  Added files:                 
    /php-src/ext/sqlite/tests   sqlite_oo_029.phpt 
  Log:
  Add new test related to bug #25329.
  
  

Index: php-src/ext/sqlite/tests/sqlite_oo_029.phpt
+++ php-src/ext/sqlite/tests/sqlite_oo_029.phpt
--TEST--
sqlite-oo: call method with $this
--FILE--
<?php 
include "blankdb_oo.inc";

$db->query("CREATE TABLE strings(key VARCHAR(10), var VARCHAR(10))");
$db->query("INSERT INTO strings VALUES('foo', 'foo')");

class sqlite_help
{
        function sqlite_help($db){
                $this->db = $db;
                $this->db->create_function('link_keywords', array(&$this, 'linkers'), 
1);
                return $this->db;
        }

        function get_single($key)
        {
                return $this->db->single_query('SELECT link_keywords(var) FROM strings 
WHERE key=\''.$key.'\'', 1);
        }

        function linkers($str)
        {
                $str = str_replace('foo', 'bar', $str);
                return $str;
        }

        function free()
        {
                unset($this->db);
        }
        
        function __destruct()
        {
                echo "DESTRUCTED\n";
        }
}

$obj = new sqlite_help($db);
echo $obj->get_single('foo')."\n";;
$obj->free();
unset($obj);

?>
===DONE===
--EXPECT--
bar
===DONE===
DESTRUCTED

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to