cvs: pear /MDB2/tests MDB2_usage_testcase.php

From: Date: Sat, 14 Oct 2006 13:38:01 +0000
Subject: cvs: pear /MDB2/tests MDB2_usage_testcase.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-42549@lists.php.net to get a copy of this message
lsmith Sat Oct 14 13:38:01 2006 UTC Modified files: /pear/MDB2/tests MDB2_usage_testcase.php Log: - expanded prepare() tests http://cvs.php.net/viewvc.cgi/pear/MDB2/tests/MDB2_usage_testcase.php?r1=1.90&r2=1.91&diff_format=u Index: pear/MDB2/tests/MDB2_usage_testcase.php diff -u pear/MDB2/tests/MDB2_usage_testcase.php:1.90 pear/MDB2/tests/MDB2_usage_testcase.php:1.91 --- pear/MDB2/tests/MDB2_usage_testcase.php:1.90 Wed Sep 27 17:36:00 2006 +++ pear/MDB2/tests/MDB2_usage_testcase.php Sat Oct 14 13:38:01 2006 @@ -41,7 +41,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: MDB2_usage_testcase.php,v 1.90 2006/09/27 17:36:00 justinpatrin Exp $ +// $Id: MDB2_usage_testcase.php,v 1.91 2006/10/14 13:38:01 lsmith Exp $ require_once 'MDB2_testcase.php'; @@ -429,6 +429,23 @@ $stmt->free(); $row_data = reset($data); + $query = 'SELECT user_name, user_password, user_id FROM users WHERE /* maps to class::foo() */ user_name=:username'; + $stmt = $this->db->prepare($query, array('text'), array('text', 'text', 'integer')); + $result =& $stmt->execute(array('username' => $row_data['user_name'])); + if (PEAR::isError($result)) { + $this->assertTrue(!PEAR::isError($result), 'Could not execute prepared where a name parameter is contained in an SQL comment. Error: '.$result->getUserinfo()); + break; + } + $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC); + if (!is_array($row)) { + $this->assertTrue(false, 'Prepared SELECT failed'); + } else { + $diff = (array)array_diff($row, $row_data); + $this->assertTrue(empty($diff), 'Prepared SELECT failed for fields: '.implode(', ', array_keys($diff))); + } + $stmt->free(); + + $row_data = reset($data); $query = 'SELECT user_name, user_password, user_id FROM users WHERE user_name=:username OR user_password=:username'; $stmt = $this->db->prepare($query, array('text'), array('text', 'text', 'integer')); $result =& $stmt->execute(array('username' => $row_data['user_name']));

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