blob: 31b41ab330cd94a3c000c523a4e54105c0d59f14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
<?php
/**
* Piwik - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Tests\Unit\DataTable\Filter;
use Piwik\DataTable;
use Piwik\DataTable\Row;
/**
* @group DataTableTest
*/
class DataTable_Filter_AddSummaryRowTest extends \PHPUnit_Framework_TestCase
{
/**
* @group AddSummaryRow
* @group Core
*/
public function testAddSummaryRow()
{
$dataTable = $this->getDataTableCount5();
$dataTable->filter('AddSummaryRow');
$this->assertEquals(6, $dataTable->getRowsCount());
$expectedColumns = array(
'label' => '-1',
'nb' => 11111
);
$this->assertEquals($expectedColumns, $dataTable->getLastRow()->getColumns());
}
/**
* Returns table used for the tests
*
* @return DataTable
*/
protected function getDataTableCount5()
{
$table = new DataTable;
$table->addRow($this->getRow0());
$table->addRow($this->getRow1());
$table->addRow($this->getRow2());
$table->addRow($this->getRow3());
$table->addRow($this->getRow4());
return $table;
}
protected function getRow0()
{
return new Row(array(Row::COLUMNS => array('nb' => 10000, 'label' => 'amazon')));
}
protected function getRow1()
{
return new Row(array(Row::COLUMNS => array('label' => 'yahoo', 'nb' => 1000)));
}
protected function getRow2()
{
return new Row(array(Row::COLUMNS => array('label' => 'piwik', 'nb' => 100)));
}
protected function getRow3()
{
return new Row(array(Row::COLUMNS => array('label' => 'ask', 'nb' => 10)));
}
protected function getRow4()
{
return new Row(array(Row::COLUMNS => array('nb' => 1, 'label' => 'google')));
}
}
|