Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1640 from dlondero/issue-1640
Browse files Browse the repository at this point in the history
Sort `CM_Paging_Language_Enabled` by name
  • Loading branch information
dlondero committed Feb 16, 2015
2 parents 96bd652 + 82730c7 commit f272e7d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/CM/Paging/Language/Enabled.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class CM_Paging_Language_Enabled extends CM_Paging_Language_Abstract {

public function __construct() {
$source = new CM_PagingSource_Sql('id, abbreviation', 'cm_model_language', 'enabled = 1');
$source = new CM_PagingSource_Sql('id, abbreviation', 'cm_model_language', 'enabled = 1', 'name ASC');
$source->enableCacheLocal();
parent::__construct($source);
}
Expand Down
20 changes: 20 additions & 0 deletions tests/library/CM/Paging/Language/EnabledTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

class CM_Paging_Language_EnabledTest extends CMTest_TestCase {

public function tearDown() {
CMTest_TH::clearEnv();
}

public function testEnabled() {
$english = CM_Model_Language::create('English', 'en', true);
$italian = CM_Model_Language::create('Italian', 'it', true);
$german = CM_Model_Language::create('German', 'de', true);
$french = CM_Model_Language::create('French', 'fr', true);
$svenska = CM_Model_Language::create('Svenska', 'sv', false);

$paging = new CM_Paging_Language_Enabled();
$this->assertEquals([$english, $french, $german, $italian], $paging->getItems());
$this->assertNotContains($svenska, $paging->getItems());
}
}

0 comments on commit f272e7d

Please sign in to comment.