Index: TestCommon.php =================================================================== --- TestCommon.php (revision 21050) +++ TestCommon.php (working copy) @@ -1225,9 +1225,10 @@ } protected $_numericDataTypes = array( - Zend_Db::INT_TYPE => Zend_Db::INT_TYPE, - Zend_Db::BIGINT_TYPE => Zend_Db::BIGINT_TYPE, - Zend_Db::FLOAT_TYPE => Zend_Db::FLOAT_TYPE + Zend_Db::INT_TYPE => Zend_Db::INT_TYPE, + Zend_Db::BIGINT_TYPE => Zend_Db::BIGINT_TYPE, + Zend_Db::FLOAT_TYPE => Zend_Db::FLOAT_TYPE, + Zend_Db::UNSIGNED_TYPE => Zend_Db::UNSIGNED_TYPE ); public function testAdapterQuoteIntoType() @@ -1247,6 +1248,11 @@ $this->assertEquals('foo = 12.340000', $value, 'Incorrect quoteInto() result for FLOAT_TYPE'); + $value = $this->_db->quoteInto('foo = ?', 2147483999, Zend_Db::UNSIGNED_TYPE); + $this->assertType('string', $value); + $this->assertEquals('foo = 2147483999', $value, + 'Incorrect quoteInto() result for UNSIGNED_TYPE'); + $value = $this->_db->quoteInto('foo = ?', 1234, 'CHAR'); $this->assertType('string', $value); $this->assertEquals("foo = 1234", $value, @@ -1447,6 +1453,53 @@ } } + public function testAdapterQuoteTypeUnsigned() + { + foreach ($this->_numericDataTypes as $typeName => $type) { + if ($type != 3) { + continue; + } + + // test int value + $value = $this->_db->quote(2147483999, $typeName); + $this->assertType('string', $value); + $this->assertEquals('2147483999', $value, + "Incorrect quote() UNSIGNED_TYPE result for unsigned int"); + + // test int string + $value = $this->_db->quote('2147483999', $typeName); + $this->assertType('string', $value); + $this->assertEquals('2147483999', $value, + "Incorrect quote() UNSIGNED_TYPE result for unsigned int string"); + + // test int string with + sign + $value = $this->_db->quote('+2147483999', $typeName); + $this->assertType('string', $value); + $this->assertEquals('2147483999', $value, + "Incorrect quote() UNSIGNED_TYPE result for int string with + sign"); + + // test int string with - sign + $value = $this->_db->quote('-1234', $typeName); + $this->assertType('string', $value); + $this->assertEquals('0', $value, + "Incorrect quote() UNSIGNED_TYPE result for int string with - sign"); + + // test int string with non-digit text + $value = $this->_db->quote('2147483999abcd', $typeName); + $this->assertType('string', $value); + $this->assertEquals('2147483999', $value, + "Incorrect quote() UNSIGNED_TYPE result for int string with non-digit text"); + + // test non-digit test; it should return 0 + $value = $this->_db->quote('abcd', $typeName); + $this->assertType('string', $value); + $this->assertEquals('0', $value, + "Incorrect quote() UNSIGNED_TYPE result for non-digit string"); + + } + } + + public function testAdapterQuoteTypeNonNumeric() { $value = $this->_db->quote(1234, 'CHAR');