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