Skip to content
Permalink
Browse files

Fixing TranslateBehavior test to run in php4.

  • Loading branch information...
markstory committed Jan 26, 2010
1 parent 9cbb9d1 commit c195d654b329c48c586c9739e4f36c4bf995b58d
@@ -377,7 +377,8 @@ function &translateModel(&$model) {
} elseif (empty($model->translateTable) && empty($model->translateModel)) {
$this->runtime[$model->alias]['model']->setSource('i18n');
}
return $this->runtime[$model->alias]['model'];
$model =& $this->runtime[$model->alias]['model'];
return $model;
}
/**
* Bind translation for fields, optionally with hasMany association for
@@ -74,21 +74,25 @@ function testTranslateModel() {
$TestModel =& new Tag();
$TestModel->translateTable = 'another_i18n';
$TestModel->Behaviors->attach('Translate', array('title'));
$this->assertEqual($TestModel->translateModel()->name, 'I18nModel');
$this->assertEqual($TestModel->translateModel()->useTable, 'another_i18n');
$translateModel =& $TestModel->Behaviors->Translate->translateModel($TestModel);
$this->assertEqual($translateModel->name, 'I18nModel');
$this->assertEqual($translateModel->useTable, 'another_i18n');
$TestModel =& new User();
$TestModel->Behaviors->attach('Translate', array('title'));
$this->assertEqual($TestModel->translateModel()->name, 'I18nModel');
$this->assertEqual($TestModel->translateModel()->useTable, 'i18n');
$translateModel =& $TestModel->Behaviors->Translate->translateModel($TestModel);
$this->assertEqual($translateModel->name, 'I18nModel');
$this->assertEqual($translateModel->useTable, 'i18n');
$TestModel =& new TranslatedArticle();
$this->assertEqual($TestModel->translateModel()->name, 'TranslateArticleModel');
$this->assertEqual($TestModel->translateModel()->useTable, 'article_i18n');
$translateModel =& $TestModel->Behaviors->Translate->translateModel($TestModel);
$this->assertEqual($translateModel->name, 'TranslateArticleModel');
$this->assertEqual($translateModel->useTable, 'article_i18n');
$TestModel =& new TranslatedItem();
$this->assertEqual($TestModel->translateModel()->name, 'TranslateTestModel');
$this->assertEqual($TestModel->translateModel()->useTable, 'i18n');
$translateModel =& $TestModel->Behaviors->Translate->translateModel($TestModel);
$this->assertEqual($translateModel->name, 'TranslateTestModel');
$this->assertEqual($translateModel->useTable, 'i18n');
}
/**
* testLocaleFalsePlain method

0 comments on commit c195d65

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