cvs: pear /MDB2/tests MDB2_manager_testcase.php

From: Date: Mon, 05 Mar 2007 01:28:14 +0000
Subject: cvs: pear /MDB2/tests MDB2_manager_testcase.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-44969@lists.php.net to get a copy of this message
quipo Mon Mar 5 01:28:14 2007 UTC Modified files: /pear/MDB2/tests MDB2_manager_testcase.php Log: added testListFunctions() http://cvs.php.net/viewvc.cgi/pear/MDB2/tests/MDB2_manager_testcase.php?r1=1.54&r2=1.55&diff_format=u Index: pear/MDB2/tests/MDB2_manager_testcase.php diff -u pear/MDB2/tests/MDB2_manager_testcase.php:1.54 pear/MDB2/tests/MDB2_manager_testcase.php:1.55 --- pear/MDB2/tests/MDB2_manager_testcase.php:1.54 Sun Mar 4 20:03:31 2007 +++ pear/MDB2/tests/MDB2_manager_testcase.php Mon Mar 5 01:28:13 2007 @@ -42,7 +42,7 @@ // | Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: MDB2_manager_testcase.php,v 1.54 2007/03/04 20:03:31 quipo Exp $ +// $Id: MDB2_manager_testcase.php,v 1.55 2007/03/05 01:28:13 quipo Exp $ require_once 'MDB2_testcase.php'; @@ -669,5 +669,40 @@ $this->assertTrue(in_array(strtolower($this->db->dsn['username']), $users), 'Error: user not found'); } } + + /** + * Test listFunctions() + */ + function testListFunctions() { + //setup + $function_name = 'test_add'; + + include_once 'MDB2_nonstandard.php'; + $nonstd =& MDB2_nonstandard::factory($this->db, $this); + if (PEAR::isError($nonstd)) { + $this->assertTrue(false, 'Cannot instanciate MDB2_nonstandard object: '.$nonstd->getMessage()); + return; + } + + $result = $nonstd->createFunction($function_name); + if (PEAR::isError($result)) { + $this->assertTrue(false, 'Cannot create function: '.$result->getMessage().' :: '.$result->getUserInfo()); + return; + } + + //test + $functions = $this->db->manager->listFunctions(); + if (PEAR::isError($functions)) { + $this->assertTrue(false, 'Error listing the functions: '.$functions->getMessage()); + } else { + $this->assertTrue(in_array($function_name, $functions), 'Error: function not found'); + } + + //cleanup + $result = $nonstd->dropFunction($function_name); + if (PEAR::isError($result)) { + $this->assertTrue(false, 'Error dropping the function: '.$result->getMessage()); + } + } } ?> \ No newline at end of file

« previous php.pear.cvs (#44969) next »