Permalink
Browse files

Manually merging changes from ModelTask in 1.2 to FixtureTask

Adding test cases for FixtureTask.
  • Loading branch information...
1 parent 6b5c247 commit c4b493c934d9b24281a2cf07a4b82b719266882a @markstory markstory committed Nov 9, 2009
Showing with 20 additions and 2 deletions.
  1. +3 −1 cake/console/libs/tasks/fixture.php
  2. +17 −1 cake/tests/cases/console/libs/tasks/fixture.test.php
@@ -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
@@ -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
@@ -260,6 +260,22 @@ function testBake() {
}
/**
+ * 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.
*
* @return void

0 comments on commit c4b493c

Please sign in to comment.