From a49bd88e715ec77355c26ac07225fc9807b3640f Mon Sep 17 00:00:00 2001 From: Tom Gregory Date: Tue, 22 Jan 2013 01:39:15 -0500 Subject: Apparently not all files were included in previous commit. --- test/bootstrap.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'test/bootstrap.php') diff --git a/test/bootstrap.php b/test/bootstrap.php index da97d2f..d09615c 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -38,4 +38,38 @@ class MockPDO extends PDO { $this->last_query = new MockPDOStatement($statement); return $this->last_query; } +} + +/** + * Another mock PDOStatement class, used for testing multiple connections + */ +class MockDifferentPDOStatement extends PDOStatement { + + private $current_row = 0; + /** + * Return some dummy data + */ + public function fetch($fetch_style=PDO::FETCH_BOTH, $cursor_orientation=PDO::FETCH_ORI_NEXT, $cursor_offset=0) { + if ($this->current_row == 5) { + return false; + } else { + $this->current_row++; + return array('name' => 'Steve', 'age' => 80, 'id' => "{$this->current_row}"); + } + } +} + +/** + * A different mock database class, for testing multiple connections + * Mock database class implementing a subset of the PDO API. + */ +class MockDifferentPDO extends PDO { + + /** + * Return a dummy PDO statement + */ + public function prepare($statement, $driver_options = array()) { + $this->last_query = new MockDifferentPDOStatement($statement); + return $this->last_query; + } } \ No newline at end of file -- cgit v1.2.3