MysqlTest.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Db
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id $
  21. */
  22. require_once 'Zend/Db/Statement/Pdo/TestCommon.php';
  23. PHPUnit_Util_Filter::addFileToFilter(__FILE__);
  24. /**
  25. * @category Zend
  26. * @package Zend_Db
  27. * @subpackage UnitTests
  28. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  29. * @license http://framework.zend.com/license/new-bsd New BSD License
  30. * @group Zend_Db
  31. * @group Zend_Db_Statement
  32. */
  33. class Zend_Db_Statement_Pdo_MysqlTest extends Zend_Db_Statement_Pdo_TestCommon
  34. {
  35. public function testStatementNextRowset()
  36. {
  37. $select = $this->_db->select()
  38. ->from('zfproducts');
  39. $stmt = $this->_db->prepare($select->__toString());
  40. try {
  41. $stmt->nextRowset();
  42. } catch (Zend_Db_Statement_Exception $e) {
  43. $this->assertType('Zend_Db_Statement_Exception', $e,
  44. 'Expecting object of type Zend_Db_Statement_Exception, got '.get_class($e));
  45. $this->assertEquals('SQLSTATE[HYC00]: Optional feature not implemented', $e->getMessage());
  46. }
  47. $stmt->closeCursor();
  48. }
  49. /**
  50. * Ensures that the character sequence ":0'" is handled properly
  51. *
  52. * @link http://framework.zend.com/issues/browse/ZF-2059
  53. * @return void
  54. */
  55. public function testZF2059()
  56. {
  57. $sql = "SELECT bug_id FROM zfbugs WHERE bug_status != ':0'";
  58. $results = $this->_db->fetchAll($sql);
  59. $this->assertEquals(4, count($results));
  60. $select = $this->_db->select()->from('zfbugs', 'bug_id')
  61. ->where('bug_status != ?', ':0');
  62. $results = $this->_db->fetchAll($select);
  63. $this->assertEquals(4, count($results));
  64. }
  65. /**
  66. * @group ZF-7706
  67. */
  68. public function testStatementCanReturnDriverStatement()
  69. {
  70. $statement = parent::testStatementCanReturnDriverStatement();
  71. $this->assertType('PDOStatement', $statement->getDriverStatement());
  72. }
  73. public function getDriver()
  74. {
  75. return 'Pdo_Mysql';
  76. }
  77. }