From 5e05a57adbafe3ba39a03117f6c09944fa8bdf7c Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Wed, 23 Jan 2013 14:46:56 +0000 Subject: Remove duplicate code from test bootstrap --- test/bootstrap.php | 28 +++++++--------------------- 1 file 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 @@ -23,6 +23,11 @@ class MockPDOStatement extends PDOStatement { } } +/** + * Another mock PDOStatement class, used for testing multiple connections + */ +class MockDifferentPDOStatement extends MockPDOStatement { } + /** * * Mock database class implementing a subset @@ -40,30 +45,11 @@ 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 +} -- cgit v1.2.3