| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- /**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Db
- * @subpackage UnitTests
- * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
- /**
- * @see Zend_Db_Adapter_TestCommon
- */
- require_once 'Zend/Db/Adapter/TestCommon.php';
- /**
- * @category Zend
- * @package Zend_Db
- * @subpackage UnitTests
- * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
- abstract class Zend_Db_Adapter_Pdo_TestCommon extends Zend_Db_Adapter_TestCommon
- {
- public function testAdapterAlternateStatement()
- {
- $this->_testAdapterAlternateStatement('Test_PdoStatement');
- }
- /**
- * Ensures that exec() throws an exception when given a bogus query
- * @group ZF-6185
- * @return void
- */
- public function testAdapterExecBogus()
- {
- try {
- $this->_db->exec('Bogus query');
- $this->fail('Expected exception not thrown');
- } catch (Zend_Db_Adapter_Exception $e) {
- $this->assertTrue($e instanceof Zend_Db_Adapter_Exception,
- 'Expecting object of type Zend_Db_Adapter_Exception, got ' . get_class($e));
- }
- }
- /**
- * Ensures that exec() throws an exception when given a bogus table
- * @group ZF-6185
- * @return void
- */
- public function testAdapterExecBogusTable()
- {
- try {
- $this->_db->exec('DELETE FROM BogusTable');
- $this->fail('Expected exception not thrown');
- } catch (Zend_Db_Adapter_Exception $e) {
- $this->assertTrue($e instanceof Zend_Db_Adapter_Exception,
- 'Expecting object of type Zend_Db_Adapter_Exception, got ' . get_class($e));
- }
- }
- /**
- * Ensures that exec() provides expected behavior when modifying no rows
- * @group ZF-6185
- * @return void
- */
- public function testAdapterExecModifiedNone()
- {
- $affected = $this->_db->exec('DELETE FROM ' . $this->_db->quoteIdentifier('zfbugs') . ' WHERE 1 = -1');
- $this->assertEquals(0, $affected,
- "Expected exec() to return zero affected rows; got $affected");
- }
- /**
- * Test for null byte injection
- */
- public function testAdapterQuoteNullByteCharacter()
- {
- $string = "1\0";
- $value = $this->_db->quote($string);
- $this->assertNotContains("\0", $value);
- }
- }
|