Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply coding style around FunctionCallSignature #7 #21933

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 44 additions & 16 deletions plugins/PrivacyManager/tests/Integration/DataPurgingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,8 @@ public function testPurgeLogDataConcurrency()

$this->unusedIdAction = Db::fetchOne(
"SELECT idaction FROM " . Common::prefixTable('log_action') . " WHERE name = ?",
array('whatever.com/_40'));
array('whatever.com/_40')
);
$this->assertTrue($this->unusedIdAction > 0);

// purge data
Expand All @@ -541,7 +542,8 @@ public function testPurgeLogDataConcurrency()
// check that the unused action still exists
$count = Db::fetchOne(
"SELECT COUNT(*) FROM " . Common::prefixTable('log_action') . " WHERE idaction = ?",
array($this->unusedIdAction));
array($this->unusedIdAction)
);
$this->assertEquals(1, $count);

$this->unusedIdAction = null; // so the hook won't get executed twice
Expand Down Expand Up @@ -680,10 +682,21 @@ protected static function _addLogData()
$t->doTrackContentImpression('SugarTransportAd', '/path/ad.jpg', 'http://www.satsumaprovince.jp');

$t->setForceVisitDateTime(Date::factory($dateTime)->addHour(0.2));
$t->addEcommerceItem($sku = 'SKU2', $name = 'Canon SLR', $category = 'Electronics & Cameras',
$price = 1500, $quantity = 1);
$t->doTrackEcommerceOrder($orderId = '937nsjusu ' . $dateTime, $grandTotal = 1111.11, $subTotal = 1000,
$tax = 111, $shipping = 0.11, $discount = 666);
$t->addEcommerceItem(
$sku = 'SKU2',
$name = 'Canon SLR',
$category = 'Electronics & Cameras',
$price = 1500,
$quantity = 1
);
$t->doTrackEcommerceOrder(
$orderId = '937nsjusu ' . $dateTime,
$grandTotal = 1111.11,
$subTotal = 1000,
$tax = 111,
$shipping = 0.11,
$discount = 666
);
}

Fixture::checkBulkTrackingResponse($t->doBulkTrack());
Expand Down Expand Up @@ -720,15 +733,22 @@ protected static function _addReportData()
$archive->getNumeric('nb_visits');

APIVisitorInterest::getInstance()->getNumberOfVisitsPerVisitDuration(
self::$idSite, 'week', $dateTime);
self::$idSite,
'week',
$dateTime
);
}

// add segment for one day
$archive = Archive::build(self::$idSite, 'day', '2012-01-14', 'browserCode==FF');
$archive->getNumeric('nb_visits', 'nb_hits');

APIVisitorInterest::getInstance()->getNumberOfVisitsPerVisitDuration(
self::$idSite, 'day', '2012-01-14', 'browserCode==FF');
self::$idSite,
'day',
'2012-01-14',
'browserCode==FF'
);

// add range within January
$rangeEnd = Date::factory('2012-01-29');
Expand Down Expand Up @@ -784,16 +804,24 @@ protected static function _addReportData()
VALUES (10000,?,1,?,?,?,?,?)";

// one metric for jan & one for feb
Db::query(sprintf($sql, Common::prefixTable($archiveTables['numeric'][0])),
array(self::GARBAGE_FIELD, $janDate1, $janDate1, 1, $janDate1, 100));
Db::query(sprintf($sql, Common::prefixTable($archiveTables['numeric'][1])),
array(self::GARBAGE_FIELD, $febDate1, $febDate1, 1, $febDate1, 200));
Db::query(
sprintf($sql, Common::prefixTable($archiveTables['numeric'][0])),
array(self::GARBAGE_FIELD, $janDate1, $janDate1, 1, $janDate1, 100)
);
Db::query(
sprintf($sql, Common::prefixTable($archiveTables['numeric'][1])),
array(self::GARBAGE_FIELD, $febDate1, $febDate1, 1, $febDate1, 200)
);

// add garbage reports
Db::query(sprintf($sql, Common::prefixTable($archiveTables['blob'][0])),
array(self::GARBAGE_FIELD, $janDate1, $janDate1, 10, $janDate1, 'blobval'));
Db::query(sprintf($sql, Common::prefixTable($archiveTables['blob'][1])),
array(self::GARBAGE_FIELD, $febDate1, $febDate1, 20, $febDate1, 'blobval'));
Db::query(
sprintf($sql, Common::prefixTable($archiveTables['blob'][0])),
array(self::GARBAGE_FIELD, $janDate1, $janDate1, 10, $janDate1, 'blobval')
);
Db::query(
sprintf($sql, Common::prefixTable($archiveTables['blob'][1])),
array(self::GARBAGE_FIELD, $febDate1, $febDate1, 20, $febDate1, 'blobval')
);
}

