Skip to content

Commit

Permalink
Merge pull request #20 from sizuhiko/hotfix/issue19
Browse files Browse the repository at this point in the history
support char(1) that is not varchar for issue #19
  • Loading branch information
sizuhiko committed Feb 13, 2016
2 parents 82387a6 + 02de557 commit a2a136b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ env:
matrix:
- DB=mysql CAKE_VERSION=2.4
- DB=mysql CAKE_VERSION=2.5
- DB=mysql CAKE_VERSION=2.6
- DB=mysql CAKE_VERSION=2.7
- DB=mysql CAKE_VERSION=2.8

matrix:
include:
Expand Down
4 changes: 3 additions & 1 deletion Lib/Factory/FabricateModelFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ protected function fakeRecord($tableInfo, $index) {
} else {
$insert = "Lorem ipsum dolor sit amet";
if (!empty($fieldInfo['length'])) {
$insert = substr($insert, 0, (int)$fieldInfo['length'] - 2);
$length = (int)$fieldInfo['length'];
$length = $length === 1? $length : ($length - 2);
$insert = substr($insert, 0, $length);
}
}
break;
Expand Down
8 changes: 4 additions & 4 deletions Test/Case/Lib/FabricateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testAttributesFor() {
"author_id"=>5,
"title"=>"Lorem ipsum dolor sit amet",
"body"=>"Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.",
"published"=>"Lorem ipsum dolor sit ame",
"published"=>"L",
"created"=>"2013-10-09 12:40:28",
"updated"=>"2013-10-09 12:40:28"
];
Expand All @@ -62,7 +62,7 @@ public function testBuild() {
"author_id"=>1,
"title"=>"Lorem ipsum dolor sit amet",
"body"=>"Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.",
"published"=>"Lorem ipsum dolor sit ame",
"published"=>"L",
"created"=>"2013-10-09 12:40:28",
"updated"=>"2013-10-09 12:40:28"
];
Expand Down Expand Up @@ -97,7 +97,7 @@ public function testAttributesForWithArrayOption() {
"author_id"=>5,
"title"=>"Lorem ipsum dolor sit amet",
"body"=>"Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.",
"published"=>"Lorem ipsum dolor sit ame",
"published"=>"L",
"created"=>"2013-10-09 12:40:28",
"updated"=>"2013-10-09 12:40:28"
];
Expand All @@ -112,7 +112,7 @@ public function testBuildWithArrayOption() {
"author_id"=>1,
"title"=>"Lorem ipsum dolor sit amet",
"body"=>"Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.",
"published"=>"Lorem ipsum dolor sit ame",
"published"=>"L",
"created"=>"2013-10-09 12:40:28",
"updated"=>"2013-10-09 12:40:28"
];
Expand Down

0 comments on commit a2a136b

Please sign in to comment.