2
0

PgsqlTest.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. * @group Zend_Db
  34. * @group Zend_Db_Table
  35. * @group Zend_Db_Table_Select
  36. */
  37. class Zend_Db_Table_Select_Pdo_PgsqlTest extends Zend_Db_Table_Select_TestCommon
  38. {
  39. public function getDriver()
  40. {
  41. return 'Pdo_Pgsql';
  42. }
  43. public function testSelectGroupByExpr()
  44. {
  45. $this->markTestSkipped($this->getDriver() . ' does not support expressions in GROUP BY');
  46. }
  47. public function testSelectGroupByAutoExpr()
  48. {
  49. $this->markTestSkipped($this->getDriver() . ' does not support expressions in GROUP BY');
  50. }
  51. /**
  52. * Ensures that from() provides expected behavior using schema specification
  53. *
  54. * @return void
  55. */
  56. public function testSelectFromSchemaSpecified()
  57. {
  58. $schema = 'public';
  59. $table = 'zfbugs';
  60. $sql = $this->_db->select()->from($table, '*', $schema);
  61. $this->assertRegExp("/FROM \"$schema\".\"$table\"/", $sql->__toString());
  62. $rowset = $this->_db->fetchAll($sql);
  63. $this->assertEquals(4, count($rowset));
  64. }
  65. /**
  66. * Ensures that from() provides expected behavior using schema in the table name
  67. *
  68. * @return void
  69. */
  70. public function testSelectFromSchemaInName()
  71. {
  72. $schema = 'public';
  73. $table = 'zfbugs';
  74. $name = "$schema.$table";
  75. $sql = $this->_db->select()->from($name);
  76. $this->assertRegExp("/FROM \"$schema\".\"$table\"/", $sql->__toString());
  77. $rowset = $this->_db->fetchAll($sql);
  78. $this->assertEquals(4, count($rowset));
  79. }
  80. /**
  81. * Ensures that from() overrides schema specification with schema in the table name
  82. *
  83. * @return void
  84. */
  85. public function testSelectFromSchemaInNameOverridesSchemaArgument()
  86. {
  87. $schema = 'public';
  88. $table = 'zfbugs';
  89. $name = "$schema.$table";
  90. $sql = $this->_db->select()->from($name, '*', 'ignored');
  91. $this->assertRegExp("/FROM \"$schema\".\"$table\"/", $sql->__toString());
  92. $rowset = $this->_db->fetchAll($sql);
  93. $this->assertEquals(4, count($rowset));
  94. }
  95. }