protected function _checkNoDataChanges()
Expand Down
10 changes: 8 additions & 2 deletions plugins/PrivacyManager/tests/System/PurgeDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,14 @@ private function purgeData($deleteReportsOlderThan, $reportPeriodsToKeep, $keepB
$metricsToKeep = PrivacyManager::getAllMetricsToKeep();
$maxRowsToDeletePerQuery = 100000;

$purger = new ReportsPurger($deleteReportsOlderThan, $keepBasicMetrics, $reportPeriodsToKeep,
$keepSegmentReports, $metricsToKeep, $maxRowsToDeletePerQuery);
$purger = new ReportsPurger(
$deleteReportsOlderThan,
$keepBasicMetrics,
$reportPeriodsToKeep,
$keepSegmentReports,
$metricsToKeep,
$maxRowsToDeletePerQuery
);
$purger->getPurgeEstimate();
$purger->purgeData();
}
Expand Down
7 changes: 5 additions & 2 deletions plugins/Referrers/Categories/SearchEnginesSubcategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ class SearchEnginesSubcategory extends Subcategory
public function getHelp()
{
return '<p>' . Piwik::translate('Referrers_SearchEnginesSubcategoryHelp1') . '</p>'
. '<p>' . Piwik::translate('Referrers_SearchEnginesSubcategoryHelp2',
. '<p>' . Piwik::translate(
'Referrers_SearchEnginesSubcategoryHelp2',
['<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/matomo-cloud/', null, null, 'App.Referrers.getSearchEngines')
. '" rel="noreferrer noopener" target="_blank">', '</a>',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://plugins.matomo.org/SearchEngineKeywordsPerformance', null, null, 'App.Referrers.getSearchEngines')
. '" rel="noreferrer noopener" target="_blank">', '</a>']) . '</p>';
. '" rel="noreferrer noopener" target="_blank">',
'</a>']
) . '</p>';
}
}
6 changes: 4 additions & 2 deletions plugins/Referrers/Reports/GetKeywordsFromCampaignId.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ protected function init()
parent::init();
$this->dimension = new Keyword();
$this->name = Piwik::translate('Referrers_Campaigns');
$this->documentation = Piwik::translate('Referrers_CampaignsReportDocumentation',
['<br />', '<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/docs/tracking-campaigns/') . '" rel="noreferrer noopener" target="_blank">', '</a>']);
$this->documentation = Piwik::translate(
'Referrers_CampaignsReportDocumentation',
['<br />', '<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/docs/tracking-campaigns/') . '" rel="noreferrer noopener" target="_blank">', '</a>']
);
$this->isSubtableReport = true;
$this->order = 10;
}
Expand Down
18 changes: 12 additions & 6 deletions plugins/Referrers/Reports/GetReferrerType.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@ protected function init()
$this->name = Piwik::translate('Referrers_Type');
$this->documentation = Piwik::translate('Referrers_TypeReportDocumentation') . '<br />'
. '<b>' . Piwik::translate('Referrers_DirectEntry') . ':</b> ' . Piwik::translate('Referrers_DirectEntryDocumentation') . '<br />'
. '<b>' . Piwik::translate('Referrers_SearchEngines') . ':</b> ' . Piwik::translate('Referrers_SearchEnginesDocumentation',
array('<br />', '&quot;' . Piwik::translate('Referrers_SubmenuSearchEngines') . '&quot;')) . '<br />'
. '<b>' . Piwik::translate('Referrers_Websites') . ':</b> ' . Piwik::translate('Referrers_WebsitesDocumentation',
array('<br />', '&quot;' . Piwik::translate('Referrers_SubmenuWebsitesOnly') . '&quot;')) . '<br />'
. '<b>' . Piwik::translate('Referrers_Campaigns') . ':</b> ' . Piwik::translate('Referrers_CampaignsDocumentation',
array('<br />', '&quot;' . Piwik::translate('Referrers_Campaigns') . '&quot;'));
. '<b>' . Piwik::translate('Referrers_SearchEngines') . ':</b> ' . Piwik::translate(
'Referrers_SearchEnginesDocumentation',
array('<br />', '&quot;' . Piwik::translate('Referrers_SubmenuSearchEngines') . '&quot;')
) . '<br />'
. '<b>' . Piwik::translate('Referrers_Websites') . ':</b> ' . Piwik::translate(
'Referrers_WebsitesDocumentation',
array('<br />', '&quot;' . Piwik::translate('Referrers_SubmenuWebsitesOnly') . '&quot;')
) . '<br />'
. '<b>' . Piwik::translate('Referrers_Campaigns') . ':</b> ' . Piwik::translate(
'Referrers_CampaignsDocumentation',
array('<br />', '&quot;' . Piwik::translate('Referrers_Campaigns') . '&quot;')
);
$this->constantRowsCount = true;
$this->hasGoalMetrics = true;
$this->order = 1;
Expand Down
3 changes: 2 additions & 1 deletion plugins/ScheduledReports/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public function configureAdminMenu(MenuAdmin $menu)
{
$tooltip = Piwik::translate(
\Piwik\Plugin\Manager::getInstance()->isPluginActivated('MobileMessaging')
? 'MobileMessaging_TopLinkTooltip' : 'ScheduledReports_TopLinkTooltip');
? 'MobileMessaging_TopLinkTooltip' : 'ScheduledReports_TopLinkTooltip'
);

