FirebirdTest.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 ZendX
  16. * @package ZendX_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: StaticTest.php 4700 2007-05-04 04:25:11Z bkarwin $
  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. */
  34. class ZendX_Db_Profiler_FirebirdTest extends Zend_Db_Profiler_TestCommon
  35. {
  36. protected function _testProfilerSetFilterQueryTypeCommon($queryType)
  37. {
  38. $bugs = $this->_db->quoteIdentifier('zfbugs', true);
  39. $bug_status = $this->_db->quoteIdentifier('bug_status', true);
  40. $bug_id = $this->_db->quoteIdentifier('bug_id', true);
  41. $prof = $this->_db->getProfiler();
  42. $prof->setEnabled(true);
  43. $this->assertSame($prof->setFilterQueryType($queryType), $prof);
  44. $this->assertEquals($queryType, $prof->getFilterQueryType());
  45. $this->_db->query("SELECT * FROM $bugs");
  46. $this->_db->query("INSERT INTO $bugs ($bug_id, $bug_status) VALUES (GEN_ID(\"zfbugs_seq\", 1), ?)", array('NEW'));
  47. $this->_db->query("DELETE FROM $bugs");
  48. $this->_db->query("UPDATE $bugs SET $bug_status = ?", array('FIXED'));
  49. $qps = $prof->getQueryProfiles();
  50. $this->assertType('array', $qps, 'Expecting some query profiles, got none');
  51. foreach ($qps as $qp) {
  52. $qtype = $qp->getQueryType();
  53. $this->assertEquals($queryType, $qtype,
  54. "Found query type $qtype, which should have been filtered out");
  55. }
  56. $prof->setEnabled(false);
  57. }
  58. public function getDriver()
  59. {
  60. return 'Firebird';
  61. }
  62. }