Skip to content

Commit

Permalink
Add tests for translate + partial fields.
Browse files Browse the repository at this point in the history
Refs #3009
  • Loading branch information
markstory committed Jul 7, 2012
1 parent 1c0b6c0 commit 5e680cb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -531,6 +531,34 @@ public function testSaveCreate() {
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
} }


/**
* Test that saving only some of the translated fields allows the record to be found again.
*
* @return void
*/
public function testSavePartialFields() {
$this->loadFixtures('Translate', 'TranslatedItem');

$TestModel = new TranslatedItem();
$TestModel->locale = 'spa';
$data = array(
'slug' => 'fourth_translated',
'title' => 'Leyenda #4',
);
$TestModel->create($data);
$TestModel->save();
$result = $TestModel->read();
$expected = array(
'TranslatedItem' => array(
'id' => $TestModel->id,
'translated_article_id' => null,
'locale' => 'spa',
'content' => '',
) + $data
);
$this->assertEquals($expected, $result);
}

/** /**
* testSaveUpdate method * testSaveUpdate method
* *
Expand Down

0 comments on commit 5e680cb

Please sign in to comment.