cvs: pear /MDB2/tests MDB2_reverse_testcase.php

From: Date: Wed, 28 Feb 2007 13:00:20 +0000
Subject: cvs: pear /MDB2/tests MDB2_reverse_testcase.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-44912@lists.php.net to get a copy of this message
quipo Wed Feb 28 13:00:20 2007 UTC Modified files: /pear/MDB2/tests MDB2_reverse_testcase.php Log: - if the driver isn't capable of returning the table name in tableInfo(), skip the check (bug #10207) - switch actual <=> expected values in assertEquals() http://cvs.php.net/viewvc.cgi/pear/MDB2/tests/MDB2_reverse_testcase.php?r1=1.40&r2=1.41&diff_format=u Index: pear/MDB2/tests/MDB2_reverse_testcase.php diff -u pear/MDB2/tests/MDB2_reverse_testcase.php:1.40 pear/MDB2/tests/MDB2_reverse_testcase.php:1.41 --- pear/MDB2/tests/MDB2_reverse_testcase.php:1.40 Sat Dec 9 18:07:10 2006 +++ pear/MDB2/tests/MDB2_reverse_testcase.php Wed Feb 28 13:00:20 2007 @@ -41,7 +41,7 @@ // | Author: Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: MDB2_reverse_testcase.php,v 1.40 2006/12/09 18:07:10 quipo Exp $ +// $Id: MDB2_reverse_testcase.php,v 1.41 2007/02/28 13:00:20 quipo Exp $ require_once 'MDB2_testcase.php'; @@ -226,7 +226,11 @@ } 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"); + //not all the drivers are capable of returning the table name, + //and may return an empty value + if (!empty($field_info['table'])) { + $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)'); } @@ -251,10 +255,10 @@ $this->assertTrue(false, 'Error in getTableFieldDefinition(): '.$field_info->getMessage()); } else { $field_info = array_shift($field_info); - $this->assertEquals($field_info['type'], 'integer', 'The field type is different from the expected one'); - $this->assertEquals($field_info['length'], 4, 'The field length is different from the expected one'); + $this->assertEquals('integer', $field_info['type'], 'The field type is different from the expected one'); + $this->assertEquals(4, $field_info['length'], 'The field length is different from the expected one'); $this->assertTrue($field_info['notnull'], 'The field can be null unlike it was expected'); - $this->assertEquals($field_info['default'], '0', 'The field default value is different from the expected one'); + $this->assertEquals('0', $field_info['default'], 'The field default value is different from the expected one'); } //test blob @@ -273,8 +277,8 @@ $this->assertTrue(false, 'Error in getTableFieldDefinition(): '.$field_info->getMessage()); } else { $field_info = array_shift($field_info); - $this->assertEquals($field_info['type'], 'text', 'The field type is different from the expected one'); - $this->assertEquals($field_info['length'], 12, 'The field length is different from the expected one'); + $this->assertEquals('text', $field_info['type'], 'The field type is different from the expected one'); + $this->assertEquals(12, $field_info['length'], 'The field length is different from the expected one'); $this->assertFalse($field_info['notnull'], 'The field can be null unlike it was expected'); $this->assertNull($field_info['default'], 'The field default value is different from the expected one'); $this->assertFalse($field_info['fixed'], 'The field fixed value is different from the expected one'); @@ -347,7 +351,7 @@ } //test index created WITHOUT using MDB2 (i.e. without the "_idx" suffix) - //@TODO (MDB2 should provide a fallback mechanism) + //NB: MDB2 > v.2.3.0 provides a fallback mechanism } /**

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