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:
-rw-r--r--.travis.yml16
-rw-r--r--core/DataTable/Filter/RangeCheck.php8
-rw-r--r--plugins/CoreAdminHome/tests/Integration/APITest.php2
-rw-r--r--plugins/CustomDimensions/tests/Integration/Dimension/DimensionTest.php2
-rw-r--r--plugins/CustomDimensions/tests/Integration/Dimension/ExtractionTest.php1
-rw-r--r--plugins/CustomJsTracker/tests/Integration/FileTest.php1
-rw-r--r--plugins/CustomJsTracker/tests/Integration/TrackerUpdaterTest.php1
-rw-r--r--plugins/Goals/tests/Integration/APITest.php16
-rw-r--r--plugins/Login/tests/Integration/PasswordVerifierTest.php2
-rw-r--r--plugins/MobileMessaging/ReportRenderer/Sms.php2
-rw-r--r--plugins/Monolog/tests/Unit/Processor/ExceptionToTextProcessorTest.php19
-rw-r--r--plugins/Referrers/tests/System/ApiTest.php2
-rw-r--r--plugins/Referrers/tests/System/expected/test_phpSerialized8__Referrers.getReferrerType_year.original1
-rw-r--r--plugins/ScheduledReports/tests/Integration/ApiTest.php49
-rw-r--r--plugins/ScheduledReports/tests/Integration/ReportEmailGenerator/AttachedFileReportEmailGeneratorTest.php12
-rw-r--r--plugins/SitesManager/tests/Integration/SitesManagerTest.php2
-rw-r--r--plugins/TwoFactorAuth/tests/Integration/TwoFactorAuthTest.php3
-rw-r--r--plugins/UserCountry/tests/Integration/APITest.php5
-rw-r--r--plugins/UsersManager/UserAccessFilter.php2
-rw-r--r--plugins/UsersManager/tests/Integration/UsersManagerTest.php1
-rw-r--r--tests/PHPUnit/Fixtures/InvalidVisits.php2
-rw-r--r--tests/PHPUnit/Framework/TestCase/SystemTestCase.php9
-rw-r--r--tests/PHPUnit/Framework/TestRequest/Response.php3
-rw-r--r--tests/PHPUnit/Integration/DataAccess/LogAggregatorTest.php2
-rw-r--r--tests/PHPUnit/Integration/DbTest.php4
-rw-r--r--tests/PHPUnit/Integration/HttpTest.php2
-rw-r--r--tests/PHPUnit/Integration/ReleaseCheckListTest.php233
-rw-r--r--tests/PHPUnit/System/BackwardsCompatibility1XTest.php3
-rw-r--r--tests/PHPUnit/System/ConsoleTest.php13
29 files changed, 303 insertions, 115 deletions
diff --git a/.travis.yml b/.travis.yml
index f646794b30..9ea764c617 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -69,12 +69,20 @@ matrix:
sudo: false
addons: false
# All tests after another
- - php: 7.4
- env: TEST_SUITE=AllTests MYSQL_ADAPTER=MYSQLI ALLTEST_EXTRA_OPTIONS="--run-first-half-only"
+ - php: 8.0
+ env: TEST_SUITE=AllTests MYSQL_ADAPTER=MYSQLI ALLTEST_EXTRA_OPTIONS="--run-first-half-only" SKIP_COMPOSER_INSTALL=1
sudo: required
- - php: 7.4
- env: TEST_SUITE=AllTests MYSQL_ADAPTER=MYSQLI ALLTEST_EXTRA_OPTIONS="--run-second-half-only"
+ before_install:
+ - composer install --ignore-platform-reqs
+ - composer remove --dev phpunit/phpunit
+ - composer require --dev phpunit/phpunit ~9.3 --ignore-platform-reqs
+ - php: 8.0
+ env: TEST_SUITE=AllTests MYSQL_ADAPTER=MYSQLI ALLTEST_EXTRA_OPTIONS="--run-second-half-only" SKIP_COMPOSER_INSTALL=1
sudo: required
+ before_install:
+ - composer install --ignore-platform-reqs
+ - composer remove --dev phpunit/phpunit
+ - composer require --dev phpunit/phpunit ~9.3 --ignore-platform-reqs
# UITests use a specific version because the default 5.5 (== 5.5.38) is missing FreeType support
- php: 7.2
env: TEST_SUITE=UITests MYSQL_ADAPTER=PDO_MYSQL UITEST_EXTRA_OPTIONS="--num-test-groups=3 --test-group=0"
diff --git a/core/DataTable/Filter/RangeCheck.php b/core/DataTable/Filter/RangeCheck.php
index 52127033c2..8d0ad56b4d 100644
--- a/core/DataTable/Filter/RangeCheck.php
+++ b/core/DataTable/Filter/RangeCheck.php
@@ -51,9 +51,9 @@ class RangeCheck extends BaseFilter
if ($value === false) {
$value = $row->getMetadata($this->columnToFilter);
if ($value !== false) {
- if ($value < (float) self::$minimumValue) {
+ if ((float) $value < (float) self::$minimumValue) {
$row->setMetadata($this->columnToFilter, self::$minimumValue);
- } elseif ($value > (float) self::$maximumValue) {
+ } elseif ((float) $value > (float) self::$maximumValue) {
$row->setMetadata($this->columnToFilter, self::$maximumValue);
}
}
@@ -61,9 +61,9 @@ class RangeCheck extends BaseFilter
}
if ($value !== false) {
- if ($value < (float) self::$minimumValue) {
+ if ((float) $value < (float) self::$minimumValue) {
$row->setColumn($this->columnToFilter, self::$minimumValue);
- } elseif ($value > (float) self::$maximumValue) {
+ } elseif ((float) $value > (float) self::$maximumValue) {
$row->setColumn($this->columnToFilter, self::$maximumValue);
}
}
diff --git a/plugins/CoreAdminHome/tests/Integration/APITest.php b/plugins/CoreAdminHome/tests/Integration/APITest.php
index ba7e246349..73b01f23cf 100644
--- a/plugins/CoreAdminHome/tests/Integration/APITest.php
+++ b/plugins/CoreAdminHome/tests/Integration/APITest.php
@@ -68,6 +68,7 @@ class APITest extends \Piwik\Tests\Framework\TestCase\IntegrationTestCase
public function test_deleteAllTrackingFailures_WorksForAdminAndSuperuser()
{
+ $this->expectNotToPerformAssertions();
$this->setAdminUser();
$this->api->deleteAllTrackingFailures();
$this->setSuperUser();
@@ -94,6 +95,7 @@ class APITest extends \Piwik\Tests\Framework\TestCase\IntegrationTestCase
public function test_deleteTrackingFailure_WorksForAdminAndSuperuser()
{
+ $this->expectNotToPerformAssertions();
$this->setAdminUser();
$this->api->deleteTrackingFailure(1, 2);
$this->setSuperUser();
diff --git a/plugins/CustomDimensions/tests/Integration/Dimension/DimensionTest.php b/plugins/CustomDimensions/tests/Integration/Dimension/DimensionTest.php
index 93cba4d4f8..d6c13e14b5 100644
--- a/plugins/CustomDimensions/tests/Integration/Dimension/DimensionTest.php
+++ b/plugins/CustomDimensions/tests/Integration/Dimension/DimensionTest.php
@@ -37,6 +37,7 @@ class DimensionTest extends IntegrationTestCase
public function test_checkExists_shouldNotFailIfDimensionExists()
{
+ $this->expectNotToPerformAssertions();
$this->getDimension($this->id1, 1)->checkExists();
$this->getDimension($this->id2, 1)->checkExists();
$this->getDimension($this->id3, 1)->checkExists();
@@ -52,6 +53,7 @@ class DimensionTest extends IntegrationTestCase
public function test_checkActive_shouldNotFailIfDimensionExistsAndIsActive()
{
+ $this->expectNotToPerformAssertions();
$this->getDimension($this->id1, 1)->checkActive();
$this->getDimension($this->id2, 1)->checkActive();
}
diff --git a/plugins/CustomDimensions/tests/Integration/Dimension/ExtractionTest.php b/plugins/CustomDimensions/tests/Integration/Dimension/ExtractionTest.php
index 82201edd28..eb9f73a75f 100644
--- a/plugins/CustomDimensions/tests/Integration/Dimension/ExtractionTest.php
+++ b/plugins/CustomDimensions/tests/Integration/Dimension/ExtractionTest.php
@@ -198,6 +198,7 @@ class ExtractionTest extends IntegrationTestCase
public function test_check_shouldNotFailWhenValidCombinationsAreGiven()
{
+ $this->expectNotToPerformAssertions();
$this->buildExtraction('url', 'index_(+).html')->check();
$this->buildExtraction('action_name', 'index_(+).html')->check();
$this->buildExtraction('url', '')->check(); // empty value is allowed
diff --git a/plugins/CustomJsTracker/tests/Integration/FileTest.php b/plugins/CustomJsTracker/tests/Integration/FileTest.php
index 2713c9f3cb..c3700de390 100644
--- a/plugins/CustomJsTracker/tests/Integration/FileTest.php
+++ b/plugins/CustomJsTracker/tests/Integration/FileTest.php
@@ -170,6 +170,7 @@ class FileTest extends IntegrationTestCase
public function test_checkWritable_shouldNotThrowException_IfDirectoryIsWritable()
{
+ $this->expectNotToPerformAssertions();
$this->makeNotReadableFile_inWritableDirectory()->checkWritable();
}
diff --git a/plugins/CustomJsTracker/tests/Integration/TrackerUpdaterTest.php b/plugins/CustomJsTracker/tests/Integration/TrackerUpdaterTest.php
index 487b5f37e4..bec258cdee 100644
--- a/plugins/CustomJsTracker/tests/Integration/TrackerUpdaterTest.php
+++ b/plugins/CustomJsTracker/tests/Integration/TrackerUpdaterTest.php
@@ -123,6 +123,7 @@ class TrackerUpdaterTest extends IntegrationTestCase
public function test_checkWillSucceed_shouldNotThrowExceptionIfTargetIsWritable()
{
+ $this->expectNotToPerformAssertions();
$updater = $this->makeUpdater(null, $this->dir . 'MyNotExisIngFilessss.js');
$updater->checkWillSucceed();
}
diff --git a/plugins/Goals/tests/Integration/APITest.php b/plugins/Goals/tests/Integration/APITest.php
index 12ce5cb09f..478dadaad6 100644
--- a/plugins/Goals/tests/Integration/APITest.php
+++ b/plugins/Goals/tests/Integration/APITest.php
@@ -43,17 +43,13 @@ class APITest extends IntegrationTestCase
*/
public function test_addGoal_handlesAppropriatePatternTypesForNumericAttributes($matchAttribute, $patternType, $pattern, $expectException)
{
- try {
- $this->api->addGoal($this->idSite, 'test goal', $matchAttribute, $pattern, $patternType);
-
- if ($expectException) {
- $this->fail('addGoal should have failed');
- }
- } catch (\Exception $ex) {
- if (!$expectException) {
- throw $ex;
- }
+ if ($expectException) {
+ $this->expectException(\Exception::class);
+ } else {
+ $this->expectNotToPerformAssertions();
}
+
+ $this->api->addGoal($this->idSite, 'test goal', $matchAttribute, $pattern, $patternType);
}
public function getTestDataForNumericMatchAttribute()
diff --git a/plugins/Login/tests/Integration/PasswordVerifierTest.php b/plugins/Login/tests/Integration/PasswordVerifierTest.php
index 7a84f44e7e..6bfb3942e2 100644
--- a/plugins/Login/tests/Integration/PasswordVerifierTest.php
+++ b/plugins/Login/tests/Integration/PasswordVerifierTest.php
@@ -31,6 +31,8 @@ class PasswordVerifierTest extends IntegrationTestCase
{
parent::setUp();
+ \Zend_Session::$_unitTestEnabled = true;
+
$this->verifier = new CustomPasswordVerifier();
$this->verifier->setDisableRedirect();
}
diff --git a/plugins/MobileMessaging/ReportRenderer/Sms.php b/plugins/MobileMessaging/ReportRenderer/Sms.php
index 69db8c9293..d95e453a37 100644
--- a/plugins/MobileMessaging/ReportRenderer/Sms.php
+++ b/plugins/MobileMessaging/ReportRenderer/Sms.php
@@ -77,7 +77,7 @@ class Sms extends ReportRenderer
return preg_replace_callback(
$floatRegex,
function ($matches) {
- return round($matches[0]);
+ return round((float) $matches[0]);
},
$value
);
diff --git a/plugins/Monolog/tests/Unit/Processor/ExceptionToTextProcessorTest.php b/plugins/Monolog/tests/Unit/Processor/ExceptionToTextProcessorTest.php
index e06049f8ba..eb427bf01c 100644
--- a/plugins/Monolog/tests/Unit/Processor/ExceptionToTextProcessorTest.php
+++ b/plugins/Monolog/tests/Unit/Processor/ExceptionToTextProcessorTest.php
@@ -8,13 +8,13 @@
namespace Piwik\Plugins\Monolog\tests\Unit\Processor;
+use PHPUnit\Runner\Version;
use Piwik\Access;
use Piwik\Common;
use Piwik\Db;
use Piwik\Log;
use Piwik\Piwik;
use Piwik\Plugins\Monolog\Processor\ExceptionToTextProcessor;
-use Piwik\SettingsPiwik;
/**
* @group Log
@@ -167,7 +167,7 @@ test message
#11 {main}
EOI;
- $this->assertEquals($expected, $wholeTrace);
+ $this->assertEquals($this->handleNewerPHPUnitTrace($expected), $wholeTrace);
}
public function test_getMessageAndWholeBacktrace_printsBacktraceIf_PIWIK_PRINT_ERROR_BACKTRACE_isDefined()
@@ -196,7 +196,7 @@ test message
#11 {main}
EOI;
- $this->assertEquals($expected, $wholeTrace);
+ $this->assertEquals($this->handleNewerPHPUnitTrace($expected), $wholeTrace);
}
public function test_getMessageAndWholeBacktrace_printsBacktraceIf_PIWIK_TRACKER_DEBUG_globalIsSet()
@@ -225,7 +225,7 @@ test message
#11 {main}
EOI;
- $this->assertEquals($expected, $wholeTrace);
+ $this->assertEquals($this->handleNewerPHPUnitTrace($expected), $wholeTrace);
}
public function test_getMessageAndWholeBacktrace_handlesArrayInput_whenBacktraceIsEnabled()
@@ -315,6 +315,15 @@ caused by: caused by 2
#11 {main}
EOI;
- $this->assertEquals($expected, $wholeTrace);
+ $this->assertEquals($this->handleNewerPHPUnitTrace($expected), $wholeTrace);
+ }
+
+ private function handleNewerPHPUnitTrace($input)
+ {
+ if (version_compare(Version::id(), '9.0', '>=')) {
+ $input = str_replace('TestRunner->doRun', 'TestRunner->run', $input);
+ }
+
+ return $input;
}
}
diff --git a/plugins/Referrers/tests/System/ApiTest.php b/plugins/Referrers/tests/System/ApiTest.php
index 6dad34603c..7d6ba4c4e5 100644
--- a/plugins/Referrers/tests/System/ApiTest.php
+++ b/plugins/Referrers/tests/System/ApiTest.php
@@ -62,7 +62,7 @@ class ApiTest extends SystemTestCase
'idSite' => 1,
'date' => '2010-01-01',
'periods' => 'year',
- 'testSuffix' => 'phpSerialized' . (version_compare(PHP_VERSION, '7.4', '>=') ? '74' : ''),
+ 'testSuffix' => 'phpSerialized' . (version_compare(PHP_VERSION, '8', '>=') ? 8 : (version_compare(PHP_VERSION, '7.4', '>=') ? '74' : '')),
'format' => 'original',
],
];
diff --git a/plugins/Referrers/tests/System/expected/test_phpSerialized8__Referrers.getReferrerType_year.original b/plugins/Referrers/tests/System/expected/test_phpSerialized8__Referrers.getReferrerType_year.original
new file mode 100644
index 0000000000..1a7eac1d06
--- /dev/null
+++ b/plugins/Referrers/tests/System/expected/test_phpSerialized8__Referrers.getReferrerType_year.original
@@ -0,0 +1 @@
+O:15:"Piwik\DataTable":4:{s:7:"*rows";a:2:{i:0;O:19:"Piwik\DataTable\Row":4:{i:0;i:0;i:1;a:9:{s:5:"label";s:14:"Search Engines";s:9:"nb_visits";i:31;s:10:"nb_actions";i:31;s:11:"max_actions";d:1;s:16:"sum_visit_length";i:0;s:12:"bounce_count";i:31;s:19:"nb_visits_converted";i:0;s:26:"sum_daily_nb_uniq_visitors";i:31;s:18:"sum_daily_nb_users";i:0;}i:2;a:5:{s:15:"maxVisitsSummed";i:0;s:29:"Piwik\DataTable\Rowmetadata";a:2:{s:7:"segment";s:20:"referrerType==search";s:13:"referrer_type";i:2;}s:37:"Piwik\DataTable\RowisSubtableLoaded";b:0;s:10:"subtableId";N;s:33:"Piwik\DataTable\RowisSummaryRow";b:0;}i:3;N;}i:1;O:19:"Piwik\DataTable\Row":4:{i:0;i:0;i:1;a:12:{s:5:"label";s:8:"Websites";s:9:"nb_visits";i:31;s:10:"nb_actions";i:31;s:11:"max_actions";d:1;s:16:"sum_visit_length";i:11315;s:12:"bounce_count";i:31;s:19:"nb_visits_converted";i:31;s:5:"goals";a:2:{s:8:"idgoal=1";a:3:{s:14:"nb_conversions";i:31;s:19:"nb_visits_converted";i:31;s:7:"revenue";d:0;}s:8:"idgoal=2";a:3:{s:14:"nb_conversions";i:62;s:19:"nb_visits_converted";i:31;s:7:"revenue";d:0;}}s:14:"nb_conversions";i:93;s:7:"revenue";d:0;s:26:"sum_daily_nb_uniq_visitors";i:31;s:18:"sum_daily_nb_users";i:0;}i:2;a:5:{s:15:"maxVisitsSummed";i:0;s:29:"Piwik\DataTable\Rowmetadata";a:2:{s:7:"segment";s:21:"referrerType==website";s:13:"referrer_type";i:3;}s:37:"Piwik\DataTable\RowisSubtableLoaded";b:0;s:10:"subtableId";N;s:33:"Piwik\DataTable\RowisSummaryRow";b:0;}i:3;N;}}s:13:"*summaryRow";N;s:11:"*metadata";a:7:{s:11:"ts_archived";s:19:"today-date-removed-in-tests";s:4:"site";O:10:"Piwik\Site":2:{s:5:"*id";i:1;s:16:"Piwik\Sitesite";a:20:{s:6:"idsite";i:1;s:4:"name";s:10:"Piwik test";s:8:"main_url";s:16:"http://piwik.net";s:10:"ts_created";s:19:"2010-01-31 11:22:33";s:9:"ecommerce";i:0;s:10:"sitesearch";i:1;s:29:"sitesearch_keyword_parameters";s:0:"";s:30:"sitesearch_category_parameters";s:0:"";s:8:"timezone";s:3:"UTC";s:8:"currency";s:3:"USD";s:20:"exclude_unknown_urls";i:0;s:12:"excluded_ips";s:0:"";s:19:"excluded_parameters";s:0:"";s:20:"excluded_user_agents";s:0:"";s:5:"group";s:0:"";s:4:"type";s:7:"website";s:17:"keep_url_fragment";i:0;s:13:"creator_login";s:14:"superUserLogin";s:13:"timezone_name";s:3:"UTC";s:13:"currency_name";s:9:"US Dollar";}}s:6:"period";O:17:"Piwik\Period\Year":1:{s:7:"*date";O:10:"Piwik\Date":2:{s:12:"*timestamp";i:1262304000;s:11:"*timezone";s:3:"UTC";}}s:7:"segment";s:0:"";s:13:"segmentPretty";s:10:"All visits";s:6:"totals";a:15:{s:9:"nb_visits";i:62;s:10:"nb_actions";i:62;s:11:"max_actions";d:1;s:16:"sum_visit_length";i:11315;s:12:"bounce_count";i:62;s:19:"nb_visits_converted";i:31;s:26:"sum_daily_nb_uniq_visitors";i:62;s:18:"sum_daily_nb_users";i:0;s:5:"goals";a:2:{s:8:"idgoal=1";a:3:{s:14:"nb_conversions";i:31;s:19:"nb_visits_converted";i:31;s:7:"revenue";d:0;}s:8:"idgoal=2";a:3:{s:14:"nb_conversions";i:62;s:19:"nb_visits_converted";i:31;s:7:"revenue";d:0;}}s:14:"nb_conversions";i:93;s:7:"revenue";d:0;s:15:"conversion_rate";s:3:"50%";s:20:"nb_actions_per_visit";d:1;s:16:"avg_time_on_site";d:183;s:11:"bounce_rate";s:4:"100%";}s:17:"totalsUnformatted";a:15:{s:9:"nb_visits";i:62;s:10:"nb_actions";i:62;s:11:"max_actions";d:1;s:16:"sum_visit_length";i:11315;s:12:"bounce_count";i:62;s:19:"nb_visits_converted";i:31;s:26:"sum_daily_nb_uniq_visitors";i:62;s:18:"sum_daily_nb_users";i:0;s:5:"goals";a:2:{s:8:"idgoal=1";a:3:{s:14:"nb_conversions";i:31;s:19:"nb_visits_converted";i:31;s:7:"revenue";d:0;}s:8:"idgoal=2";a:3:{s:14:"nb_conversions";i:62;s:19:"nb_visits_converted";i:31;s:7:"revenue";d:0;}}s:14:"nb_conversions";i:93;s:7:"revenue";d:0;s:15:"conversion_rate";d:0.5;s:20:"nb_actions_per_visit";d:1;s:16:"avg_time_on_site";d:183;s:11:"bounce_rate";d:1;}}s:12:"*totalsRow";N;} \ No newline at end of file
diff --git a/plugins/ScheduledReports/tests/Integration/ApiTest.php b/plugins/ScheduledReports/tests/Integration/ApiTest.php
index 1284d17be0..e5bf8b3f20 100644
--- a/plugins/ScheduledReports/tests/Integration/ApiTest.php
+++ b/plugins/ScheduledReports/tests/Integration/ApiTest.php
@@ -68,11 +68,11 @@ class ApiTest extends IntegrationTestCase
];
Piwik::addAction(APIScheduledReports::GET_REPORT_TYPES_EVENT, function (&$reportTypes) {
- $reportTypes[] = 'dummyreporttype';
+ $reportTypes['dummyreporttype'] = 'dummyreporttype.png';
});
Piwik::addAction(APIScheduledReports::GET_REPORT_FORMATS_EVENT, function (&$reportFormats) {
- $reportFormats[] = 'dummyreportformat';
+ $reportFormats['dummyreportformat'] = 'dummyreportformat.png';
});
Piwik::addAction(APIScheduledReports::GET_REPORT_METADATA_EVENT, function (&$availableReportData, $reportType, $idSite) {
@@ -182,12 +182,8 @@ class ApiTest extends IntegrationTestCase
*/
public function testGetReportsIdReportNotFound()
{
- try {
- APIScheduledReports::getInstance()->getReports($idSite = false, $period = false, $idReport = 1);
- } catch (Exception $e) {
- return;
- }
- $this->fail('Expected exception not raised');
+ $this->expectException(Exception::class);
+ APIScheduledReports::getInstance()->getReports($idSite = false, $period = false, $idReport = 1);
}
/**
@@ -195,17 +191,12 @@ class ApiTest extends IntegrationTestCase
*/
public function testGetReportsInvalidPermission()
{
- try {
- APIScheduledReports::getInstance()->getReports(
- $idSite = 44,
- $period = false,
- self::addReport(self::getDailyPDFReportData($this->idSite))
- );
-
- } catch (Exception $e) {
- return;
- }
- $this->fail('Expected exception not raised');
+ $this->expectException(Exception::class);
+ APIScheduledReports::getInstance()->getReports(
+ $idSite = 44,
+ $period = false,
+ self::addReport(self::getDailyPDFReportData($this->idSite))
+ );
}
/**
@@ -213,12 +204,8 @@ class ApiTest extends IntegrationTestCase
*/
public function testAddReportInvalidWebsite()
{
- try {
- self::addReport(self::getDailyPDFReportData(33));
- } catch (Exception $e) {
- return;
- }
- $this->fail('Expected exception not raised');
+ $this->expectException(Exception::class);
+ self::addReport(self::getDailyPDFReportData(33));
}
/**
@@ -226,14 +213,10 @@ class ApiTest extends IntegrationTestCase
*/
public function testAddReportInvalidPeriod()
{
- try {
- $data = self::getDailyPDFReportData($this->idSite);
- $data['period'] = 'dx';
- self::addReport($data);
- } catch (Exception $e) {
- return;
- }
- $this->fail('Expected exception not raised');
+ $this->expectException(Exception::class);
+ $data = self::getDailyPDFReportData($this->idSite);
+ $data['period'] = 'dx';
+ self::addReport($data);
}
/**
diff --git a/plugins/ScheduledReports/tests/Integration/ReportEmailGenerator/AttachedFileReportEmailGeneratorTest.php b/plugins/ScheduledReports/tests/Integration/ReportEmailGenerator/AttachedFileReportEmailGeneratorTest.php
index 38653743bf..b56a958ce9 100644
--- a/plugins/ScheduledReports/tests/Integration/ReportEmailGenerator/AttachedFileReportEmailGeneratorTest.php
+++ b/plugins/ScheduledReports/tests/Integration/ReportEmailGenerator/AttachedFileReportEmailGeneratorTest.php
@@ -67,9 +67,7 @@ class AttachedFileReportEmailGeneratorTest extends IntegrationTestCase
$this->assertEquals('General_Report report - pretty date', $mail->getSubject());
self::assertStringContainsString('ScheduledReports_PleaseFindAttachedFile', $mailContent);
self::assertStringContainsString('ScheduledReports_SentFromX', $mailContent);
- $this->assertStringContainsString("Content-Type: text/html; charset=utf-8
-Content-Transfer-Encoding: quoted-printable
-", $this->mail->createBody());
+ self::assertStringContainsString("Content-Type: text/html; charset=utf-8" . PHPMailer::getLE() . "Content-Transfer-Encoding: quoted-printable" . PHPMailer::getLE(), $this->mail->createBody());
$attachments = $this->mail->getAttachments();
$this->assertEquals([
@@ -109,9 +107,7 @@ Content-Transfer-Encoding: quoted-printable
$this->assertStringStartsWith('<html', $mailContent);
self::assertStringContainsString('ScheduledReports_PleaseFindAttachedFile', $mailContent);
- $this->assertStringContainsString("Content-Type: text/html; charset=utf-8
-Content-Transfer-Encoding: quoted-printable
-", $this->mail->createBody());
+ self::assertStringContainsString("Content-Type: text/html; charset=utf-8" . PHPMailer::getLE() . "Content-Transfer-Encoding: quoted-printable" . PHPMailer::getLE(), $this->mail->createBody());
}
public function test_makeEmail_AddsSegmentInformation_IfReportIsForSavedSegment()
@@ -140,9 +136,7 @@ Content-Transfer-Encoding: quoted-printable
self::assertStringContainsString("ScheduledReports_PleaseFindAttachedFile", $mailContent);
self::assertStringContainsString('ScheduledReports_SentFromX', $mailContent);
self::assertStringContainsString('ScheduledReports_CustomVisitorSegment', $mailContent);
- $this->assertStringContainsString("Content-Type: text/html; charset=utf-8
-Content-Transfer-Encoding: quoted-printable
-", $this->mail->createBody());
+ self::assertStringContainsString("Content-Type: text/html; charset=utf-8" . PHPMailer::getLE() . "Content-Transfer-Encoding: quoted-printable" . PHPMailer::getLE(), $this->mail->createBody());
}
private function getMailContent(Mail $mail)
diff --git a/plugins/SitesManager/tests/Integration/SitesManagerTest.php b/plugins/SitesManager/tests/Integration/SitesManagerTest.php
index ac51890c09..f4605122f9 100644
--- a/plugins/SitesManager/tests/Integration/SitesManagerTest.php
+++ b/plugins/SitesManager/tests/Integration/SitesManagerTest.php
@@ -168,6 +168,8 @@ class SitesManagerTest extends IntegrationTestCase
$_GET['idSite'] = $this->siteId;
+ \Zend_Session::$_unitTestEnabled = true;
+
Piwik::postEvent('Request.dispatch', [&$module, &$action, &$params]);
$this->assertEquals('SitesManager', $module);
diff --git a/plugins/TwoFactorAuth/tests/Integration/TwoFactorAuthTest.php b/plugins/TwoFactorAuth/tests/Integration/TwoFactorAuthTest.php
index 78a6c2f055..7291082949 100644
--- a/plugins/TwoFactorAuth/tests/Integration/TwoFactorAuthTest.php
+++ b/plugins/TwoFactorAuth/tests/Integration/TwoFactorAuthTest.php
@@ -137,8 +137,9 @@ class TwoFactorAuthTest extends IntegrationTestCase
$this->assertEmpty($this->dao->getAllRecoveryCodesForLogin($this->userWith2Fa));
}
- public function test_onDeleteUser_DoesNotFailToAddUserNotUsingTwoFa()
+ public function test_onDeleteUser_DoesNotFailToDeleteUserNotUsingTwoFa()
{
+ $this->expectNotToPerformAssertions();
Request::processRequest('UsersManager.deleteUser', array(
'userLogin' => $this->userWithout2Fa
));
diff --git a/plugins/UserCountry/tests/Integration/APITest.php b/plugins/UserCountry/tests/Integration/APITest.php
index e9d22b8556..3a15c3875f 100644
--- a/plugins/UserCountry/tests/Integration/APITest.php
+++ b/plugins/UserCountry/tests/Integration/APITest.php
@@ -6,7 +6,7 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
-namespace Piwik\Plugins\UserCountry\tests;
+namespace Piwik\Plugins\UserCountry\tests\Integration;
use Piwik\Access;
use Piwik\Common;
@@ -88,6 +88,9 @@ class APITest extends IntegrationTestCase
$_SERVER['REMOTE_ADDR'] = $ipAddressHeader;
}
+ // Default provider will guess the location based on HTTP_ACCEPT_LANGUAGE header
+ $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'en_US';
+
$location = $this->api->getLocationFromIP($ipAddress);
$this->assertEquals($expected, $location);
}
diff --git a/plugins/UsersManager/UserAccessFilter.php b/plugins/UsersManager/UserAccessFilter.php
index e331c20bb3..f37c372cfd 100644
--- a/plugins/UsersManager/UserAccessFilter.php
+++ b/plugins/UsersManager/UserAccessFilter.php
@@ -112,7 +112,7 @@ class UserAccessFilter
/**
* Returns the given user only if the current user has permission to see the given user
* @param array $user An array containing a key 'login'
- * @return bool
+ * @return array|null
*/
public function filterUser($user)
{
diff --git a/plugins/UsersManager/tests/Integration/UsersManagerTest.php b/plugins/UsersManager/tests/Integration/UsersManagerTest.php
index 248c0315b7..0b345aeb37 100644
--- a/plugins/UsersManager/tests/Integration/UsersManagerTest.php
+++ b/plugins/UsersManager/tests/Integration/UsersManagerTest.php
@@ -240,7 +240,6 @@ class UsersManagerTest extends IntegrationTestCase
// check that the date registered is correct
$this->assertTrue($time <= strtotime($user['date_registered']) && strtotime($user['date_registered']) <= time(),
"the date_registered " . strtotime($user['date_registered']) . " is different from the time() " . time());
- $this->assertTrue($user['date_registered'] <= time());
// check that password and token are properly set
$this->assertEquals(60, strlen($user['password']));
diff --git a/tests/PHPUnit/Fixtures/InvalidVisits.php b/tests/PHPUnit/Fixtures/InvalidVisits.php
index 3b813f7e7a..f697c196a6 100644
--- a/tests/PHPUnit/Fixtures/InvalidVisits.php
+++ b/tests/PHPUnit/Fixtures/InvalidVisits.php
@@ -125,7 +125,7 @@ class InvalidVisits extends Fixture
Cache::regenerateCacheWebsiteAttributes([1]);
try {
- @$t->setAttributionInfo(array());
+ @$t->setAttributionInfo(json_encode(array()));
self::fail();
} catch (Exception $e) {
}
diff --git a/tests/PHPUnit/Framework/TestCase/SystemTestCase.php b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php
index 8a3f929188..2fd52b615f 100644
--- a/tests/PHPUnit/Framework/TestCase/SystemTestCase.php
+++ b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php
@@ -840,6 +840,15 @@ abstract class SystemTestCase extends TestCase
{
return array();
}
+
+ public function hasDependencies(): bool
+ {
+ if (method_exists($this, 'requires')) {
+ return count($this->requires()) > 0;
+ }
+
+ return parent::hasDependencies();
+ }
}
SystemTestCase::$fixture = new \Piwik\Tests\Framework\Fixture();
diff --git a/tests/PHPUnit/Framework/TestRequest/Response.php b/tests/PHPUnit/Framework/TestRequest/Response.php
index 6d224d30a2..c173ef5237 100644
--- a/tests/PHPUnit/Framework/TestRequest/Response.php
+++ b/tests/PHPUnit/Framework/TestRequest/Response.php
@@ -12,7 +12,6 @@ use Piwik\API\Request;
use PHPUnit\Framework\Assert as Asserts;
use Exception;
use Piwik\Tests\Framework\Fixture;
-use Piwik\Tests\Framework\TestCase\SystemTestCase;
/**
* Utility class used to obtain and process API responses for API tests.
@@ -235,7 +234,7 @@ class Response
// check we didn't delete the whole string
if ($testNotSmallAfter && $input != $oldInput) {
- Asserts::assertTrue(strlen($input) > 100);
+ Asserts::assertTrue(strlen($input) > 100, "Removing element $xmlElement from request " . http_build_query($this->requestUrl) . " resulted in a too small value:\n$input");
}
return $input;
}
diff --git a/tests/PHPUnit/Integration/DataAccess/LogAggregatorTest.php b/tests/PHPUnit/Integration/DataAccess/LogAggregatorTest.php
index 62ee9e5419..a8311bdd09 100644
--- a/tests/PHPUnit/Integration/DataAccess/LogAggregatorTest.php
+++ b/tests/PHPUnit/Integration/DataAccess/LogAggregatorTest.php
@@ -157,7 +157,7 @@ class LogAggregatorTest extends IntegrationTestCase
Config::getInstance()->General['archiving_query_max_execution_time'] = 0.001;
try {
$this->logAggregator->getDb()->query('SELECT SLEEP(5) FROM ' . Common::prefixTable('log_visit'));
- $this->fail('Query was not aborted by may execution limit');
+ $this->fail('Query was not aborted by max execution limit');
} catch (\Zend_Db_Statement_Exception $e) {
$isMaxExecutionTimeError = $this->logAggregator->getDb()->isErrNo($e, DbMigration::ERROR_CODE_MAX_EXECUTION_TIME_EXCEEDED_QUERY_INTERRUPTED)
|| $this->logAggregator->getDb()->isErrNo($e, DbMigration::ERROR_CODE_MAX_EXECUTION_TIME_EXCEEDED_SORT_ABORTED)
diff --git a/tests/PHPUnit/Integration/DbTest.php b/tests/PHPUnit/Integration/DbTest.php
index 4c276d1eae..81442862a4 100644
--- a/tests/PHPUnit/Integration/DbTest.php
+++ b/tests/PHPUnit/Integration/DbTest.php
@@ -46,8 +46,8 @@ class DbTest extends IntegrationTestCase
PRIMARY KEY (testid)
)");
- Db::query("INSERT INTO `$table` (testvalue) VALUES (?)", ['a' => 4]);
- Db::query("INSERT INTO `$table` (testvalue) VALUES (?)", ['b' => null]);
+ Db::query("INSERT INTO `$table` (testvalue) VALUES (?)", [4]);
+ Db::query("INSERT INTO `$table` (testvalue) VALUES (?)", [null]);
$values = Db::fetchAll("SELECT testid, testvalue FROM `$table`");
diff --git a/tests/PHPUnit/Integration/HttpTest.php b/tests/PHPUnit/Integration/HttpTest.php
index df02f479ee..dc09b7d7f5 100644
--- a/tests/PHPUnit/Integration/HttpTest.php
+++ b/tests/PHPUnit/Integration/HttpTest.php
@@ -287,7 +287,7 @@ class HttpTest extends \PHPUnit\Framework\TestCase
public function testFopenHttpsFailsWithInvalidCertificate()
{
$this->expectException(\Exception::class);
- $this->expectExceptionMessage('failed to open stream');
+ $this->expectExceptionMessageMatches('/failed to open stream/i');
// use a domain from https://badssl.com/
Http::sendHttpRequestBy('fopen', 'https://self-signed.badssl.com/', 10);
diff --git a/tests/PHPUnit/Integration/ReleaseCheckListTest.php b/tests/PHPUnit/Integration/ReleaseCheckListTest.php
index c8f5e68b47..a54c8be820 100644
--- a/tests/PHPUnit/Integration/ReleaseCheckListTest.php
+++ b/tests/PHPUnit/Integration/ReleaseCheckListTest.php
@@ -9,13 +9,12 @@
namespace Piwik\Tests\Integration;
use Exception;
+use Matomo\Ini\IniReader;
use PHPUnit\Framework\TestCase;
-use Piwik\Application\Kernel\PluginList;
use Piwik\AssetManager\UIAssetFetcher;
use Piwik\Config;
use Piwik\Container\StaticContainer;
use Piwik\Filesystem;
-use Matomo\Ini\IniReader;
use Piwik\Http;
use Piwik\Plugin;
use Piwik\Plugin\Manager;
@@ -73,9 +72,9 @@ class ReleaseCheckListTest extends \PHPUnit\Framework\TestCase
{
link(PIWIK_INCLUDE_PATH . "/plugins/Morpheus/fonts/matomo.ttf", "temp.ttf");
$command = PIWIK_INCLUDE_PATH . "/../travis_woff2/woff2_compress 'temp.ttf'";
- passthru($command);
+ $log = shell_exec($command);
- $this->assertFileEquals('temp.woff2', PIWIK_INCLUDE_PATH . "/plugins/Morpheus/fonts/matomo.woff2");
+ $this->assertFileEquals('temp.woff2', PIWIK_INCLUDE_PATH . "/plugins/Morpheus/fonts/matomo.woff2", "woff2 file is out of date.\nCommand output:\n" . $log);
}
public function test_minimumPHPVersion_isEnforced()
@@ -166,6 +165,9 @@ class ReleaseCheckListTest extends \PHPUnit\Framework\TestCase
foreach ($submodules as $submodule) {
$submodule = trim(trim($submodule), './');
+ if ($submodule === 'travis') {
+ continue; // avoid error output for travis submodule
+ }
$pluginLfsFiles = shell_exec('cd ' . PIWIK_DOCUMENT_ROOT.'/'.$submodule . ' && git lfs ls-files');
if (!empty($pluginLfsFiles)) {
$pluginLfsFiles = explode("\n", $pluginLfsFiles);
@@ -735,7 +737,7 @@ class ReleaseCheckListTest extends \PHPUnit\Framework\TestCase
}
// ignore downloaded geoip files
- if(strpos($file, 'GeoIP') !== false && strpos($file, '.dat') !== false) {
+ if((strpos($file, 'GeoIP') !== false || strpos($file, 'DBIP') !== false) && strpos($file, '.mmdb') !== false) {
return false;
}
@@ -818,7 +820,7 @@ class ReleaseCheckListTest extends \PHPUnit\Framework\TestCase
private function isFilePathFoundInArray($file, $filesToMatchAgainst)
{
foreach ($filesToMatchAgainst as $devPackageName) {
- if (strpos($file, $devPackageName) !== false) {
+ if (strpos($file, $devPackageName) !== false || fnmatch(PIWIK_INCLUDE_PATH.'/'.$devPackageName, $file)) {
return true;
}
}
@@ -831,17 +833,18 @@ class ReleaseCheckListTest extends \PHPUnit\Framework\TestCase
*/
private function isFileDeletedFromPackage($file)
{
- $filesDeletedFromPackage = array(
- // Should stay synchronised with: https://github.com/piwik/piwik-package/blob/master/scripts/build-package.sh#L104-L116
+ $filesAndFoldersToDeleteFromPackage = [
+ # Should stay synchronised with: https://github.com/matomo/matomo-package/blob/master/scripts/build-package.sh#L104-L116
'composer.phar',
+ 'vendor/bin/',
'vendor/twig/twig/test/',
'vendor/twig/twig/doc/',
'vendor/symfony/console/Symfony/Component/Console/Resources/bin',
- 'vendor/doctrine/cache/.git',
'vendor/tecnickcom/tcpdf/examples',
'vendor/tecnickcom/tcpdf/CHANGELOG.TXT',
- 'vendor/php-di/php-di/benchmarks/',
'vendor/guzzle/guzzle/docs/',
+ 'vendor/davaxi/sparkline/tests',
+ 'vendor/php-di/php-di/benchmarks/',
'vendor/geoip2/geoip2/.gitmodules',
'vendor/geoip2/geoip2/.php_cs',
'vendor/maxmind-db/reader/ext/',
@@ -849,35 +852,197 @@ class ReleaseCheckListTest extends \PHPUnit\Framework\TestCase
'vendor/maxmind-db/reader/CHANGELOG.md',
'vendor/maxmind/web-service-common/dev-bin/',
'vendor/maxmind/web-service-common/CHANGELOG.md',
-
- // deleted fonts folders
+ 'vendor/php-di/invoker/doc/',
+ 'vendor/szymach/c-pchart/doc',
+ 'vendor/leafo/lessphp/docs',
+ 'vendor/container-interop/container-interop/docs',
+ 'vendor/pear/archive_tar/docs',
+
+ # Delete un-used files from the matomo-icons repository
+ 'plugins/Morpheus/icons/src*',
+ 'plugins/Morpheus/icons/tools*',
+ 'plugins/Morpheus/icons/flag-icon-css*',
+ 'plugins/Morpheus/icons/submodules*',
+ 'plugins/Morpheus/icons/.git*',
+ 'plugins/Morpheus/icons/.travis.yml',
+ 'plugins/Morpheus/icons/*.py',
+ 'plugins/Morpheus/icons/*.sh',
+ 'plugins/Morpheus/icons/*.json',
+ 'plugins/Morpheus/icons/*.lock',
+ 'plugins/Morpheus/icons/*.svg',
+ 'plugins/Morpheus/icons/*.txt',
+ 'plugins/Morpheus/icons/*.php',
+ 'plugins/Morpheus/icons/*.yml',
+
+ 'plugins/Example*',
+
+ # Delete un-used fonts
'vendor/tecnickcom/tcpdf/fonts/ae_fonts_2.0',
'vendor/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-2.33',
'vendor/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-2.34',
'vendor/tecnickcom/tcpdf/fonts/freefont-20100919',
'vendor/tecnickcom/tcpdf/fonts/freefont-20120503',
-
- // In the package script, there is a trailing * so any font matching will be deleted
- 'vendor/tecnickcom/tcpdf/fonts/freemon',
- 'vendor/tecnickcom/tcpdf/fonts/cid',
- 'vendor/tecnickcom/tcpdf/fonts/courier',
- 'vendor/tecnickcom/tcpdf/fonts/aefurat',
- 'vendor/tecnickcom/tcpdf/fonts/dejavusansb',
- 'vendor/tecnickcom/tcpdf/fonts/dejavusansi',
- 'vendor/tecnickcom/tcpdf/fonts/dejavusansmono',
- 'vendor/tecnickcom/tcpdf/fonts/dejavusanscondensed',
- 'vendor/tecnickcom/tcpdf/fonts/dejavusansextralight',
- 'vendor/tecnickcom/tcpdf/fonts/dejavuserif',
- 'vendor/tecnickcom/tcpdf/fonts/freesansi',
- 'vendor/tecnickcom/tcpdf/fonts/freesansb',
- 'vendor/tecnickcom/tcpdf/fonts/freeserifb',
- 'vendor/tecnickcom/tcpdf/fonts/freeserifi',
- 'vendor/tecnickcom/tcpdf/fonts/pdf',
- 'vendor/tecnickcom/tcpdf/fonts/times',
- 'vendor/tecnickcom/tcpdf/fonts/uni2cid',
- );
-
- return $this->isFilePathFoundInArray($file, $filesDeletedFromPackage);
+ 'vendor/tecnickcom/tcpdf/fonts/freemon*',
+ 'vendor/tecnickcom/tcpdf/fonts/cid*',
+ 'vendor/tecnickcom/tcpdf/fonts/courier*',
+ 'vendor/tecnickcom/tcpdf/fonts/aefurat*',
+ 'vendor/tecnickcom/tcpdf/fonts/dejavusansb*',
+ 'vendor/tecnickcom/tcpdf/fonts/dejavusansi*',
+ 'vendor/tecnickcom/tcpdf/fonts/dejavusansmono*',
+ 'vendor/tecnickcom/tcpdf/fonts/dejavusanscondensed*',
+ 'vendor/tecnickcom/tcpdf/fonts/dejavusansextralight*',
+ 'vendor/tecnickcom/tcpdf/fonts/dejavuserif*',
+ 'vendor/tecnickcom/tcpdf/fonts/freesansi*',
+ 'vendor/tecnickcom/tcpdf/fonts/freesansb*',
+ 'vendor/tecnickcom/tcpdf/fonts/freeserifb*',
+ 'vendor/tecnickcom/tcpdf/fonts/freeserifi*',
+ 'vendor/tecnickcom/tcpdf/fonts/pdf*',
+ 'vendor/tecnickcom/tcpdf/fonts/times*',
+ 'vendor/tecnickcom/tcpdf/fonts/uni2cid*',
+
+ 'vendor/szymach/c-pchart/src/Resources/fonts/advent_light*',
+ 'vendor/szymach/c-pchart/src/Resources/fonts/Bedizen*',
+ 'vendor/szymach/c-pchart/src/Resources/fonts/calibri*',
+ 'vendor/szymach/c-pchart/src/Resources/fonts/Forgotte*',
+ 'vendor/szymach/c-pchart/src/Resources/fonts/MankSans*',
+ 'vendor/szymach/c-pchart/src/Resources/fonts/pf_arma_five*',
+ 'vendor/szymach/c-pchart/src/Resources/fonts/Silkscreen*',
+ 'vendor/szymach/c-pchart/src/Resources/fonts/verdana*',
+
+ # not needed js files
+ 'node_modules/angular/angular.min.js.gzip',
+ 'node_modules/angular/angular.js',
+ 'node_modules/angular/bower.json',
+
+ 'node_modules/angular-animate/angular-animate.min.js.gzip',
+ 'node_modules/angular-animate/angular-animate.js',
+ 'node_modules/angular-animate/bower.json',
+
+ 'node_modules/angular-sanitize/angular-sanitize.min.js.gzip',
+ 'node_modules/angular-sanitize/angular-sanitize.js',
+ 'node_modules/angular-sanitize/bower.json',
+
+ 'node_modules/angular-cookies/angular-cookies.min.js.gzip',
+ 'node_modules/angular-cookies/angular-cookies.js',
+ 'node_modules/angular-cookies/bower.json',
+
+ 'node_modules/chroma-js/Makefile',
+ 'node_modules/chroma-js/bower.json',
+ 'node_modules/chroma-js/chroma.js',
+ 'node_modules/chroma-js/doc',
+ 'node_modules/chroma-js/readme.md',
+ 'node_modules/chroma-js/src',
+ 'node_modules/chroma-js/test',
+
+ 'node_modules/iframe-resizer/js/iframeResizer.contentWindow.js',
+ 'node_modules/iframe-resizer/js/iframeResizer.js',
+ 'node_modules/iframe-resizer/src/ie8.polyfils.js',
+ 'node_modules/iframe-resizer/src/iframeResizer.contentWindow.js',
+ 'node_modules/iframe-resizer/src/iframeResizer.js',
+ 'node_modules/iframe-resizer/test-main.js',
+ 'node_modules/iframe-resizer/bower.json',
+ 'node_modules/iframe-resizer/gruntfile.js',
+ 'node_modules/iframe-resizer/karma-conf.js',
+
+ 'node_modules/jquery/dist/jquery.js',
+ 'node_modules/jquery/bower.json',
+ 'node_modules/jquery/src',
+ 'node_modules/jquery/external/sizzle/dist/sizzle.js',
+
+ 'node_modules/jquery-ui-dist/component.json',
+ 'node_modules/jquery-ui-dist/external',
+ 'node_modules/jquery-ui-dist/images',
+ 'node_modules/jquery-ui-dist/index.html',
+ 'node_modules/jquery-ui-dist/jquery-ui.css',
+ 'node_modules/jquery-ui-dist/jquery-ui.js',
+ 'node_modules/jquery-ui-dist/jquery-ui.structure.css',
+ 'node_modules/jquery-ui-dist/jquery-ui.theme.css',
+
+ 'node_modules/jquery.browser/Gruntfile.js',
+ 'node_modules/jquery.browser/bower.json',
+ 'node_modules/jquery.browser/test',
+ 'node_modules/jquery.browser/dist/jquery.browser.js',
+
+ 'node_modules/jquery.dotdotdot/bower.json',
+ 'node_modules/jquery.dotdotdot/gulpfile.js',
+ 'node_modules/jquery.dotdotdot/index.html',
+ 'node_modules/jquery.dotdotdot/dotdotdot.jquery.json',
+ 'node_modules/jquery.dotdotdot/src/jquery.dotdotdot.js',
+ 'node_modules/jquery.dotdotdot/src/jquery.dotdotdot.min.umd.js',
+
+ 'node_modules/jquery.scrollto/jquery.scrollTo.js',
+ 'node_modules/jquery.scrollto/scrollTo.jquery.json',
+ 'node_modules/jquery.scrollto/bower.json',
+ 'node_modules/jquery.scrollto/changes.txt',
+ 'node_modules/jquery.scrollto/demo',
+ 'node_modules/jquery.scrollto/tests',
+
+ 'node_modules/materialize-css/Gruntfile.js',
+ 'node_modules/materialize-css/extras',
+ 'node_modules/materialize-css/js',
+ 'node_modules/materialize-css/sass',
+ 'node_modules/materialize-css/dist/js/materialize.js',
+ 'node_modules/materialize-css/dist/css/materialize.css',
+
+ 'node_modules/mousetrap/Gruntfile.js',
+ 'node_modules/mousetrap/mousetrap.js',
+ 'node_modules/mousetrap/tests',
+ 'node_modules/mousetrap/plugins',
+
+ 'node_modules/ng-dialog/CONTRIBUTING.md',
+ 'node_modules/ng-dialog/Gruntfile.js',
+ 'node_modules/ng-dialog/bower.json',
+ 'node_modules/ng-dialog/css',
+ 'node_modules/ng-dialog/example',
+ 'node_modules/ng-dialog/karma.conf.js',
+ 'node_modules/ng-dialog/protractor.conf.js',
+ 'node_modules/ng-dialog/server.js',
+ 'node_modules/ng-dialog/tests',
+
+ 'node_modules/qrcodejs2/bower.json',
+ 'node_modules/qrcodejs2/index-svg.html',
+ 'node_modules/qrcodejs2/index.html',
+ 'node_modules/qrcodejs2/index.svg',
+ 'node_modules/qrcodejs2/jquery.min.js',
+ 'node_modules/qrcodejs2/qrcode.js',
+
+ 'node_modules/sprintf-js/CONTRIBUTORS.MD',
+ 'node_modules/sprintf-js/README.md',
+ 'node_modules/sprintf-js/src',
+
+ 'node_modules/visibilityjs/ChangeLog.md',
+ 'node_modules/visibilityjs/component.json',
+ 'node_modules/visibilityjs/index.d.ts',
+ 'node_modules/visibilityjs/index.js',
+ 'node_modules/visibilityjs/README.md',
+
+ 'libs/jqplot/jqplot.core.js',
+ 'libs/jqplot/jqplot.lineRenderer.js',
+ 'libs/jqplot/jqplot.linearAxisRenderer.js',
+ 'libs/jqplot/jqplot.themeEngine.js',
+ 'libs/jqplot/plugins/jqplot.barRenderer.js',
+ 'libs/jqplot/plugins/jqplot.pieRenderer.js',
+
+ 'config/config.php',
+
+ 'libs/PhpDocumentor-1.3.2/',
+ 'libs/FirePHPCore/',
+ 'libs/open-flash-chart/php-ofc-library/ofc_upload_image.php',
+
+ 'tmp/*',
+ 'misc/updateLanguageFiles.sh',
+ 'misc/others/db-schema*',
+ 'misc/others/diagram_general_request*',
+ '.coveralls.yml',
+ '.scrutinizer.yml',
+ '.phpstorm.meta.php',
+ '.lfsconfig',
+ 'HIRING.md',
+ '.github/',
+
+ ];
+
+ return $this->isFilePathFoundInArray($file, $filesAndFoldersToDeleteFromPackage);
}
/**
diff --git a/tests/PHPUnit/System/BackwardsCompatibility1XTest.php b/tests/PHPUnit/System/BackwardsCompatibility1XTest.php
index 955e5a8196..a8b5b4ebda 100644
--- a/tests/PHPUnit/System/BackwardsCompatibility1XTest.php
+++ b/tests/PHPUnit/System/BackwardsCompatibility1XTest.php
@@ -227,6 +227,9 @@ class BackwardsCompatibility1XTest extends SystemTestCase
// visit length changes slightly with change to previous visitor detection in #13935
'VisitsSummary.getSumVisitsLength',
'VisitsSummary.getSumVisitsLengthPretty',
+
+ // did not exist before Matomo 4
+ 'PagePerformance.get',
);
if (!Manager::getInstance()->isPluginActivated('CustomVariables')) {
diff --git a/tests/PHPUnit/System/ConsoleTest.php b/tests/PHPUnit/System/ConsoleTest.php
index 1fd9d8330d..a82d31ecfb 100644
--- a/tests/PHPUnit/System/ConsoleTest.php
+++ b/tests/PHPUnit/System/ConsoleTest.php
@@ -106,7 +106,7 @@ class TestCommandWithException extends ConsoleCommand
}
/**
- * @group ConsoleTest3
+ * @group ConsoleTest
*/
class ConsoleTest extends ConsoleCommandTestCase
{
@@ -166,7 +166,6 @@ class ConsoleTest extends ConsoleCommandTestCase
$output = $this->normalizeOutput($output);
$expected = <<<END
-#!/usr/bin/env php
PHP Fatal error: Allowed memory size of X bytes exhausted (tried to allocate X bytes) in /tests/PHPUnit/System/ConsoleTest.php on line 85
Fatal error: Allowed memory size of X bytes exhausted (tried to allocate X bytes) in /tests/PHPUnit/System/ConsoleTest.php on line 85
@@ -183,6 +182,10 @@ Matomo encountered an error: Allowed memory size of X bytes exhausted (tried to
))
END;
+ if (PHP_MAJOR_VERSION < 8) {
+ $expected = "#!/usr/bin/env php\n" . $expected;
+ }
+
$this->assertEquals($expected, $output);
}
@@ -196,7 +199,6 @@ END;
$output = $this->normalizeOutput($output);
$expected = <<<END
-#!/usr/bin/env php
*** IN SAFEMODE ***
@@ -211,6 +213,11 @@ test-command-with-exception
END;
+
+ if (PHP_MAJOR_VERSION < 8) {
+ $expected = "#!/usr/bin/env php\n" . $expected;
+ }
+
$this->assertEquals($expected, $output);
}