$menu->addPersonalItem(
$this->getTopMenuTranslationKey(),
Expand Down
36 changes: 27 additions & 9 deletions plugins/ScheduledReports/tests/Integration/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,15 @@ public function getAttachments($report, $processedReports, $prettyDate)
});

$idReport = APIScheduledReports::getInstance()->addReport(
$this->idSite, 'send report', 'never', 6, 'dummyreporttype', 'dummyreportformat',
$reportIds, [ScheduledReports::DISPLAY_FORMAT_PARAMETER => ScheduledReports::DISPLAY_FORMAT_TABLES_ONLY]);
$this->idSite,
'send report',
'never',
6,
'dummyreporttype',
'dummyreportformat',
$reportIds,
[ScheduledReports::DISPLAY_FORMAT_PARAMETER => ScheduledReports::DISPLAY_FORMAT_TABLES_ONLY]
);

$eventCalledWith = [];
Piwik::addAction(APIScheduledReports::SEND_REPORT_EVENT, function (
Expand Down Expand Up @@ -436,7 +443,8 @@ public function testGetScheduledTasks()
->disableOriginalConstructor()
->getMock();
$stubbedAPIScheduledReports->expects($this->any())->method('getReports')->will($this->returnValue(
array($report1, $report2, $report3, $report4, $report5, $report6)));
array($report1, $report2, $report3, $report4, $report5, $report6)
));
\Piwik\Plugins\ScheduledReports\API::setSingletonInstance($stubbedAPIScheduledReports);

// initialize sites 1 and 2
Expand Down Expand Up @@ -498,7 +506,8 @@ public function getGetReportSubjectAndReportTitleTestCases()
public function testGetReportSubjectAndReportTitle($expectedReportSubject, $expectedReportTitle, $websiteName, $reports)
{
$getReportSubjectAndReportTitle = new ReflectionMethod(
'\\Piwik\\Plugins\\ScheduledReports\\API', 'getReportSubjectAndReportTitle'
'\\Piwik\\Plugins\\ScheduledReports\\API',
'getReportSubjectAndReportTitle'
);
$getReportSubjectAndReportTitle->setAccessible(true);

Expand Down Expand Up @@ -549,8 +558,12 @@ public function test_generateReport_CatchesIndividualReportProcessExceptions_Wit
);

ob_start();
$result = APIScheduledReports::getInstance()->generateReport($idReport, Date::factory('now')->toString(),
$language = false, $outputType = APIScheduledReports::OUTPUT_RETURN);
$result = APIScheduledReports::getInstance()->generateReport(
$idReport,
Date::factory('now')->toString(),
$language = false,
$outputType = APIScheduledReports::OUTPUT_RETURN
);
ob_end_clean();

self::assertStringContainsString('id="VisitsSummary_get"', $result);
Expand Down Expand Up @@ -578,8 +591,12 @@ public function test_generateReport_throwsIfMultiplePeriodsRequested()
array(ScheduledReports::DISPLAY_FORMAT_PARAMETER => ScheduledReports::DISPLAY_FORMAT_TABLES_ONLY)
);

APIScheduledReports::getInstance()->generateReport($idReport, '2012-03-03,2012-03-23',
$language = false, $outputType = APIScheduledReports::OUTPUT_RETURN);
APIScheduledReports::getInstance()->generateReport(
$idReport,
'2012-03-03,2012-03-23',
$language = false,
$outputType = APIScheduledReports::OUTPUT_RETURN
);
}

