added a unit test

This commit is contained in:
Val Bancer 2017-07-05 22:40:41 +02:00
parent 31fd4217b1
commit 50334679d6

View file

@ -496,6 +496,26 @@ class PaginatorComponentTest extends CakeTestCase {
$this->assertCount(3, $result); $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 * Test that non-numeric values are rejected for page, and limit
* *