diff options
author | Tom Gregory <[email protected]> | 2013-01-22 00:23:04 -0500 |
---|---|---|
committer | Tom Gregory <[email protected]> | 2013-01-22 00:23:04 -0500 |
commit | 98b806652bab694797c0d09b41f198b7bf6f2c4c (patch) | |
tree | 077eefaaea3098418fa9eea317b87a854abd6f51 /test/bootstrap.php | |
parent | 349532a2c5b8d968f8fa7743b33b8d50d3525630 (diff) | |
parent | 6391acb3371e07742cf94c7c4bc4cc3888a6cae5 (diff) |
Merge remote-tracking branch 'upstream/develop' into dev-multi. Updated documentation to rat format, and tests to use phpunit.
(Resolved)Conflicts:
README.markdown
idiorm.php
test/test_queries.php
Diffstat (limited to 'test/bootstrap.php')
-rw-r--r-- | test/bootstrap.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/bootstrap.php b/test/bootstrap.php new file mode 100644 index 0000000..da97d2f --- /dev/null +++ b/test/bootstrap.php @@ -0,0 +1,41 @@ +<?php + +require_once dirname(__FILE__) . '/../idiorm.php'; + +/** + * + * Mock version of the PDOStatement class. + * + */ +class MockPDOStatement 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' => 'Fred', 'age' => 10, 'id' => '1'); + } + } +} + +/** + * + * Mock database class implementing a subset + * of the PDO API. + * + */ +class MockPDO extends PDO { + + /** + * Return a dummy PDO statement + */ + public function prepare($statement, $driver_options=array()) { + $this->last_query = new MockPDOStatement($statement); + return $this->last_query; + } +}
\ No newline at end of file |