Skip to content

Commit

Permalink
Add default value generation for all integer types.
Browse files Browse the repository at this point in the history
This resolves the bigint issue raised by @chinpei in 10347 and adds
default values for the new small & tiny integer types.
  • Loading branch information
markstory committed Mar 12, 2017
1 parent b6372d6 commit c3f88c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/Cake/Console/Command/Task/FixtureTask.php
Expand Up @@ -335,6 +335,9 @@ protected function _generateRecords($tableInfo, $recordCount = 1) {
}
$insert = '';
switch ($fieldInfo['type']) {
case 'tinyinteger':
case 'smallinteger':
case 'biginteger':
case 'integer':
case 'float':
$insert = $i + 1;
Expand Down
7 changes: 5 additions & 2 deletions lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php
Expand Up @@ -470,17 +470,20 @@ public function testBake() {
}

/**
* test record generation with float and binary types
* test record generation with various integer, float and binary types
*
* @return void
*/
public function testRecordGenerationForBinaryAndFloat() {
public function testRecordGenerationForBinaryFloatAndIntegerTypes() {
$this->Task->connection = 'test';
$this->Task->path = '/my/path/';

$result = $this->Task->bake('Article', 'datatypes');
$this->assertContains("'float_field' => 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');
$this->assertContains("'data' => 'Lorem ipsum dolor sit amet'", $result);
Expand Down

0 comments on commit c3f88c3

Please sign in to comment.