mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing TranslateBehavior test to run in php4.
This commit is contained in:
parent
9cbb9d193a
commit
c195d654b3
2 changed files with 14 additions and 9 deletions
|
@ -377,7 +377,8 @@ class TranslateBehavior extends ModelBehavior {
|
|||
} 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 @@ class TranslateBehaviorTest extends CakeTestCase {
|
|||
$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
|
||||
|
|
Loading…
Reference in a new issue