public function test_generateReport_throwsIfInvalidDateRequested(): void
Expand Down Expand Up @@ -1002,7 +1019,8 @@ private static function updateReport($idReport, $data)
$data['type'],
$data['format'],
$data['reports'],
$data['parameters']);
$data['parameters']
);
return $idReport;
}

Expand Down
12 changes: 10 additions & 2 deletions plugins/SegmentEditor/SegmentQueryDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,16 @@ public function getSelectQueryString(
$orderBy,
$limit
) {
$result = parent::getSelectQueryString($segmentExpression, $select, $from, $where, $bind, $groupBy, $orderBy,
$limit);
$result = parent::getSelectQueryString(
$segmentExpression,
$select,
$from,
$where,
$bind,
$groupBy,
$orderBy,
$limit
);

$prefixParts = array();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ public function test_UpdateSegment()
'login' => Piwik::getCurrentUserLogin(),
'deleted' => '0',
);
API::getInstance()->update($idSegment2,
API::getInstance()->update(
$idSegment2,
$updatedSegment['name'],
$updatedSegment['definition'],
$updatedSegment['enable_only_idsite'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ public function setUp(): void
Fixture::createWebsite('2011-01-01');

$this->segmentQueryDecorator = self::$fixture->piwikEnvironment->getContainer()->get(
'Piwik\Plugins\SegmentEditor\SegmentQueryDecorator');
'Piwik\Plugins\SegmentEditor\SegmentQueryDecorator'
);

Rules::setBrowserTriggerArchiving(false);

/** @var API $segmentEditorApi */
$segmentEditorApi = self::$fixture->piwikEnvironment->getContainer()->get(
'Piwik\Plugins\SegmentEditor\API');
'Piwik\Plugins\SegmentEditor\API'
);
$segmentEditorApi->add('segment 1', 'visitCount<2', $idSite = false, $autoArchive = true);
$segmentEditorApi->add('segment 2', 'countryCode==fr', $idSite = false, $autoArchive = true);
$segmentEditorApi->add('segment 3', 'visitCount<2', 1, $autoArchive = true);
Expand Down
24 changes: 18 additions & 6 deletions plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,12 @@ public function test_apiOutput_whenPreprocessedSegmentUsed_WithBrowserArchivingD
$this->assertNotEmpty($storedSegment);

Rules::setBrowserTriggerArchiving(true);
VisitsSummary\API::getInstance()->get(self::$fixture->idSite, 'week',
Date::factory(self::$fixture->dateTime)->toString(), self::TEST_SEGMENT); // archive (make sure there's data for actual test)
VisitsSummary\API::getInstance()->get(
self::$fixture->idSite,
'week',
Date::factory(self::$fixture->dateTime)->toString(),
self::TEST_SEGMENT
); // archive (make sure there's data for actual test)
Rules::setBrowserTriggerArchiving(false);

$segments = Rules::getSegmentsToProcess([self::$fixture->idSite]);
Expand All @@ -135,8 +139,12 @@ public function test_apiOutput_whenPreprocessedSegmentUsed_WithBrowserArchivingD

public function test_apiOutput_whenPreprocessedCustomSegmentUsed_WithBrowserArchivingDisabled()
{
VisitsSummary\API::getInstance()->get(self::$fixture->idSite, 'week',
Date::factory(self::$fixture->dateTime)->toString(), self::TEST_SEGMENT); // archive
VisitsSummary\API::getInstance()->get(
self::$fixture->idSite,
'week',
Date::factory(self::$fixture->dateTime)->toString(),
self::TEST_SEGMENT
); // archive

Rules::setBrowserTriggerArchiving(false);

Expand All @@ -162,8 +170,12 @@ public function test_apiOutput_whenPreprocessedSegmentUsed_WithNoData_AndBrowser
$storedSegment = API::getInstance()->get($idSegment);
$this->assertNotEmpty($storedSegment);

VisitsSummary\API::getInstance()->get(self::$fixture->idSite, 'week',
Date::factory(self::$fixture->dateTime)->toString(), self::TEST_SEGMENT); // archive
VisitsSummary\API::getInstance()->get(
self::$fixture->idSite,
'week',
Date::factory(self::$fixture->dateTime)->toString(),
self::TEST_SEGMENT
); // archive

$segments = Rules::getSegmentsToProcess([self::$fixture->idSite]);
self::assertTrue(in_array(self::TEST_SEGMENT, $segments));
Expand Down
Loading
Loading