diff --git a/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php b/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php index 00195af7806aeddc916db3ed2ffb6aabd8f203c5..15ff184a15026d843e28b90322a7c2c662ed47e0 100644 --- a/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php +++ b/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php @@ -16,7 +16,7 @@ use Piwik\Plugins\UserCountry\LocationProvider\GeoIp; */ class Test_Piwik_Fixture_ManySitesImportedLogs extends Test_Piwik_BaseFixture { - public $dateTime = '2010-03-06 11:22:33'; + public $dateTime = '2012-08-09 11:22:33'; public $idSite = 1; public $idSite2 = 2; public $idGoal = 1; diff --git a/tests/PHPUnit/Integration/AnnotationsTest.php b/tests/PHPUnit/Integration/AnnotationsTest.php index 5d7b29ccb9e4a458a17eaf047406bf3df62ba9b5..1b0c6d4ce0c3bbfa70ffaf4c3b52cabace8ac142 100755 --- a/tests/PHPUnit/Integration/AnnotationsTest.php +++ b/tests/PHPUnit/Integration/AnnotationsTest.php @@ -14,7 +14,7 @@ class AnnotationsTest extends IntegrationTestCase { public static $fixture = null; - public function getOutputPrefix() + public static function getOutputPrefix() { return 'annotations'; } diff --git a/tests/PHPUnit/Integration/ApiGetReportMetadataTest.php b/tests/PHPUnit/Integration/ApiGetReportMetadataTest.php index 9d19a52a05d2f9332dce7866af1c65126b396605..a81941dc89ba9c03568d4dcbcce84b2630b998e1 100755 --- a/tests/PHPUnit/Integration/ApiGetReportMetadataTest.php +++ b/tests/PHPUnit/Integration/ApiGetReportMetadataTest.php @@ -34,7 +34,7 @@ class Test_Piwik_Integration_ApiGetReportMetadata extends IntegrationTestCase Proxy::getInstance()->setHideIgnoredFunctions(true); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'apiGetReportMetadata'; } diff --git a/tests/PHPUnit/Integration/ApiGetReportMetadata_yearTest.php b/tests/PHPUnit/Integration/ApiGetReportMetadata_yearTest.php index 6863c0775e1697f312a0751d1da243eacc6882e1..44d2d5df98aa8fd4870014186907648eb38672fa 100755 --- a/tests/PHPUnit/Integration/ApiGetReportMetadata_yearTest.php +++ b/tests/PHPUnit/Integration/ApiGetReportMetadata_yearTest.php @@ -30,7 +30,7 @@ class Test_Piwik_Integration_ApiGetReportMetadata_Year extends IntegrationTestCa ); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'apiGetReportMetadata_year'; } diff --git a/tests/PHPUnit/Integration/BlobReportLimitingTest.php b/tests/PHPUnit/Integration/BlobReportLimitingTest.php index 835822ed6aaf649afde345f3e2487da2f810c416..9577e29d06b0447b886aa4ed30e189ed593b3234 100755 --- a/tests/PHPUnit/Integration/BlobReportLimitingTest.php +++ b/tests/PHPUnit/Integration/BlobReportLimitingTest.php @@ -153,7 +153,7 @@ class Test_Piwik_Integration_BlobReportLimitingTest extends IntegrationTestCase } } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'reportLimiting'; } diff --git a/tests/PHPUnit/Integration/CsvExportTest.php b/tests/PHPUnit/Integration/CsvExportTest.php index 737530ccedad7735260bcf1a096c967fc1327d7a..7e84ababdb3daf186fd1f5e0073ae97af6ac6a9e 100755 --- a/tests/PHPUnit/Integration/CsvExportTest.php +++ b/tests/PHPUnit/Integration/CsvExportTest.php @@ -57,7 +57,7 @@ class Test_Piwik_Integration_CsvExport extends IntegrationTestCase $this->runApiTests($api, $params); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'csvExport'; } diff --git a/tests/PHPUnit/Integration/EcommerceOrderWithItemsTest.php b/tests/PHPUnit/Integration/EcommerceOrderWithItemsTest.php index 0de25f5e4b9188d38f56cb698bb59d68f44c8029..3445857b8e1a5a307a8c0f5f932ed225e0a916ea 100755 --- a/tests/PHPUnit/Integration/EcommerceOrderWithItemsTest.php +++ b/tests/PHPUnit/Integration/EcommerceOrderWithItemsTest.php @@ -174,7 +174,7 @@ class Test_Piwik_Integration_EcommerceOrderWithItems extends IntegrationTestCase ), self::getApiForTestingScheduledReports($dateTime, 'week')); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'ecommerceOrderWithItems'; } diff --git a/tests/PHPUnit/Integration/FlattenReportsTest.php b/tests/PHPUnit/Integration/FlattenReportsTest.php index 19d9ed1414457f7a2e673d9c8911e7ef6df77b4e..1a115411954ce42e6c00ba1de9b8f9260fc30d63 100644 --- a/tests/PHPUnit/Integration/FlattenReportsTest.php +++ b/tests/PHPUnit/Integration/FlattenReportsTest.php @@ -112,7 +112,7 @@ class Test_Piwik_Integration_FlattenReports extends IntegrationTestCase return $return; } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'FlattenReports'; } diff --git a/tests/PHPUnit/Integration/ImportLogsTest.php b/tests/PHPUnit/Integration/ImportLogsTest.php index cbb79e257d3ace9977dcc9693c12c1e9877a9266..85cc9100f5973176b935154383d030e4d224ceed 100755 --- a/tests/PHPUnit/Integration/ImportLogsTest.php +++ b/tests/PHPUnit/Integration/ImportLogsTest.php @@ -69,7 +69,7 @@ class Test_Piwik_Integration_ImportLogs extends IntegrationTestCase $this->assertEquals(1, count($whateverDotCom)); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'ImportLogs'; } diff --git a/tests/PHPUnit/Integration/LabelFilterTest.php b/tests/PHPUnit/Integration/LabelFilterTest.php index 3a345c018cfcd7be0455c63e3d6479d90f2e44c0..06171319a5fa681f62e66fa3c12d907c9329ee77 100644 --- a/tests/PHPUnit/Integration/LabelFilterTest.php +++ b/tests/PHPUnit/Integration/LabelFilterTest.php @@ -114,7 +114,7 @@ class Test_Piwik_Integration_LabelFilter extends IntegrationTestCase return $return; } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'LabelFilter'; } diff --git a/tests/PHPUnit/Integration/NoVisitTest.php b/tests/PHPUnit/Integration/NoVisitTest.php index 50cbe20c65a6243e5d1102b88c3fdae8ab160681..7c69b9cd3badb425a81c35e2d1014cd7eb44e5cf 100755 --- a/tests/PHPUnit/Integration/NoVisitTest.php +++ b/tests/PHPUnit/Integration/NoVisitTest.php @@ -39,7 +39,7 @@ class Test_Piwik_Integration_NoVisit extends IntegrationTestCase ); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'noVisit'; } diff --git a/tests/PHPUnit/Integration/NonUnicodeTest.php b/tests/PHPUnit/Integration/NonUnicodeTest.php index 83628577ed14774e7d4fab004484988c70359a13..fb51e6103ff818c81b1bb497818479c5f7c2b10b 100755 --- a/tests/PHPUnit/Integration/NonUnicodeTest.php +++ b/tests/PHPUnit/Integration/NonUnicodeTest.php @@ -40,7 +40,7 @@ class Test_Piwik_Integration_NonUnicodeTest extends IntegrationTestCase ); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'NonUnicode'; } diff --git a/tests/PHPUnit/Integration/OneVisitorOneWebsite_SeveralDaysDateRangeTest.php b/tests/PHPUnit/Integration/OneVisitorOneWebsite_SeveralDaysDateRangeTest.php index 5a96ed8aed3cb8dd8805601e7dfc42a0f28b3de5..1cc4ba9304197e32e0c1ae39168557396916cd14 100755 --- a/tests/PHPUnit/Integration/OneVisitorOneWebsite_SeveralDaysDateRangeTest.php +++ b/tests/PHPUnit/Integration/OneVisitorOneWebsite_SeveralDaysDateRangeTest.php @@ -85,7 +85,7 @@ class Test_Piwik_Integration_OneVisitorOneWebsite_SeveralDaysDateRange extends I ); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'oneVisitor_oneWebsite_severalDays_DateRange'; } diff --git a/tests/PHPUnit/Integration/OneVisitorOneWebsite_SeveralDaysDateRange_ArchivingTestsTest.php b/tests/PHPUnit/Integration/OneVisitorOneWebsite_SeveralDaysDateRange_ArchivingTestsTest.php index a6c53489155eb453781b05c42c93c0968d80c06a..685cb731cbda127fca87d1d8a057dad8f105ab74 100755 --- a/tests/PHPUnit/Integration/OneVisitorOneWebsite_SeveralDaysDateRange_ArchivingTestsTest.php +++ b/tests/PHPUnit/Integration/OneVisitorOneWebsite_SeveralDaysDateRange_ArchivingTestsTest.php @@ -16,7 +16,7 @@ class Test_Piwik_Integration_OneVisitorOneWebsite_SeveralDaysDateRange_Archiving { public static $fixture = null; // initialized below test definition - public function getOutputPrefix() + public static function getOutputPrefix() { return 'oneVisitor_oneWebsite_severalDays_DateRange'; } diff --git a/tests/PHPUnit/Integration/OneVisitorTwoVisits_withCookieSupportTest.php b/tests/PHPUnit/Integration/OneVisitorTwoVisits_withCookieSupportTest.php index 6baa8041922726bd4d97d94ca03d49783f8a8503..ebd5827b861e179de956c978b370e30a7947311c 100755 --- a/tests/PHPUnit/Integration/OneVisitorTwoVisits_withCookieSupportTest.php +++ b/tests/PHPUnit/Integration/OneVisitorTwoVisits_withCookieSupportTest.php @@ -36,7 +36,7 @@ class Test_Piwik_Integration_OneVisitorTwoVisits_WithCookieSupport extends Integ ); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'OneVisitorTwoVisits_withCookieSupport'; } diff --git a/tests/PHPUnit/Integration/OneVisitor_LongUrlsTruncatedTest.php b/tests/PHPUnit/Integration/OneVisitor_LongUrlsTruncatedTest.php index 02156d7a54d60c20903e8372621631dc296045b5..169eabe8b77f9ab0b8ac4f41ab9112fe7ebd8b87 100644 --- a/tests/PHPUnit/Integration/OneVisitor_LongUrlsTruncatedTest.php +++ b/tests/PHPUnit/Integration/OneVisitor_LongUrlsTruncatedTest.php @@ -39,7 +39,7 @@ class Test_Piwik_Integration_OneVisitor_LongUrlsTruncated extends IntegrationTes ); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'OneVisitor_LongUrlsTruncated'; } diff --git a/tests/PHPUnit/Integration/OneVisitor_NoKeywordSpecifiedTest.php b/tests/PHPUnit/Integration/OneVisitor_NoKeywordSpecifiedTest.php index 966c85f2ef1373ff1912933fb1d9af77c60f8997..3054089880f6072c6a682163b4e47324f4109d91 100755 --- a/tests/PHPUnit/Integration/OneVisitor_NoKeywordSpecifiedTest.php +++ b/tests/PHPUnit/Integration/OneVisitor_NoKeywordSpecifiedTest.php @@ -37,7 +37,7 @@ class Test_Piwik_Integration_OneVisitor_NoKeywordSpecified extends IntegrationTe ); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'OneVisitor_NoKeywordSpecified'; } diff --git a/tests/PHPUnit/Integration/PeriodIsRange_DateIsLastN_MetadataAndNormalAPITest.php b/tests/PHPUnit/Integration/PeriodIsRange_DateIsLastN_MetadataAndNormalAPITest.php index 88d2c5bf766f14abeaeac5f25e63e1feb9bd0403..2b9daa943256425aef22f76b49ba6fc0e4245ff8 100755 --- a/tests/PHPUnit/Integration/PeriodIsRange_DateIsLastN_MetadataAndNormalAPITest.php +++ b/tests/PHPUnit/Integration/PeriodIsRange_DateIsLastN_MetadataAndNormalAPITest.php @@ -93,7 +93,7 @@ class Test_Piwik_Integration_PeriodIsRange_DateIsLastN_MetadataAndNormalAPI exte return $result; } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'periodIsRange_dateIsLastN_MetadataAndNormalAPI'; } diff --git a/tests/PHPUnit/Integration/RowEvolutionTest.php b/tests/PHPUnit/Integration/RowEvolutionTest.php index 90266e842d0d9a169c3b2279b47440de4c37d115..5dce031bd6148c29a65c8e2928e9f2c320217036 100755 --- a/tests/PHPUnit/Integration/RowEvolutionTest.php +++ b/tests/PHPUnit/Integration/RowEvolutionTest.php @@ -210,7 +210,7 @@ class Test_Piwik_Integration_RowEvolution extends IntegrationTestCase return $return; } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'RowEvolution'; } diff --git a/tests/PHPUnit/Integration/SiteSearchTest.php b/tests/PHPUnit/Integration/SiteSearchTest.php index 545c794b38248f54924a890cde054023feb50e9b..e8c6ffebccd65224fb64856b535fe3300235e3cd 100755 --- a/tests/PHPUnit/Integration/SiteSearchTest.php +++ b/tests/PHPUnit/Integration/SiteSearchTest.php @@ -81,7 +81,7 @@ class Test_Piwik_Integration_SiteSearch extends IntegrationTestCase return $result; } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'SiteSearch'; } diff --git a/tests/PHPUnit/Integration/TrackCustomVariablesAndCampaigns_ForceUsingVisitIdNotHeuristicsTest.php b/tests/PHPUnit/Integration/TrackCustomVariablesAndCampaigns_ForceUsingVisitIdNotHeuristicsTest.php index 3616dfe3a904caf132b9ea6308fa290c9fa6e677..2138e43771efebbee011f38063c2accceb961e00 100755 --- a/tests/PHPUnit/Integration/TrackCustomVariablesAndCampaigns_ForceUsingVisitIdNotHeuristicsTest.php +++ b/tests/PHPUnit/Integration/TrackCustomVariablesAndCampaigns_ForceUsingVisitIdNotHeuristicsTest.php @@ -34,7 +34,7 @@ class Test_Piwik_Integration_TrackCustomVariablesAndCampaigns_ForceUsingVisitIdN ); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'PiwikTracker_trackForceUsingVisitId_insteadOfHeuristics_alsoTestsCampaignTracking'; } diff --git a/tests/PHPUnit/Integration/TrackGoals_AllowMultipleConversionsPerVisitTest.php b/tests/PHPUnit/Integration/TrackGoals_AllowMultipleConversionsPerVisitTest.php index 828f0334ef4c7b65c2c05c5276234f281f7ae5d6..d691640d6a9e5c0f8a3841567b1d1b785c0097ec 100755 --- a/tests/PHPUnit/Integration/TrackGoals_AllowMultipleConversionsPerVisitTest.php +++ b/tests/PHPUnit/Integration/TrackGoals_AllowMultipleConversionsPerVisitTest.php @@ -52,7 +52,7 @@ class Test_Piwik_Integration_TrackGoals_AllowMultipleConversionsPerVisit extends ); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'trackGoals_allowMultipleConversionsPerVisit'; } diff --git a/tests/PHPUnit/Integration/TrackerWindowLookBack.php b/tests/PHPUnit/Integration/TrackerWindowLookBack.php index f95a45ecfe77375146f7498d74baa0e7641b283b..dfc72fc2be9f199339f215fecc1cb8d78bbcd8af 100644 --- a/tests/PHPUnit/Integration/TrackerWindowLookBack.php +++ b/tests/PHPUnit/Integration/TrackerWindowLookBack.php @@ -37,7 +37,7 @@ class Test_Piwik_Integration_TrackerWindowLookBack extends IntegrationTestCase ); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'TrackerWindowLookBack'; } diff --git a/tests/PHPUnit/Integration/TransitionsTest.php b/tests/PHPUnit/Integration/TransitionsTest.php index 318a6bc0ce53c92443f43f0d9ebd469e64e8ede6..0fc0472f23264b165bd0ca700098f1c557718d87 100644 --- a/tests/PHPUnit/Integration/TransitionsTest.php +++ b/tests/PHPUnit/Integration/TransitionsTest.php @@ -71,7 +71,7 @@ class Test_Piwik_Integration_Transitions extends IntegrationTestCase return $return; } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'Transitions'; } diff --git a/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDaysTest.php b/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDaysTest.php index 5baf9b0abac6964ca7e5568e8b3c97253798894b..b4fc77aa5680e93e829cbe368105bba8fbc63078 100755 --- a/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDaysTest.php +++ b/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDaysTest.php @@ -102,7 +102,7 @@ class Test_Piwik_Integration_TwoVisitors_TwoWebsites_DifferentDays extends Integ return array_merge($result, self::getApiForTestingScheduledReports($dateTime, 'month')); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'TwoVisitors_twoWebsites_differentDays'; } diff --git a/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDays_ArchivingDisabledTest.php b/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDays_ArchivingDisabledTest.php index 89e28bf0b0d923824c220698da2c51c29d21bf6f..112d0dd950dad7ca4e1d09c186d1286da0b84358 100755 --- a/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDays_ArchivingDisabledTest.php +++ b/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDays_ArchivingDisabledTest.php @@ -53,7 +53,7 @@ class Test_Piwik_Integration_TwoVisitors_TwoWebsites_DifferentDays_ArchivingDisa ); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'TwoVisitors_twoWebsites_differentDays_ArchivingDisabled'; } diff --git a/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDays_ConversionsTest.php b/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDays_ConversionsTest.php index 122d527fc0641dfd66fbb927b01dbca8022ca5be..f223a7b66ec20a50b81ef2b6b54624210c169526 100755 --- a/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDays_ConversionsTest.php +++ b/tests/PHPUnit/Integration/TwoVisitors_TwoWebsites_DifferentDays_ConversionsTest.php @@ -104,7 +104,7 @@ class Test_Piwik_Integration_TwoVisitors_TwoWebsites_DifferentDays_Conversions e return $result; } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'TwoVisitors_twoWebsites_differentDays_Conversions'; } diff --git a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariablesTest.php b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariablesTest.php index f1be9716b3497c1c87d8c008e958b94b58b62fae..932ef4ef8b9bcff67c17d957ea59c724fc9b59ee 100755 --- a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariablesTest.php +++ b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariablesTest.php @@ -49,7 +49,7 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables extends IntegrationTes $this->runApiTests($api, $params); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'twoVisitsWithCustomVariables'; } diff --git a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentContainsTest.php b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentContainsTest.php index 648711e9bb071b0363721069a975a206497fa1b3..f7ad0d004ae35aa2b189106f55b4be804521d67d 100755 --- a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentContainsTest.php +++ b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentContainsTest.php @@ -13,7 +13,7 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables_SegmentContains extend { public static $fixture = null; // initialized below class definition - public function getOutputPrefix() + public static function getOutputPrefix() { return 'twoVisitsWithCustomVariables'; } diff --git a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchALL_NoGoalDataTest.php b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchALL_NoGoalDataTest.php index f217be8d0bace6fd4c1150df5e37e48f678001c9..620140dde73e9e5d19fec53a3752655b36b96951 100755 --- a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchALL_NoGoalDataTest.php +++ b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchALL_NoGoalDataTest.php @@ -38,7 +38,7 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables_SegmentMatchALL_NoGoal ); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'twoVisitsWithCustomVariables_segmentMatchALL_noGoalData'; } diff --git a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchNONETest.php b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchNONETest.php index 9a57a57c55948d712cc39ee2275cb753e3f84282..38e4246bde19e22a71bbfa63810cb9ea8c33b76d 100755 --- a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchNONETest.php +++ b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchNONETest.php @@ -70,7 +70,7 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables_SegmentMatchNONE exten return $segment; } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'twoVisitsWithCustomVariables_segmentMatchNONE'; } diff --git a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorTypeTest.php b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorTypeTest.php index 4e6b18cbfc06972f3c0f4c26629746600cf77292..26a0c87605814b55a566e6aa8ce111bcc7e51cb9 100755 --- a/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorTypeTest.php +++ b/tests/PHPUnit/Integration/TwoVisitsWithCustomVariables_SegmentMatchVisitorTypeTest.php @@ -96,7 +96,7 @@ class Test_Piwik_Integration_TwoVisitsWithCustomVariables_SegmentMatchVisitorTyp } } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'twoVisitsWithCustomVariables_segmentMatchVisitorType'; } diff --git a/tests/PHPUnit/Integration/UrlNormalizationTest.php b/tests/PHPUnit/Integration/UrlNormalizationTest.php index 7e8d4fa7a169734ae188cb52a4b647546b0f3792..64046122cd5a5e563852274c302aba23f3a6af72 100644 --- a/tests/PHPUnit/Integration/UrlNormalizationTest.php +++ b/tests/PHPUnit/Integration/UrlNormalizationTest.php @@ -104,7 +104,7 @@ class Test_Piwik_Integration_UrlNormalization extends IntegrationTestCase $this->assertEquals($expected, $urls, "normalization went wrong"); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'UrlNormalization'; } diff --git a/tests/PHPUnit/Integration/VisitsInPast_InvalidateOldReportsTest.php b/tests/PHPUnit/Integration/VisitsInPast_InvalidateOldReportsTest.php index ac6f7e5c0177a0c15cb6490bcf87d4bc804811bd..7df95e39195cce73eb4b34ff914b18063511ce8f 100644 --- a/tests/PHPUnit/Integration/VisitsInPast_InvalidateOldReportsTest.php +++ b/tests/PHPUnit/Integration/VisitsInPast_InvalidateOldReportsTest.php @@ -115,7 +115,7 @@ class Test_Piwik_Integration_VisitsInPast_InvalidateOldReports extends Integrati ); } - public function getOutputPrefix() + public static function getOutputPrefix() { return 'VisitsInPast_InvalidateOldReports'; } diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php index ed567452ae9aedeaf8b2ce2125be7af0d5581b17..b3d7cbeb1e6c85cb701734fe010e77d5c706d473 100755 --- a/tests/PHPUnit/IntegrationTestCase.php +++ b/tests/PHPUnit/IntegrationTestCase.php @@ -941,9 +941,9 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase /** * Gets the string prefix used in the name of the expected/processed output files. */ - public function getOutputPrefix() + public static function getOutputPrefix() { - return str_replace('Test_Piwik_Integration_', '', get_class($this)); + return str_replace('Test_Piwik_Integration_', '', get_called_class()); } protected function _setCallableApi($api) @@ -974,7 +974,7 @@ abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase */ protected function runApiTests($api, $params) { - $testName = 'test_' . $this->getOutputPrefix(); + $testName = 'test_' . static::getOutputPrefix(); $this->missingExpectedFiles = array(); $this->comparisonFailures = array(); diff --git a/tests/PHPUnit/UI/UIIntegrationTest.php b/tests/PHPUnit/UI/UIIntegrationTest.php index b1b95e0df67f48f27ec1f0d99e32eaabe40d17cc..efcc88ce57776f3ea5a7567f6fbd46d98ebdb695 100644 --- a/tests/PHPUnit/UI/UIIntegrationTest.php +++ b/tests/PHPUnit/UI/UIIntegrationTest.php @@ -5,10 +5,6 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -use Piwik\Piwik; -use Piwik\Access; -use Piwik\AssetManager; -use Piwik\Plugins\VisitsSummary\API; /** * Tests UI code by grabbing screenshots of webpages and comparing with expected files. @@ -19,93 +15,9 @@ use Piwik\Plugins\VisitsSummary\API; * - allow instrumentation javascript to be injected before screenshot is taken (so we can, say, * take a screenshot of column documentation) */ -class Test_Piwik_Integration_UIIntegrationTest extends IntegrationTestCase +class Test_Piwik_Integration_UIIntegrationTest extends UITest { - const IMAGE_TYPE = 'png'; - const CAPTURE_PROGRAM = 'phantomjs'; - - public static $fixture = null; // initialized below class definition - - public static function createAccessInstance() - { - Access::setSingletonInstance($access = new Test_Access_OverrideLogin()); - Piwik_PostEvent('FrontController.initAuthenticationObject'); - } - - public static function setUpBeforeClass() - { - if (!self::isXvfbAvailable()) { - self::markTestSkipped("xvfb is not available, skipping UI integration tests. (install with 'sudo apt-get install xvfb')"); - } else if (self::CAPTURE_PROGRAM == 'slimerjs' - && !self::isSlimerJsAvailable() - ) { - self::markTestSkipped("slimerjs is not available, skipping UI integration tests. " - . "(install by downloading http://slimerjs.org/download.html)"); - } else if (self::CAPTURE_PROGRAM == 'phantomjs' - && !self::isPhantomJsAvailable() - ) { - self::markTestSkipped("phantomjs is not available, skipping UI integration tests. " - . "(install by downloading http://phantomjs.org/download.html)"); - } - - parent::setUpBeforeClass(); - - AssetManager::removeMergedAssets(); - - // launch archiving so tests don't run out of time - API::getInstance()->get(self::$fixture->idSite, 'year', '2012-08-09'); - - // make sure processed & expected dirs exist - list($processedDir, $expectedDir) = self::getProcessedAndExpectedDirs(); - if (!is_dir($processedDir)) { - mkdir($processedDir); - } - if (!is_dir($expectedDir)) { - mkdir($expectedDir); - } - - // run slimerjs/phantomjs w/ all urls so we only invoke it once - $urls = array(); - foreach (self::getUrlsForTesting() as $testInfo) { - list($name, $urlQuery) = $testInfo; - - list($processedScreenshotPath, $expectedScreenshotPath) = self::getProcessedAndExpectedScreenshotPaths($name); - $urls[] = array($processedScreenshotPath, self::getProxyUrl() . $urlQuery); - } - - echo "Generating screenshots...\n"; - self::runCaptureProgram($urls); - } - - public static function tearDownAfterClass() - { - if (file_exists("C:\\nppdf32Log\\debuglog.txt")) { // remove slimerjs oddity - unlink("C:\\nppdf32Log\\debuglog.txt"); - } - - if (!Zend_Registry::get('db')) { - Piwik::createDatabaseObject(); - } - - parent::tearDownAfterClass(); - } - - public function setUp() - { - parent::setUp(); - - if (!Zend_Registry::get('db')) { - Piwik::createDatabaseObject(); - } - } - - public function tearDown() - { - parent::tearDown(); - - \Zend_Registry::get('db')->closeConnection(); - \Zend_Registry::set('db', false); - } + public static $fixture = null; // initialized below class definition public static function getUrlsForTesting() { @@ -219,84 +131,8 @@ class Test_Piwik_Integration_UIIntegrationTest extends IntegrationTestCase */ public function testUIUrl($name, $urlQuery) { - list($processedScreenshotPath, $expectedScreenshotPath) = self::getProcessedAndExpectedScreenshotPaths($name); - // compare processed w/ expected - $this->compareScreenshot($name, $expectedScreenshotPath, $processedScreenshotPath, $urlQuery); - } - - private static function runCaptureProgram($urlInfo) - { - file_put_contents(PIWIK_INCLUDE_PATH . '/tmp/urls.txt', json_encode($urlInfo)); - $cmd = self::CAPTURE_PROGRAM . " \"" . PIWIK_INCLUDE_PATH . "/tests/resources/screenshot-capture/capture.js\" 2>&1"; - $cmd = 'xvfb-run --server-args="-screen 0, 1024x768x24" ' . $cmd; - - exec($cmd, $output, $result); - $output = implode("\n", $output); - if ($result !== 0 - || strpos($output, "ERROR") !== false - ) { - echo self::CAPTURE_PROGRAM . " failed: " . $output . "\n\ncommand used: $cmd\n"; - throw new Exception("phantomjs failed"); - } - return $output; - } - - private function compareScreenshot($name, $expectedPath, $processedPath, $urlQuery) - { - $processed = file_get_contents($processedPath); - - if (!file_exists($expectedPath)) { - $this->markTestIncomplete("expected screenshot for processed '$processedPath' is missing"); - } - - $expected = file_get_contents($expectedPath); - if ($expected != $processed) { - echo "\nFail: '$processedPath' for '$urlQuery'\n"; - } - $this->assertTrue($expected == $processed, "screenshot compare failed for '$processedPath'"); - } - - private static function isSlimerJsAvailable() - { - return self::isProgramAvailable('slimerjs'); - } - - private static function isPhantomJsAvailable() - { - return self::isProgramAvailable('phantomjs'); - } - - private static function isXvfbAvailable() - { - return self::isProgramAvailable('xvfb-run'); - } - - private static function isProgramAvailable($name) - { - exec($name . ' --help 2>&1', $output, $result); - return $result === 0 || $result === 1; - } - - private static function getProcessedAndExpectedScreenshotPaths($name) - { - list($processedDir, $expectedDir) = self::getProcessedAndExpectedDirs(); - - $processedScreenshotPath = $processedDir . "$name." . self::IMAGE_TYPE; - $expectedScreenshotPath = $expectedDir . "$name." . self::IMAGE_TYPE; - - return array($processedScreenshotPath, $expectedScreenshotPath); - } - - protected static function getProcessedAndExpectedDirs() - { - $path = self::getPathToTestDirectory() . '/../UI'; - return array($path . '/processed-ui-screenshots/', $path . '/expected-ui-screenshots/'); - } - - public static function getProxyUrl() - { - return Test_Piwik_BaseFixture::getRootUrl() . 'tests/PHPUnit/proxy/index.php'; + $this->compareScreenshot($name, $urlQuery); } } diff --git a/tests/PHPUnit/UITest.php b/tests/PHPUnit/UITest.php new file mode 100644 index 0000000000000000000000000000000000000000..63f7dd832f263d0a175f80ffba40b7c69cd11c4f --- /dev/null +++ b/tests/PHPUnit/UITest.php @@ -0,0 +1,178 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ +use Piwik\Date; +use Piwik\Piwik; +use Piwik\Access; +use Piwik\AssetManager; +use Piwik\Plugins\VisitsSummary\API; + +abstract class UITest extends IntegrationTestCase +{ + const IMAGE_TYPE = 'png'; + const CAPTURE_PROGRAM = 'phantomjs'; + + public static function createAccessInstance() + { + Access::setSingletonInstance($access = new Test_Access_OverrideLogin()); + Piwik_PostEvent('FrontController.initAuthenticationObject'); + } + + public static function setUpBeforeClass() + { + if (!self::isXvfbAvailable()) { + self::markTestSkipped("xvfb is not available, skipping UI integration tests. (install with 'sudo apt-get install xvfb')"); + } else if (self::CAPTURE_PROGRAM == 'slimerjs' + && !self::isSlimerJsAvailable() + ) { + self::markTestSkipped("slimerjs is not available, skipping UI integration tests. " + . "(install by downloading http://slimerjs.org/download.html)"); + } else if (self::CAPTURE_PROGRAM == 'phantomjs' + && !self::isPhantomJsAvailable() + ) { + self::markTestSkipped("phantomjs is not available, skipping UI integration tests. " + . "(install by downloading http://phantomjs.org/download.html)"); + } + + parent::setUpBeforeClass(); + + AssetManager::removeMergedAssets(); + + // launch archiving so tests don't run out of time + $date = Date::factory(static::$fixture->dateTime)->toString(); + API::getInstance()->get(static::$fixture->idSite, 'year', $date); + + // make sure processed & expected dirs exist + list($processedDir, $expectedDir) = self::getProcessedAndExpectedDirs(); + if (!is_dir($processedDir)) { + mkdir($processedDir); + } + if (!is_dir($expectedDir)) { + mkdir($expectedDir); + } + + // run slimerjs/phantomjs w/ all urls so we only invoke it once + $urls = array(); + foreach (static::getUrlsForTesting() as $testInfo) { + list($name, $urlQuery) = $testInfo; + + list($processedScreenshotPath, $expectedScreenshotPath) = self::getProcessedAndExpectedScreenshotPaths($name); + $urls[] = array($processedScreenshotPath, self::getProxyUrl() . $urlQuery); + } + + echo "Generating screenshots...\n"; + self::runCaptureProgram($urls); + } + + public static function tearDownAfterClass() + { + if (file_exists("C:\\nppdf32Log\\debuglog.txt")) { // remove slimerjs oddity + unlink("C:\\nppdf32Log\\debuglog.txt"); + } + + if (!Zend_Registry::get('db')) { + Piwik::createDatabaseObject(); + } + + parent::tearDownAfterClass(); + } + + public function setUp() + { + parent::setUp(); + + if (!Zend_Registry::get('db')) { + Piwik::createDatabaseObject(); + } + } + + public function tearDown() + { + parent::tearDown(); + + \Zend_Registry::get('db')->closeConnection(); + \Zend_Registry::set('db', false); + } + + private static function runCaptureProgram($urlInfo) + { + file_put_contents(PIWIK_INCLUDE_PATH . '/tmp/urls.txt', json_encode($urlInfo)); + $cmd = self::CAPTURE_PROGRAM . " \"" . PIWIK_INCLUDE_PATH . "/tests/resources/screenshot-capture/capture.js\" 2>&1"; + $cmd = 'xvfb-run --server-args="-screen 0, 1024x768x24" ' . $cmd; + + exec($cmd, $output, $result); + $output = implode("\n", $output); + if ($result !== 0 + || strpos($output, "ERROR") !== false + ) { + echo self::CAPTURE_PROGRAM . " failed: " . $output . "\n\ncommand used: $cmd\n"; + throw new Exception("phantomjs failed"); + } + return $output; + } + + protected function compareScreenshot($name, $urlQuery) + { + list($expectedPath, $processedPath) = self::getProcessedAndExpectedScreenshotPaths($name); + + $processed = file_get_contents($processedPath); + + if (!file_exists($expectedPath)) { + $this->markTestIncomplete("expected screenshot for processed '$processedPath' is missing"); + } + + $expected = file_get_contents($expectedPath); + if ($expected != $processed) { + echo "\nFail: '$processedPath' for '$urlQuery'\n"; + } + $this->assertTrue($expected == $processed, "screenshot compare failed for '$processedPath'"); + } + + private static function isSlimerJsAvailable() + { + return self::isProgramAvailable('slimerjs'); + } + + private static function isPhantomJsAvailable() + { + return self::isProgramAvailable('phantomjs'); + } + + private static function isXvfbAvailable() + { + return self::isProgramAvailable('xvfb-run'); + } + + private static function isProgramAvailable($name) + { + exec($name . ' --help 2>&1', $output, $result); + return $result === 0 || $result === 1; + } + + private static function getProcessedAndExpectedScreenshotPaths($name) + { + list($processedDir, $expectedDir) = self::getProcessedAndExpectedDirs(); + + $outputPrefix = static::getOutputPrefix(); + + $processedScreenshotPath = $processedDir . $outputPrefix . '_' . "$name." . self::IMAGE_TYPE; + $expectedScreenshotPath = $expectedDir . $outputPrefix . '_' . "$name." . self::IMAGE_TYPE; + + return array($processedScreenshotPath, $expectedScreenshotPath); + } + + protected static function getProcessedAndExpectedDirs() + { + $path = self::getPathToTestDirectory() . '/../UI'; + return array($path . '/processed-ui-screenshots/', $path . '/expected-ui-screenshots/'); + } + + public static function getProxyUrl() + { + return Test_Piwik_BaseFixture::getRootUrl() . 'tests/PHPUnit/proxy/index.php'; + } +} \ No newline at end of file diff --git a/tests/PHPUnit/bootstrap.php b/tests/PHPUnit/bootstrap.php index de5a9d532fe5ceaa7eaa623895e9bc65b2d0668b..1b11358c30512aac845e3ce7a46f54a33de9e8b6 100644 --- a/tests/PHPUnit/bootstrap.php +++ b/tests/PHPUnit/bootstrap.php @@ -61,6 +61,7 @@ require_once PIWIK_INCLUDE_PATH . '/core/FrontController.php'; require_once PIWIK_INCLUDE_PATH . '/libs/spyc.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/DatabaseTestCase.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/IntegrationTestCase.php'; +require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/UITest.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/FakeAccess.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/MockPiwikOption.php'; require_once PIWIK_INCLUDE_PATH . '/vendor/autoload.php'; diff --git a/tests/resources/screenshot-capture/capture.js b/tests/resources/screenshot-capture/capture.js index 34ac2f8068100e0bbb25dbb75566b31638ea5174..d866803f70c7d15da47524fe84c841fd513646d1 100644 --- a/tests/resources/screenshot-capture/capture.js +++ b/tests/resources/screenshot-capture/capture.js @@ -8,11 +8,9 @@ var PageRenderer = function() { this.urlIndex = 0; this.urls = JSON.parse(readFileSync('../../tmp/urls.txt')); - this.webpage = require('webpage').create(); this.outputPath = ''; this.url = ''; - this._setupWebpageEvents(); this._setScriptTimeout(); }; @@ -32,38 +30,41 @@ PageRenderer.prototype = { console.log("SAVING " + this.url + " at " + this._getElapsedExecutionTime()); + if (this.webpage) { + this.webpage.close(); + } + + this.webpage = require('webpage').create(); + this._setupWebpageEvents(); + this.webpage.viewportSize = {width:1350, height:768}; - this.webpage.open(this.url); - this._setPageTimeouts(); + var self = this; + this.webpage.open(this.url, function () { + self._setPageTimeouts(); + }); }, _setPageTimeouts: function () { var url = this.url, self = this; - this.webpage.onLoadFinished = function () { - // check that we're still on the same url - if (url != self.url) { - return; - } - // in case there are no ajax requests, try triggering after a sec - setTimeout(function () { - if (url == self.url) { - self.webpage.evaluate(function () { - window.piwik.ajaxRequestFinished(); - }); - } - }, 1000) - - // only allowed at most one minute to load - setTimeout(function () { - if (url == self.url) { - self.webpage.evaluate(function () { - window.piwik._triggerRenderInsane(); - }); - } - }, 1000 * 60); - }; + // in case there are no ajax requests, try triggering after a sec + setTimeout(function () { + if (url == self.url) { + self.webpage.evaluate(function () { + window.piwik.ajaxRequestFinished(); + }); + } + }, 1000) + + // only allowed at most one minute to load + setTimeout(function () { + if (url == self.url) { + self.webpage.evaluate(function () { + window.piwik._triggerRenderInsane(); + }); + } + }, 1000 * 60); }, _setupWebpageEvents: function () {