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:
authorStefan Giehl <stefan@matomo.org>2021-08-17 10:58:59 +0300
committerGitHub <noreply@github.com>2021-08-17 10:58:59 +0300
commit0829d6e6ac487bf47e4197123d6683b271db8266 (patch)
tree77f8edd0c326b29c50d9fefd174cd45d5ebcbc92 /plugins
parent8c7fa7d8d414b5201c36661fb4828d14e4c33c53 (diff)
Run AllTests on PHP8 (#16897)
* Run AllTests on PHP8 * use newer phpunit for tests on PHP8 * fix notices/errors * handle trace of phpunit 9 * ensure to compare same types for range check * adjust expected result for php8 * try handling hasDependencies does not exist in PHPUnit 9 * fix: ArgumentCountError: mysqli_stmt::bind_param() does not accept unknown named parameters * Fix usercountry tests * remove incorrect date check * fix expected exception message * fix referrers api test for php8 * add test hint * try to fix session related tests * debug test failure * try to fix mail tests * fix filterUser method * exlucde phpunit from build size calculation * fix scheduled reports test * update release checklist test * unset climode * improves some tests
Diffstat (limited to 'plugins')
-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
18 files changed, 60 insertions, 63 deletions
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']));