OciTest.php 2.5 KB

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