cvs: pear /MDB2/tests MDB2_reverse_testcase.php

From: Date: Wed, 01 Mar 2006 22:55:00 +0000
Subject: cvs: pear /MDB2/tests MDB2_reverse_testcase.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-38811@lists.php.net to get a copy of this message
lsmith Wed Mar 1 22:55:00 2006 UTC Modified files: /pear/MDB2/tests MDB2_reverse_testcase.php Log: - fixed testcases to pass for mysql[i] (needs ph's to be called "primary") .. sqlite is probably severely broken for these tests (we really need alter table emulation here) http://cvs.php.net/viewcvs.cgi/pear/MDB2/tests/MDB2_reverse_testcase.php?r1=1.26&r2=1.27&diff_format=u Index: pear/MDB2/tests/MDB2_reverse_testcase.php diff -u pear/MDB2/tests/MDB2_reverse_testcase.php:1.26 pear/MDB2/tests/MDB2_reverse_testcase.php:1.27 --- pear/MDB2/tests/MDB2_reverse_testcase.php:1.26 Wed Mar 1 12:15:38 2006 +++ pear/MDB2/tests/MDB2_reverse_testcase.php Wed Mar 1 22:55:00 2006 @@ -41,7 +41,7 @@ // | Author: Lorenzo Alberton <l dot alberton at quipo dot it> | // +----------------------------------------------------------------------+ // -// $Id: MDB2_reverse_testcase.php,v 1.26 2006/03/01 12:15:38 lsmith Exp $ +// $Id: MDB2_reverse_testcase.php,v 1.27 2006/03/01 22:55:00 lsmith Exp $ require_once 'MDB2_testcase.php'; @@ -164,6 +164,11 @@ } foreach ($this->constraints as $constraint_name => $constraint) { $result = $this->db->manager->createConstraint($this->table, $constraint_name, $constraint); + if (PEAR::isError($result) && isset($constraint['primary']) && $constraint['primary']) { + echo 'Error creating primary constraint, trying with name "primary" instead .. '; + $name = 'primary'; + $result = $this->db->manager->createConstraint($this->table, $name, $constraint); + } $this->assertFalse(PEAR::isError($result), 'Error creating constraint: '.$constraint_name); } } @@ -312,8 +317,14 @@ //test constraint names foreach ($this->constraints as $constraint_name => $constraint) { + $this->db->expectError(MDB2_ERROR_NOT_FOUND); $result = $this->db->reverse->getTableConstraintDefinition($this->table, $constraint_name); - //echo '<pre>';var_dump($result);echo '</pre>'; + $this->db->popExpect(); + if (PEAR::isError($result) && isset($constraint['primary']) && $constraint['primary']) { + echo 'Error reading primary constraint, trying with name "primary" instead .. '; + $constraint_name = 'primary'; + $result = $this->db->reverse->getTableConstraintDefinition($this->table, $constraint_name); + } if (PEAR::isError($result)) { $this->assertFalse(true, 'Error getting table constraint definition'); } else { @@ -326,11 +337,18 @@ foreach (array_keys($this->indices) as $index_name) { $this->db->expectError(MDB2_ERROR_NOT_FOUND); $result = $this->db->reverse->getTableConstraintDefinition($this->table, $index_name); + $this->db->popExpect(); $this->assertTrue(PEAR::isError($result), 'Error listing constraint definition, this is a normal INDEX'); } //test PK + $this->db->expectError(MDB2_ERROR_NOT_FOUND); $constraint_info = $this->db->reverse->getTableConstraintDefinition($this->table, 'pkfield'); + $this->db->popExpect(); + if (PEAR::isError($result)) { + echo 'Error reading primary constraint, trying with name "primary" instead .. '; + $constraint_info = $this->db->reverse->getTableConstraintDefinition($this->table, 'primary'); + } if (PEAR::isError($constraint_info)) { $this->assertTrue(false, 'Error in getTableConstraintDefinition(): '.$constraint_info->getMessage()); } else {

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