@@ 260-273 (lines=14) @@ | ||
257 | self::assertEquals('foo', $row['test_string']); |
|
258 | } |
|
259 | ||
260 | public function testFetchAssocWithTypes() |
|
261 | { |
|
262 | $datetimeString = '2010-01-01 10:10:10'; |
|
263 | $datetime = new \DateTime($datetimeString); |
|
264 | $sql = "SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"; |
|
265 | $row = $this->_conn->fetchAssoc($sql, array(1, $datetime), array(PDO::PARAM_STR, Type::DATETIME)); |
|
266 | ||
267 | self::assertTrue($row !== false); |
|
268 | ||
269 | $row = array_change_key_case($row, \CASE_LOWER); |
|
270 | ||
271 | self::assertEquals(1, $row['test_int']); |
|
272 | self::assertStringStartsWith($datetimeString, $row['test_datetime']); |
|
273 | } |
|
274 | ||
275 | /** |
|
276 | * @expectedException \Doctrine\DBAL\DBALException |
|
@@ 300-313 (lines=14) @@ | ||
297 | self::assertEquals('foo', $row[1]); |
|
298 | } |
|
299 | ||
300 | public function testFetchArrayWithTypes() |
|
301 | { |
|
302 | $datetimeString = '2010-01-01 10:10:10'; |
|
303 | $datetime = new \DateTime($datetimeString); |
|
304 | $sql = "SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"; |
|
305 | $row = $this->_conn->fetchArray($sql, array(1, $datetime), array(PDO::PARAM_STR, Type::DATETIME)); |
|
306 | ||
307 | self::assertTrue($row !== false); |
|
308 | ||
309 | $row = array_change_key_case($row, \CASE_LOWER); |
|
310 | ||
311 | self::assertEquals(1, $row[0]); |
|
312 | self::assertStringStartsWith($datetimeString, $row[1]); |
|
313 | } |
|
314 | ||
315 | /** |
|
316 | * @expectedException \Doctrine\DBAL\DBALException |