1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-22 15:07:44 +00:00
Files
matomo/tests/PHPUnit/System/OneVisitorOneWebsiteSeveralDaysDateRangeTest.php
Michal Kleiner 9a3ef94df6 [Coding Style] Enable rule PSR12.Files.FileHeader + unify file headers (#22132)
* [Coding Style] Enable rule PSR12.Files.FileHeader

* Apply CS

* Replace Piwik with Matomo in file headers

* Unify file headers (position, no. of lines, https links)

* Rebuild dist files

* Apply CS

* Fix system test that relies on line numbers in a file that had the file header updated

---------

Co-authored-by: Stefan Giehl <stefan@matomo.org>
2024-04-20 20:50:47 +02:00

126 خطوط
5.7 KiB
PHP

<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Tests\System;
use Piwik\Tests\Framework\TestCase\SystemTestCase;
use Piwik\Tests\Fixtures\VisitsOverSeveralDays;
/**
* Use case testing various important features:
* - Test Multisites API use cases
* - testing period=range use case.
* - Recording data before and after, checking that the requested range is processed correctly
* - and more
*
* @group OneVisitorOneWebsiteSeveralDaysDateRangeTest
* @group Core
*/
class OneVisitorOneWebsiteSeveralDaysDateRangeTest extends SystemTestCase
{
public static $fixture = null; // initialized below class definition
/**
* @dataProvider getApiForTesting
*/
public function testApi($api, $params)
{
$this->runApiTests($api, $params);
}
public function getApiForTesting()
{
$idSite = self::$fixture->idSite;
return array(
// FIRST some MultiSites API goodness!
// range test
array('MultiSites.getAll', array('date' => '2010-12-15,2011-01-15',
'periods' => array('range')
// Testing without &pattern= so should return all sites
)),
// range test
array('MultiSites.getAll', array('date' => '2010-12-15,2011-01-15',
'periods' => array('range'),
'testSuffix' => '_Truncated',
// Testing with filter_truncate should return an `Others` row
'otherRequestParameters' => ['filter_truncate' => '0'],
)),
// test several dates (tests use of IndexedByDate w/ 'date1,date2,etc.')
array('MultiSites.getAll', array('date' => '2010-12-15',
'periods' => array('day'),
'testSuffix' => '_IndexedByDate',
// Testing the pattern to getAll restrict websites using name matching
'otherRequestParameters' => array('pattern' => 'aAa')
)),
// test getOne call used in MobileMessaging SMS reports
array('MultiSites.getOne', array('date' => '2010-12-15,2011-01-15',
'periods' => array('range'),
'idSite' => $idSite,
// Testing without &pattern= so should return all sites
)),
// test that multiple periods are not supported
array('MultiSites.getAll', array('date' => '2010-12-15,2011-01-15',
'periods' => array('day'),
'testSuffix' => '_MultipleDatesNotSupported',
)),
// test that multiple periods are not supported
array('MultiSites.getAll', array('date' => '2010-12-15',
'periods' => array('day'),
'testSuffix' => '_showColumns',
'otherRequestParameters' => array('showColumns' => 'nb_visits,visits_evolution')
)),
//---------------------------------------
// THEN some Socials tests. Share these...
array('Referrers.getSocials', array('idSite' => 'all',
'date' => '2010-12-13,2011-01-18',
'periods' => array('range'))),
array('Referrers.getSocials', array('idSite' => $idSite,
'date' => '2010-12-13,2011-01-18',
'testSuffix' => '_Flattened',
'otherRequestParameters' => array('flat' => '1'),
'periods' => array('range'))),
array('Referrers.getSocials', array('idSite' => 'all',
'date' => '2010-12-10',
'periods' => array('day'),
'setDateLastN' => true,
'testSuffix' => '_IndexedByDate')),
array('Referrers.getUrlsForSocial', array('idSite' => 'all', // test w/o idSubtable
'date' => '2010-12-13,2011-01-18',
'periods' => 'range',
'testSuffix' => '_noIdSubtable')),
array('Referrers.getUrlsForSocial', array('idSite' => 1, // test w/ idSubtable
'date' => '2010-12-13,2011-01-18',
'periods' => 'range',
'supertableApi' => 'Referrers.getSocials')),
array('UserCountry.getCountry', array('idSite' => $idSite,
'date' => '2010-12-01,2011-01-15',
'periods' => array('range'))),
);
}
public static function getOutputPrefix()
{
return 'oneVisitor_oneWebsite_severalDays_DateRange';
}
}
OneVisitorOneWebsiteSeveralDaysDateRangeTest::$fixture = new VisitsOverSeveralDays();