OciTest.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. /**
  23. * @see Zend_Db_Profiler_TestCommon
  24. */
  25. require_once 'Zend/Db/Profiler/TestCommon.php';
  26. PHPUnit_Util_Filter::addFileToFilter(__FILE__);
  27. /**
  28. * @category Zend
  29. * @package Zend_Db
  30. * @subpackage UnitTests
  31. * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  32. * @license http://framework.zend.com/license/new-bsd New BSD License
  33. * @group Zend_Db
  34. * @group Zend_Db_Profiler
  35. */
  36. class Zend_Db_Profiler_Pdo_OciTest extends Zend_Db_Profiler_TestCommon
  37. {
  38. /**
  39. * Ensures that setFilterQueryType() actually filters
  40. *
  41. * @return void
  42. */
  43. protected function _testProfilerSetFilterQueryTypeCommon($queryType)
  44. {
  45. $bugs = $this->_db->quoteIdentifier('zfbugs', true);
  46. $bug_id = $this->_db->quoteIdentifier('bug_id', true);
  47. $bug_status = $this->_db->quoteIdentifier('bug_status', true);
  48. $prof = $this->_db->getProfiler();
  49. $prof->setEnabled(true);
  50. $this->assertSame($prof->setFilterQueryType($queryType), $prof);
  51. $this->assertEquals($queryType, $prof->getFilterQueryType());
  52. $this->_db->query("SELECT * FROM $bugs");
  53. $this->_db->query("INSERT INTO $bugs ($bug_id, $bug_status) VALUES (:id, :status)", array(':id' => 100,':status' => 'NEW'));
  54. $this->_db->query("DELETE FROM $bugs");
  55. $this->_db->query("UPDATE $bugs SET $bug_status = :status", array(':status'=>'FIXED'));
  56. $qps = $prof->getQueryProfiles();
  57. $this->assertType('array', $qps, 'Expecting some query profiles, got none');
  58. foreach ($qps as $qp) {
  59. $qtype = $qp->getQueryType();
  60. $this->assertEquals($queryType, $qtype,
  61. "Found query type $qtype, which should have been filtered out");
  62. }
  63. $prof->setEnabled(false);
  64. }
  65. public function getDriver()
  66. {
  67. return 'Pdo_Oci';
  68. }
  69. }