Skip to content
Permalink
Browse files

Add test for issue #2595

Fold conditions that did the same thing and add a test case.

Closes #2595
  • Loading branch information...
markstory committed Jan 7, 2014
1 parent a4f1388 commit 3763350667f3175296bf1c69bbdb63e7290d32ec
@@ -305,9 +305,7 @@ public function afterFind(Model $Model, $results, $primary = false) {
}
} else {
$value = '';
if (is_numeric($row[$Model->alias][$aliasVirtual])) {
$value = $row[$Model->alias][$aliasVirtual];
} elseif (!empty($row[$Model->alias][$aliasVirtual])) {
if (is_numeric($row[$Model->alias][$aliasVirtual]) || !empty($row[$Model->alias][$aliasVirtual])) {
$value = $row[$Model->alias][$aliasVirtual];
}
$row[$Model->alias][$aliasField] = $value;
@@ -354,6 +354,31 @@ public function testLocaleSingleAssociations() {
$this->assertEquals($expected, $result);
}
/**
* Test loading fields with 0 as the translated value.
*/
public function testFetchTranslationsWithZero() {
$this->loadFixtures('Translate', 'TranslatedItem');
$model = new TranslatedItem();
$translateModel = $model->translateModel();
$translateModel->updateAll(array('content' => '"0"'));
$model->locale = 'eng';
$result = $model->read(null, 1);
$expected = array(
'TranslatedItem' => array(
'id' => 1,
'slug' => 'first_translated',
'locale' => 'eng',
'title' => '0',
'content' => '0',
'translated_article_id' => 1,
)
);
$this->assertEquals($expected, $result);
}
/**
* testLocaleMultiple method
*

0 comments on commit 3763350

Please sign in to comment.
You can’t perform that action at this time.