Skip to content
Permalink
Browse files

Added a failing test to testSavePartialFields

Added a failing test to the testSavePartialFields method where the title data for two locales creates only one empty content entry instead of two.
  • Loading branch information...
cdvrooman authored and markstory committed Jul 25, 2012
1 parent e620433 commit de1450763b9a9c270650ab235a4d2d82528f3409
Showing with 63 additions and 0 deletions.
  1. +63 −0 lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
@@ -552,6 +552,69 @@ public function testSavePartialFields() {
) + $data
);
$this->assertEquals($expected, $result);
$TestModel->locale = 'eng';
$data = array(
'slug' => 'fifth_translated',
'title' => array('eng' => 'Title #5', 'spa' => 'Leyenda #5'),
);
$TestModel->create($data);
$TestModel->save();
$TestModel->unbindTranslation();
$translations = array('title' => 'Title', 'content' => 'Content');
$TestModel->bindTranslation($translations, false);
$result = $TestModel->read(null, $TestModel->id);
$expected = array(
'TranslatedItem' => array(
'id' => '5',
'translated_article_id' => null,
'slug' => 'fifth_translated',
'locale' => 'eng',
'title' => '',
'content' => ''
),
0 => array(
'TranslatedItem__i18n_Title' => 'Title #5',
'TranslatedItem__i18n_Content' => ''
),
'Title' => array(
0 => array(
'id' => '21',
'locale' => 'eng',
'model' => 'TranslatedItem',
'foreign_key' => '5',
'field' => 'title',
'content' => 'Title #5'
),
1 => array(
'id' => '22',
'locale' => 'spa',
'model' => 'TranslatedItem',
'foreign_key' => '5',
'field' => 'title',
'content' => 'Leyenda #5'
)
),
'Content' => array(
0 => array(
'id' => '23',
'locale' => 'eng',
'model' => 'TranslatedItem',
'foreign_key' => '5',
'field' => 'content',
'content' => ''
),
1 => array(
'id' => '24',
'locale' => 'spa',
'model' => 'TranslatedItem',
'foreign_key' => '5',
'field' => 'content',
'content' => ''
)
)
);
$this->assertEquals($expected, $result);
}
/**

0 comments on commit de14507

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