IbmTest.php 3.1 KB

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