PgsqlTest.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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-2009 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_Table_Select_TestCommon
  24. */
  25. require_once 'Zend/Db/Table/Select/TestCommon.php';
  26. PHPUnit_Util_Filter::addFileToFilter(__FILE__);
  27. /**
  28. * @category Zend
  29. * @package Zend_Db
  30. * @subpackage UnitTests
  31. * @copyright Copyright (c) 2005-2009 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_Table_Select_Pdo_PgsqlTest extends Zend_Db_Table_Select_TestCommon
  35. {
  36. public function getDriver()
  37. {
  38. return 'Pdo_Pgsql';
  39. }
  40. public function testSelectGroupByExpr()
  41. {
  42. $this->markTestSkipped($this->getDriver() . ' does not support expressions in GROUP BY');
  43. }
  44. public function testSelectGroupByAutoExpr()
  45. {
  46. $this->markTestSkipped($this->getDriver() . ' does not support expressions in GROUP BY');
  47. }
  48. /**
  49. * Ensures that from() provides expected behavior using schema specification
  50. *
  51. * @return void
  52. */
  53. public function testSelectFromSchemaSpecified()
  54. {
  55. $schema = 'public';
  56. $table = 'zfbugs';
  57. $sql = $this->_db->select()->from($table, '*', $schema);
  58. $this->assertRegExp("/FROM \"$schema\".\"$table\"/", $sql->__toString());
  59. $rowset = $this->_db->fetchAll($sql);
  60. $this->assertEquals(4, count($rowset));
  61. }
  62. /**
  63. * Ensures that from() provides expected behavior using schema in the table name
  64. *
  65. * @return void
  66. */
  67. public function testSelectFromSchemaInName()
  68. {
  69. $schema = 'public';
  70. $table = 'zfbugs';
  71. $name = "$schema.$table";
  72. $sql = $this->_db->select()->from($name);
  73. $this->assertRegExp("/FROM \"$schema\".\"$table\"/", $sql->__toString());
  74. $rowset = $this->_db->fetchAll($sql);
  75. $this->assertEquals(4, count($rowset));
  76. }
  77. /**
  78. * Ensures that from() overrides schema specification with schema in the table name
  79. *
  80. * @return void
  81. */
  82. public function testSelectFromSchemaInNameOverridesSchemaArgument()
  83. {
  84. $schema = 'public';
  85. $table = 'zfbugs';
  86. $name = "$schema.$table";
  87. $sql = $this->_db->select()->from($name, '*', 'ignored');
  88. $this->assertRegExp("/FROM \"$schema\".\"$table\"/", $sql->__toString());
  89. $rowset = $this->_db->fetchAll($sql);
  90. $this->assertEquals(4, count($rowset));
  91. }
  92. }