Manually merging changes from ModelTask in 1.2 to FixtureTask

Adding test cases for FixtureTask.
This commit is contained in:
mark_story 2009-11-08 22:22:08 -05:00
parent 6b5c247162
commit c4b493c934
2 changed files with 20 additions and 2 deletions

View file

@ -277,9 +277,11 @@ class FixtureTask extends Shell {
}
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

View file

@ -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
@ -259,6 +259,22 @@ class FixtureTaskTest extends CakeTestCase {
$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.
*