Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattpiwik <matthieu.aubry@gmail.com>2007-08-25 00:27:48 +0400
committermattpiwik <matthieu.aubry@gmail.com>2007-08-25 00:27:48 +0400
commit68b5cb3b902024d66c36c1f106c5f272ac57d7fa (patch)
treebc955fc3dbc61d4cf2bf0612c770d31c3e6a8666 /tests/modules/DataTable.test.php
parent4699079d2edfe0ea11e3035e9b260c7d8182e119 (diff)
- Translation
- filter to name the columns - API for the modules actions, provider, UserCountry, Visitfrquency, visitinterest, time, - HALF of the api for referers - improved XML export nwo using PEAR xml serializer git-svn-id: http://dev.piwik.org/svn/trunk@49 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'tests/modules/DataTable.test.php')
-rw-r--r--tests/modules/DataTable.test.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/modules/DataTable.test.php b/tests/modules/DataTable.test.php
index e99b732cc4..086205804d 100644
--- a/tests/modules/DataTable.test.php
+++ b/tests/modules/DataTable.test.php
@@ -511,6 +511,57 @@ class Test_Piwik_DataTable extends UnitTestCase
}
/**
+ * Test to sort by label queing the filter
+ */
+ function test_filter_Queue_SortString()
+ {
+
+ $idcol = Piwik_DataTable_Row::COLUMNS;
+
+ $table = new Piwik_DataTable;
+ $rows = array(
+ array( $idcol => array('label'=>'google')),//0
+ array( $idcol => array('label'=>'tsk')),//1
+ array( $idcol => array('label'=>'Q*(%&*("$&%*(&"$*")"))')),//2
+ );
+ $table->loadFromArray( $rows );
+
+ $expectedtable = new Piwik_DataTable;
+ $rows = array(
+ array( $idcol => array('label'=>'google')),//0
+ array( $idcol => array('label'=>'Q*(%&*("$&%*(&"$*")"))')),//2
+ array( $idcol => array('label'=>'tsk')),//1
+ );
+ $expectedtable->loadFromArray( $rows );
+
+ $expectedtableReverse = new Piwik_DataTable;
+ $expectedtableReverse->loadFromArray(array_reverse($rows));
+
+ $tableCopy = clone $table;
+ $this->assertTrue(Piwik_DataTable::isEqual($tableCopy, $table));
+
+ // queue the filter and check the table didnt change
+ $table->queueFilter("Piwik_DataTable_Filter_Sort", array('label', 'asc'));
+ $this->assertTrue(Piwik_DataTable::isEqual($tableCopy, $table));
+
+ // apply filter and check the table is sorted
+ $table->applyQueuedFilters();
+ $this->assertTrue(Piwik_DataTable::isEqual($expectedtable, $table));
+
+ // apply one more filter check it hasnt changed
+ $table->queueFilter("Piwik_DataTable_Filter_Sort", array('label', 'desc'));
+ $this->assertTrue(Piwik_DataTable::isEqual($expectedtable, $table));
+
+ // now apply the second sort and check it is correctly sorted
+ $table->applyQueuedFilters();
+ $this->assertTrue(Piwik_DataTable::isEqual($expectedtableReverse, $table));
+
+ // do one more time to make sure it doesnt change
+ $table->applyQueuedFilters();
+ $this->assertTrue(Piwik_DataTable::isEqual($expectedtableReverse, $table));
+ }
+
+ /**
* Test to sort by visit
*/
function test_filter_SortNumeric()