X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=vendor%2Fdoctrine%2Form%2Ftests%2FDoctrine%2FTests%2FMocks%2FHydratorMockStatement.php;fp=vendor%2Fdoctrine%2Form%2Ftests%2FDoctrine%2FTests%2FMocks%2FHydratorMockStatement.php;h=297d41ee36fc8befc92566a6ca55e7aaa9b67282;hb=8b04b2d11798dee4f3e1358e4f43e97a6df851f6;hp=0000000000000000000000000000000000000000;hpb=73568cf05a785a45f94ca3f2351d9e07bf917958;p=zf2.biz%2Fapplication_blanche.git diff --git a/vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php b/vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php new file mode 100644 index 0000000..297d41e --- /dev/null +++ b/vendor/doctrine/orm/tests/Doctrine/Tests/Mocks/HydratorMockStatement.php @@ -0,0 +1,111 @@ + + */ +class HydratorMockStatement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement +{ + private $_resultSet; + + /** + * Creates a new mock statement that will serve the provided fake result set to clients. + * + * @param array $resultSet The faked SQL result set. + */ + public function __construct(array $resultSet) + { + $this->_resultSet = $resultSet; + } + + /** + * Fetches all rows from the result set. + * + * @return array + */ + public function fetchAll($fetchStyle = null, $columnIndex = null, array $ctorArgs = null) + { + return $this->_resultSet; + } + + public function fetchColumn($columnNumber = 0) + { + $row = current($this->_resultSet); + if ( ! is_array($row)) return false; + $val = array_shift($row); + return $val !== null ? $val : false; + } + + /** + * Fetches the next row in the result set. + * + */ + public function fetch($fetchStyle = null) + { + $current = current($this->_resultSet); + next($this->_resultSet); + return $current; + } + + /** + * Closes the cursor, enabling the statement to be executed again. + * + * @return boolean + */ + public function closeCursor() + { + return true; + } + + public function setResultSet(array $resultSet) + { + reset($resultSet); + $this->_resultSet = $resultSet; + } + + public function bindColumn($column, &$param, $type = null) + { + } + + public function bindValue($param, $value, $type = null) + { + } + + public function bindParam($column, &$variable, $type = null, $length = null, $driverOptions = array()) + { + } + + public function columnCount() + { + } + + public function errorCode() + { + } + + public function errorInfo() + { + } + + public function execute($params = array()) + { + } + + public function rowCount() + { + } + + public function getIterator() + { + return $this->_resultSet; + } + + public function setFetchMode($fetchStyle, $arg2 = null, $arg3 = null) + { + + } +} \ No newline at end of file