Permalink
Browse files

expanded singleton tests

git-svn-id: http://svn.php.net/repository/pear/packages/MDB/trunk@148069 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 838b1f9 commit 2188c0392208d903f031595eccfc285979f1ecd3 Lukas Smith committed Jan 7, 2004
Showing with 6 additions and 3 deletions.
  1. +6 −3 tests/MDB_api_testcase.php
@@ -202,13 +202,16 @@ function testNumCols() {
}
function testSingleton() {
+ // this will reuse the existing database connection
+ // which has a database name set
$mdb =& MDB::singleton();
$this->assertTrue(MDB::isConnection($mdb));
+ $this->assertTrue($mdb->db_index == $this->db->db_index, 'MDB::singleton() called without a parameter did not return the first still connected MDB instance ('.$mdb->getDSN().' should be equal to '.$this->db->getDSN().')');
- // should have a different database name set
- $mdb =& MDB::singleton($this->dsn, $this->options);
+ // $this->dsn does not have a database name set
+ $another_mdb =& MDB::singleton($this->dsn, $this->options);
- $this->assertTrue($mdb->db_index != $this->db->db_index);
+ $this->assertTrue($another_mdb->db_index != $this->db->db_index, 'MDB::singleton() called with a different dsn returned the first still connected MDB instance ('.$another_mdb->getDSN().' should not be equal to '.$this->db->getDSN().')');
}
}

0 comments on commit 2188c03

Please sign in to comment.