PageRenderTime 48ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/DevApp/library/ServerLibraries/ZendFramework/1.7/tests/Zend/Db/Statement/OracleTest.php

http://firephp.googlecode.com/
PHP | 124 lines | 82 code | 20 blank | 22 comment | 0 complexity | df9888f810e0b3126156693721a0b585 MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.0, MIT, Apache-2.0
  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. */
  21. require_once 'Zend/Db/Statement/TestCommon.php';
  22. PHPUnit_Util_Filter::addFileToFilter(__FILE__);
  23. class Zend_Db_Statement_OracleTest extends Zend_Db_Statement_TestCommon
  24. {
  25. public function testStatementBindParamByPosition()
  26. {
  27. $this->markTestSkipped($this->getDriver() . ' does not support bound parameters by position');
  28. }
  29. public function testStatementBindValueByPosition()
  30. {
  31. $this->markTestSkipped($this->getDriver() . ' does not support bound parameters by position');
  32. }
  33. public function testStatementErrorCodeKeyViolation()
  34. {
  35. $this->markTestIncomplete($this->getDriver() . ' does not return error codes correctly.');
  36. }
  37. public function testStatementErrorInfoKeyViolation()
  38. {
  39. $this->markTestIncomplete($this->getDriver() . ' does not return error codes correctly.');
  40. }
  41. public function testStatementExecuteWithParams()
  42. {
  43. $products = $this->_db->quoteIdentifier('zfproducts');
  44. $product_id = $this->_db->quoteIdentifier('product_id');
  45. $product_name = $this->_db->quoteIdentifier('product_name');
  46. $stmt = $this->_db->prepare("INSERT INTO $products ($product_id, $product_name) VALUES (:product_id, :product_name)");
  47. $stmt->execute(array('product_id' => 4, 'product_name' => 'Solaris'));
  48. $select = $this->_db->select()
  49. ->from('zfproducts')
  50. ->where("$product_id = 4");
  51. $result = $this->_db->fetchAll($select);
  52. $stmt->closeCursor();
  53. $this->assertEquals(array(array('product_id'=>4, 'product_name'=>'Solaris')), $result);
  54. }
  55. public function testStatementFetchAllStyleBoth()
  56. {
  57. $this->markTestIncomplete($this->getDriver() . ' driver does not support fetchAll(FETCH_BOTH)');
  58. }
  59. public function testStatementGetColumnMeta()
  60. {
  61. $this->markTestIncomplete($this->getDriver() . ' has not implemented getColumnMeta() yet [ZF-1424]');
  62. }
  63. public function testStatementNextRowset()
  64. {
  65. $select = $this->_db->select()
  66. ->from('zfproducts');
  67. $stmt = $this->_db->prepare($select->__toString());
  68. try {
  69. $stmt->nextRowset();
  70. $this->fail('Expected to catch Zend_Db_Statement_Oracle_Exception');
  71. } catch (Zend_Exception $e) {
  72. $this->assertType('Zend_Db_Statement_Oracle_Exception', $e,
  73. 'Expecting object of type Zend_Db_Statement_Oracle_Exception, got '.get_class($e));
  74. $this->assertEquals('HYC00 Optional feature not implemented', $e->getMessage());
  75. }
  76. $stmt->closeCursor();
  77. }
  78. /**
  79. * @group ZF-5927
  80. */
  81. public function testStatementReturnNullWithEmptyField()
  82. {
  83. $products = $this->_db->quoteIdentifier('zfproducts');
  84. $product_id = $this->_db->quoteIdentifier('product_id');
  85. $product_name = $this->_db->quoteIdentifier('product_name');
  86. $stmt = $this->_db->prepare("INSERT INTO $products ($product_id, $product_name) VALUES (:product_id, :product_name)");
  87. $stmt->execute(array('product_id' => 4, 'product_name' => null));
  88. $select = $this->_db->select()
  89. ->from('zfproducts')
  90. ->where("$product_id = 4");
  91. $result = $this->_db->fetchAll($select);
  92. $this->assertTrue(array_key_exists('product_name', $result[0]), 'fetchAll must return null for empty fields with Oracle');
  93. $result = $this->_db->fetchRow($select);
  94. $this->assertTrue(array_key_exists('product_name', $result), 'fetchRow must return null for empty fields with Oracle');
  95. }
  96. public function testStatementSetFetchModeBoth()
  97. {
  98. $this->markTestIncomplete($this->getDriver() . ' does not implement FETCH_BOTH correctly.');
  99. }
  100. public function getDriver()
  101. {
  102. return 'Oracle';
  103. }
  104. }