Skip to content

Commit b0a789b

Browse files
committed
add Zend\Db\Sql\Ddl\Column\BigInteger to allow BIGINT type
1 parent a86a968 commit b0a789b

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Zend Framework (http://framework.zend.com/)
4+
*
5+
* @link http://github.com/zendframework/zf2 for the canonical source repository
6+
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7+
* @license http://framework.zend.com/license/new-bsd New BSD License
8+
*/
9+
10+
namespace Zend\Db\Sql\Ddl\Column;
11+
12+
class BigInteger extends Integer
13+
{
14+
/**
15+
* @var string
16+
*/
17+
protected $type = 'BIGINT';
18+
19+
/**
20+
* @var int
21+
*/
22+
protected $length;
23+
24+
/**
25+
* @param null|string $name
26+
* @param bool $nullable
27+
* @param null|string|int $default
28+
* @param array $options
29+
*/
30+
public function __construct($name, $nullable = false, $default = null, array $options = array())
31+
{
32+
$this->setName($name);
33+
$this->setNullable($nullable);
34+
$this->setDefault($default);
35+
$this->setOptions($options);
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Zend Framework (http://framework.zend.com/)
4+
*
5+
* @link http://github.com/zendframework/zf2 for the canonical source repository
6+
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7+
* @license http://framework.zend.com/license/new-bsd New BSD License
8+
*/
9+
10+
namespace ZendTest\Db\Sql\Ddl\Column;
11+
12+
use Zend\Db\Sql\Ddl\Column\BigInteger;
13+
14+
class BigIntegerTest extends \PHPUnit_Framework_TestCase
15+
{
16+
17+
/**
18+
* @covers Zend\Db\Sql\Ddl\Column\Float::__construct
19+
*/
20+
public function testObjectConstruction()
21+
{
22+
$integer = new BigInteger('foo');
23+
$this->assertEquals('foo', $integer->getName());
24+
}
25+
26+
/**
27+
* @covers Zend\Db\Sql\Ddl\Column\Column::getExpressionData
28+
*/
29+
public function testGetExpressionData()
30+
{
31+
$column = new BigInteger('foo');
32+
$this->assertEquals(
33+
array(array('%s %s', array('foo', 'BIGINT NOT NULL'), array($column::TYPE_IDENTIFIER, $column::TYPE_LITERAL))),
34+
$column->getExpressionData()
35+
);
36+
}
37+
}

0 commit comments

Comments
 (0)