2
0

IbmTest.php 3.0 KB

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