Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into dev-multi. Conve…
Browse files Browse the repository at this point in the history
…rted multiple connection tests to phpunit and multiple connection documentation to rst.

Completes multiple connection implementation of Paris, as discussed in j4mie/idiorm#76.

(Resolved) Conflicts:
	README.markdown
	test/idiorm.php
	test/test_classes.php
	test/test_queries.php
  • Loading branch information
Tom Gregory committed Jan 22, 2013
2 parents c73d039 + fad7a4c commit d0d3d8b
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/test_classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d0d3d8b

Please sign in to comment.