Skip to content
Permalink
Browse files

Simplifying tests for translatable behavior as they were hard to unde…

…rstand
  • Loading branch information...
lorenzo committed Oct 26, 2010
1 parent 16524bc commit cc32ac89040e9efe03ac23e1cd0407b67748d715
Showing with 12 additions and 19 deletions.
  1. +12 −19 cake/tests/cases/libs/model/behaviors/translate.test.php
@@ -185,6 +185,7 @@ function testLocaleSingle() {
$TestModel = new TranslatedItem();
$TestModel->locale = 'eng';
$result = $TestModel->read(null, 1);
$expected = array(
'TranslatedItem' => array(
@@ -342,25 +343,16 @@ function testLocaleMultiple() {
$TestModel = new TranslatedItem();
$TestModel->locale = array('deu', 'eng', 'cze');
$delete = array(
array('locale' => 'deu'),
array('foreign_key' => 1, 'field' => 'title', 'locale' => 'eng'),
array('foreign_key' => 1, 'field' => 'content', 'locale' => 'cze'),
array('foreign_key' => 2, 'field' => 'title', 'locale' => 'cze'),
array('foreign_key' => 2, 'field' => 'content', 'locale' => 'eng'),
array('foreign_key' => 3, 'field' => 'title')
);
$I18nModel = ClassRegistry::getObject('TranslateTestModel');
$I18nModel->deleteAll(array('or' => $delete));
$result = $TestModel->read(null, 1);
$expected = array(
'TranslatedItem' => array(
'id' => 1,
'slug' => 'first_translated',
'locale' => 'deu',
'title' => 'Titulek #1',
'content' => 'Content #1'
'title' => 'Titel #1',
'content' => 'Inhalt #1'
)
);
$this->assertEqual($result, $expected);
@@ -371,28 +363,29 @@ function testLocaleMultiple() {
'TranslatedItem' => array(
'slug' => 'first_translated',
'locale' => 'deu',
'title' => 'Titulek #1',
'content' => 'Content #1'
'content' => 'Inhalt #1',
'title' => 'Titel #1'
)
),
array(
'TranslatedItem' => array(
'slug' => 'second_translated',
'locale' => 'deu',
'title' => 'Title #2',
'content' => 'Obsah #2'
'title' => 'Titel #2',
'content' => 'Inhalt #2'
)
),
array(
'TranslatedItem' => array(
'slug' => 'third_translated',
'locale' => 'deu',
'title' => '',
'content' => 'Content #3'
'title' => 'Titel #3',
'content' => 'Inhalt #3'
)
)
);
$this->assertEqual($result, $expected);
$this->assertEquals($result, $expected);
}
/**

0 comments on commit cc32ac8

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