diff options
author | Simon Holywell <[email protected]> | 2013-01-23 14:46:56 +0000 |
---|---|---|
committer | Simon Holywell <[email protected]> | 2013-01-23 14:46:56 +0000 |
commit | 5e05a57adbafe3ba39a03117f6c09944fa8bdf7c (patch) | |
tree | 2b4c3292e811cbc04e2ad0a688dab3b8b02646bb /test/bootstrap.php | |
parent | 8296e52b053ecb29a8ee1ac2f9be95e36bf84cac (diff) |
Remove duplicate code from test bootstrap
Diffstat (limited to 'test/bootstrap.php')
-rw-r--r-- | test/bootstrap.php | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/test/bootstrap.php b/test/bootstrap.php index d09615c..ec13cc7 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -24,6 +24,11 @@ class MockPDOStatement extends PDOStatement { } /** + * Another mock PDOStatement class, used for testing multiple connections + */ +class MockDifferentPDOStatement extends MockPDOStatement { } + +/** * * Mock database class implementing a subset * of the PDO API. @@ -41,29 +46,10 @@ class MockPDO extends PDO { } /** - * 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 { +class MockDifferentPDO extends MockPDO { /** * Return a dummy PDO statement @@ -72,4 +58,4 @@ class MockDifferentPDO extends PDO { $this->last_query = new MockDifferentPDOStatement($statement); return $this->last_query; } -}
\ No newline at end of file +} |