Permalink
Browse files

Test case that demonstrates issue with count and Translate

  • Loading branch information...
robmcvey authored and markstory committed Jan 16, 2014
1 parent 46eda80 commit 7a27650297ad2a9fb873bba4dc1572fcea165dfd
Showing with 30 additions and 0 deletions.
  1. +30 −0 lib/Cake/Test/Case/Model/Behavior/TranslateBehaviorTest.php
@@ -274,6 +274,36 @@ public function testLocaleSingleWithConditions() {
);
$this->assertEquals($expected, $result);
}
+
+/**
+ * testLocaleSingleCountWithConditions method
+ *
+ * @return void
+ */
+ public function testLocaleSingleCountWithConditions() {
+ $this->loadFixtures('Translate', 'TranslatedItem');
+
+ $TestModel = new TranslatedItem();
+ $TestModel->locale = 'eng';
+ $result = $TestModel->find('all', array('conditions' => array('slug' => 'first_translated')));
+ $expected = array(
+ array(
+ 'TranslatedItem' => array(
+ 'id' => 1,
+ 'slug' => 'first_translated',
+ 'locale' => 'eng',
+ 'title' => 'Title #1',
+ 'content' => 'Content #1',
+ 'translated_article_id' => 1,
+ )
+ )
+ );
+ $this->assertEquals($expected, $result);
+
+ $result = $TestModel->find('count', array('conditions' => "TranslatedItem.slug = 'first_translated'"));
+ $expected = 1;
+ $this->assertEquals($expected, $result);
+ }
/**
* testLocaleSingleAssociations method

0 comments on commit 7a27650

Please sign in to comment.