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

DataTableGenericFilterTest.php « API « Unit « PHPUnit « tests - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4edfb79642ad7f52e184ec2e626be7712b1f4157 (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
<?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\API;

use Piwik\API\DataTableGenericFilter;
use Piwik\DataTable;

class DataTableGenericFilterTest extends \PHPUnit_Framework_TestCase
{
    public function test_genericFiltersToDisableMetadata_shouldBeRespected()
    {
        $dataTable = new DataTable();
        $dataTable->addRowsFromSimpleArray([
            ['nb_visits' => 2, 'nb_actions' => 3],
            ['nb_visits' => 4, 'nb_actions' => 5],
        ]);
        $dataTable->setMetadata(DataTable::GENERIC_FILTERS_TO_DISABLE_METADATA_NAME, ['Limit']);

        $genericFilter = new DataTableGenericFilter(['filter_limit' => 1], null);
        $genericFilter->filter($dataTable);

        $this->assertEquals(2, $dataTable->getRowsCount());
    }
}