mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Manually merging changes from ModelTask in 1.2 to FixtureTask
Adding test cases for FixtureTask.
This commit is contained in:
parent
6b5c247162
commit
c4b493c934
2 changed files with 20 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue