cvs: pear /MDB2/tests MDB2_reverse_testcase.php

From: Date: Sat, 14 Oct 2006 13:37:22 +0000
Subject: cvs: pear /MDB2/tests MDB2_reverse_testcase.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-42548@lists.php.net to get a copy of this message
lsmith Sat Oct 14 13:37:22 2006 UTC Modified files: /pear/MDB2/tests MDB2_reverse_testcase.php Log: - expanded tableInfo() tests http://cvs.php.net/viewvc.cgi/pear/MDB2/tests/MDB2_reverse_testcase.php?r1=1.35&r2=1.36&diff_format=u Index: pear/MDB2/tests/MDB2_reverse_testcase.php diff -u pear/MDB2/tests/MDB2_reverse_testcase.php:1.35 pear/MDB2/tests/MDB2_reverse_testcase.php:1.36 --- pear/MDB2/tests/MDB2_reverse_testcase.php:1.35 Thu Jun 15 08:10:16 2006 +++ pear/MDB2/tests/MDB2_reverse_testcase.php Sat Oct 14 13:37:22 2006 @@ -41,7 +41,7 @@ // | Author: Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: MDB2_reverse_testcase.php,v 1.35 2006/06/15 08:10:16 lsmith Exp $ +// $Id: MDB2_reverse_testcase.php,v 1.36 2006/10/14 13:37:22 lsmith Exp $ require_once 'MDB2_testcase.php'; @@ -214,6 +214,26 @@ //expand test, for instance adding a check on types... } } + + if (!$this->supported('result_introspection')) { + return; + } + + $result = $this->db->query('SELECT * FROM '.$this->table); + $table_info = $this->db->reverse->tableInfo($result); + if (PEAR::isError($table_info)) { + $this->assertTrue(false, 'Error in tableInfo(): '.$table_info->getMessage()); + } else { + $this->assertEquals(count($this->fields), count($table_info), 'The number of fields retrieved is different from the expected one'); + foreach ($table_info as $field_info) { + $this->assertEquals($this->table, $field_info['table'], "the table name is not correct"); + if (!array_key_exists(strtolower($field_info['name']), $this->fields)) { + $this->assertTrue(false, 'Field names do not match ('.$field_info['name'].' is unknown)'); + } + //expand test, for instance adding a check on types... + } + } + $result->free(); } /**

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