diff --git a/test/test_classes.php b/test/test_classes.php index 6af1a760..e912f018 100644 --- a/test/test_classes.php +++ b/test/test_classes.php @@ -80,6 +80,44 @@ public function prepare($statement, $driver_options = array()) { } } + /** + * Another mock PDOStatement class, for testing multiple connections + */ + class DummyDifferentPDOStatement 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 DummyDifferentPDO extends PDO { + + /** + * Return a dummy PDO statement + */ + public function prepare($statement, $driver_options = array()) { + $this->last_query = new DummyDifferentPDOStatement($statement); + return $this->last_query; + } + } + /** * * Class to provide simple testing functionality