Skip to content
This repository
Browse code

Add tests for translate + partial fields.

Refs #3009
  • Loading branch information...
commit 5e680cb292a51a3ef8a01bece67042ce2d503fd6 1 parent 1c0b6c0
Mark Story authored July 07, 2012
28  lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
@@ -532,6 +532,34 @@ public function testSaveCreate() {
532 532
 	}
533 533
 
534 534
 /**
  535
+ * Test that saving only some of the translated fields allows the record to be found again.
  536
+ *
  537
+ * @return void
  538
+ */
  539
+	public function testSavePartialFields() {
  540
+		$this->loadFixtures('Translate', 'TranslatedItem');
  541
+
  542
+		$TestModel = new TranslatedItem();
  543
+		$TestModel->locale = 'spa';
  544
+		$data = array(
  545
+			'slug' => 'fourth_translated',
  546
+			'title' => 'Leyenda #4',
  547
+		);
  548
+		$TestModel->create($data);
  549
+		$TestModel->save();
  550
+		$result = $TestModel->read();
  551
+		$expected = array(
  552
+			'TranslatedItem' => array(
  553
+				'id' => $TestModel->id,
  554
+				'translated_article_id' => null,
  555
+				'locale' => 'spa',
  556
+				'content' => '',
  557
+			) + $data
  558
+		);
  559
+		$this->assertEquals($expected, $result);
  560
+	}
  561
+
  562
+/**
535 563
  * testSaveUpdate method
536 564
  *
537 565
  * @return void

0 notes on commit 5e680cb

Please sign in to comment.
Something went wrong with that request. Please try again.