IbmTest.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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-2012 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. /**
  23. * @see Zend_Db_Adapter_Db2Test
  24. */
  25. require_once 'Zend/Db/Adapter/Db2Test.php';
  26. /**
  27. * @see Zend_Db_Adapter_Pdo_Ibm
  28. */
  29. require_once 'Zend/Db/Adapter/Pdo/Ibm.php';
  30. /**
  31. * @category Zend
  32. * @package Zend_Db
  33. * @subpackage UnitTests
  34. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  35. * @license http://framework.zend.com/license/new-bsd New BSD License
  36. * @group Zend_Db
  37. * @group Zend_Db_Adapter
  38. */
  39. class Zend_Db_Adapter_Pdo_IbmTest extends Zend_Db_Adapter_Db2Test
  40. {
  41. public function getDriver()
  42. {
  43. return 'Pdo_Ibm';
  44. }
  45. public function testAdapterTransactionCommit()
  46. {
  47. $server = $this->_util->getServer();
  48. if ($server == 'IDS') {
  49. $this->markTestIncomplete('IDS needs special consideration for transactions');
  50. } else {
  51. parent::testAdapterTransactionCommit();
  52. }
  53. }
  54. public function testAdapterTransactionRollback()
  55. {
  56. $server = $this->_util->getServer();
  57. if ($server == 'IDS') {
  58. $this->markTestIncomplete('IDS needs special consideration for transactions');
  59. } else {
  60. parent::testAdapterTransactionCommit();
  61. }
  62. }
  63. public function testAdapterLimitInvalidArgumentException()
  64. {
  65. $products = $this->_db->quoteIdentifier('zfproducts');
  66. $sql = $this->_db->limit("SELECT * FROM $products", 0);
  67. $stmt = $this->_db->query($sql);
  68. $result = $stmt->fetchAll();
  69. $this->assertEquals(0, count($result), 'Expecting to see 0 rows returned');
  70. try {
  71. $sql = $this->_db->limit("SELECT * FROM $products", 1, -1);
  72. $this->fail('Expected to catch Zend_Db_Adapter_Exception');
  73. } catch (Zend_Exception $e) {
  74. $this->assertTrue($e instanceof Zend_Db_Adapter_Exception,
  75. 'Expecting object of type Zend_Db_Adapter_Exception, got '.get_class($e));
  76. }
  77. }
  78. /**
  79. * Used by _testAdapterOptionCaseFoldingNatural()
  80. * DB2 returns identifiers in uppercase naturally,
  81. * while IDS does not
  82. */
  83. protected function _testAdapterOptionCaseFoldingNaturalIdentifier()
  84. {
  85. $server = $this->_util->getServer();
  86. if ($server == 'DB2') {
  87. return 'CASE_FOLDED_IDENTIFIER';
  88. }
  89. return 'case_folded_identifier';
  90. }
  91. }