Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add tests for translate + partial fields.

Refs #3009
  • Loading branch information...
commit 5e680cb292a51a3ef8a01bece67042ce2d503fd6 1 parent 1c0b6c0
@markstory markstory authored
Showing with 28 additions and 0 deletions.
  1. +28 −0 lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
View
28 lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
@@ -532,6 +532,34 @@ public function testSaveCreate() {
}
/**
+ * 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
*
* @return void
Please sign in to comment.
Something went wrong with that request. Please try again.