cvs: pear /MDB2/tests MDB2_reverse_testcase.php
| From: | Lukas Smith | Date: | Thu, 15 Jun 2006 08:10:16 +0000 |
| Subject: | cvs: pear /MDB2/tests MDB2_reverse_testcase.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-40707@lists.php.net to get a copy of this message | ||
lsmith Thu Jun 15 08:10:16 2006 UTC
Modified files:
/pear/MDB2/tests MDB2_reverse_testcase.php
Log:
- better handle issues with index/constraint creation
http://cvs.php.net/viewcvs.cgi/pear/MDB2/tests/MDB2_reverse_testcase.php?r1=1.34&r2=1.35&diff_format=u
Index: pear/MDB2/tests/MDB2_reverse_testcase.php
diff -u pear/MDB2/tests/MDB2_reverse_testcase.php:1.34
pear/MDB2/tests/MDB2_reverse_testcase.php:1.35
--- pear/MDB2/tests/MDB2_reverse_testcase.php:1.34 Sat May 27 17:32:04 2006
+++ pear/MDB2/tests/MDB2_reverse_testcase.php Thu Jun 15 08:10:16 2006
@@ -41,7 +41,7 @@
// | Author: Lorenzo Alberton <l dot alberton at quipo dot it> |
// +----------------------------------------------------------------------+
//
-// $Id: MDB2_reverse_testcase.php,v 1.34 2006/05/27 17:32:04 lsmith Exp $
+// $Id: MDB2_reverse_testcase.php,v 1.35 2006/06/15 08:10:16 lsmith Exp $
require_once 'MDB2_testcase.php';
@@ -144,9 +144,10 @@
$result = $this->db->manager->createIndex($this->table, $index_name,
$index);
$this->assertFalse(PEAR::isError($result), 'Error creating index:
'.$index_name);
if (PEAR::isError($result)) {
- unset($indices[$index_name]);
+ break;
}
}
+ return PEAR::isError($result);
}
function setUpConstraints()
@@ -184,7 +185,11 @@
foreach ($this->constraints as $constraint_name => $constraint) {
$result = $this->db->manager->createConstraint($this->table,
$constraint_name, $constraint);
$this->assertFalse(PEAR::isError($result), 'Error creating constraint:
'.$constraint_name);
+ if (PEAR::isError($result)) {
+ break;
+ }
}
+ return PEAR::isError($result);
}
/**
@@ -287,14 +292,6 @@
}
}
- $this->setUpConstraints();
- //constraints should NOT be listed
- foreach (array_keys($this->constraints) as $constraint_name) {
- $this->db->expectError(MDB2_ERROR_NOT_FOUND);
- $result = $this->db->reverse->getTableIndexDefinition($this->table,
$constraint_name);
- $this->assertTrue(PEAR::isError($result), 'Error listing index definition, this
is a CONSTRAINT');
- }
-
//test INDEX
$index_name = 'sometestindex';
$index_info = $this->db->reverse->getTableIndexDefinition($this->table,
$index_name);
@@ -318,6 +315,16 @@
$actual_fields = array_keys($index_info['fields']);
$this->assertEquals($expected_fields, $actual_fields, 'The INDEX field names
don\'t match');
}
+
+ if (!$this->setUpConstraints()) {
+ return;
+ }
+ //constraints should NOT be listed
+ foreach (array_keys($this->constraints) as $constraint_name) {
+ $this->db->expectError(MDB2_ERROR_NOT_FOUND);
+ $result = $this->db->reverse->getTableIndexDefinition($this->table,
$constraint_name);
+ $this->assertTrue(PEAR::isError($result), 'Error listing index definition, this
is a CONSTRAINT');
+ }
}
/**
@@ -329,7 +336,9 @@
return;
}
- $this->setUpConstraints();
+ if (!$this->setUpConstraints()) {
+ return;
+ }
//test constraint names
foreach ($this->constraints as $constraint_name => $constraint) {