Add default value generation for all integer types.

This resolves the bigint issue raised by @chinpei in 10347 and adds
default values for the new small & tiny integer types.
This commit is contained in:
mark_story 2017-03-11 21:46:14 -05:00
parent b6372d63d9
commit c3f88c350e
2 changed files with 8 additions and 2 deletions

View file

@ -335,6 +335,9 @@ class FixtureTask extends BakeTask {
} }
$insert = ''; $insert = '';
switch ($fieldInfo['type']) { switch ($fieldInfo['type']) {
case 'tinyinteger':
case 'smallinteger':
case 'biginteger':
case 'integer': case 'integer':
case 'float': case 'float':
$insert = $i + 1; $insert = $i + 1;

View file

@ -470,17 +470,20 @@ class FixtureTaskTest extends CakeTestCase {
} }
/** /**
* test record generation with float and binary types * test record generation with various integer, float and binary types
* *
* @return void * @return void
*/ */
public function testRecordGenerationForBinaryAndFloat() { public function testRecordGenerationForBinaryFloatAndIntegerTypes() {
$this->Task->connection = 'test'; $this->Task->connection = 'test';
$this->Task->path = '/my/path/'; $this->Task->path = '/my/path/';
$result = $this->Task->bake('Article', 'datatypes'); $result = $this->Task->bake('Article', 'datatypes');
$this->assertContains("'float_field' => 1", $result); $this->assertContains("'float_field' => 1", $result);
$this->assertContains("'bool' => 1", $result); $this->assertContains("'bool' => 1", $result);
$this->assertContains("'tiny_int' => 1", $result);
$this->assertContains("'small_int' => 1", $result);
$this->assertContains("'huge_int' => 1", $result);
$result = $this->Task->bake('Article', 'binary_tests'); $result = $this->Task->bake('Article', 'binary_tests');
$this->assertContains("'data' => 'Lorem ipsum dolor sit amet'", $result); $this->assertContains("'data' => 'Lorem ipsum dolor sit amet'", $result);