From 50334679d649b03a0b29051f75bc6f9c1b6b6097 Mon Sep 17 00:00:00 2001 From: Val Bancer Date: Wed, 5 Jul 2017 22:40:41 +0200 Subject: [PATCH] added a unit test --- .../Component/PaginatorComponentTest.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php index 5b30514f3..6bc0a1e4c 100644 --- a/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/PaginatorComponentTest.php @@ -496,6 +496,26 @@ class PaginatorComponentTest extends CakeTestCase { $this->assertCount(3, $result); } + public function testPaginateI18nConditionNotTitleWithLimit() { + $Request = new CakeRequest('articles/index'); + $Controller = new PaginatorTestController($Request); + $Controller->uses = array('TranslatedArticle'); + $Controller->constructClasses(); + $Controller->TranslatedArticle->locale = 'eng'; + $Controller->Paginator->settings = array( + 'recursive' => 0, + 'conditions' => array( + 'NOT' => array('I18n__title.content' => ''), + ), + 'limit' => 2, + ); + $result = $Controller->Paginator->paginate('TranslatedArticle'); + $this->assertEquals('Title (eng) #1', $result[0]['TranslatedArticle']['title']); + $this->assertEquals('Title (eng) #2', $result[1]['TranslatedArticle']['title']); + $this->assertEquals('Title (eng) #3', $result[2]['TranslatedArticle']['title']); + $this->assertCount(3, $result); + } + /** * Test that non-numeric values are rejected for page, and limit *