Skip to content

Commit

Permalink
Manually merging changes from ModelTask in 1.2 to FixtureTask
Browse files Browse the repository at this point in the history
Adding test cases for FixtureTask.
  • Loading branch information
markstory committed Nov 9, 2009
1 parent 6b5c247 commit c4b493c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cake/console/libs/tasks/fixture.php
Expand Up @@ -277,9 +277,11 @@ function _generateRecords($tableInfo, $recordCount = 1) {
}
switch ($fieldInfo['type']) {
case 'integer':
case 'float':
$insert = $i + 1;
break;
case 'string';
case 'string':
case 'binary':
$isPrimaryUuid = (
isset($fieldInfo['key']) && strtolower($fieldInfo['key']) == 'primary' &&
isset($fieldInfo['length']) && $fieldInfo['length'] == 36
Expand Down
18 changes: 17 additions & 1 deletion cake/tests/cases/console/libs/tasks/fixture.test.php
Expand Up @@ -61,7 +61,7 @@ class FixtureTaskTest extends CakeTestCase {
*
* @var array
**/
var $fixtures = array('core.article', 'core.comment');
var $fixtures = array('core.article', 'core.comment', 'core.datatype', 'core.binary_test');

/**
* startTest method
Expand Down Expand Up @@ -259,6 +259,22 @@ function testBake() {
$this->assertNoPattern('/var \$records/', $result);
}

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

$result = $this->Task->bake('Article', 'datatypes');
$this->assertPattern("/'float_field' => 1/", $result);

$result = $this->Task->bake('Article', 'binary_tests');
$this->assertPattern("/'data' => 'Lorem ipsum dolor sit amet'/", $result);
}

/**
* Test that file generation includes headers and correct path for plugins.
*
Expand Down

0 comments on commit c4b493c

Please sign in to comment.