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
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/LocalTracker.php4
-rw-r--r--tests/PHPUnit/Fixtures/FewVisitsWithSetVisitorId.php7
-rw-r--r--tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php4
-rw-r--r--tests/PHPUnit/Fixtures/ManyVisitsWithGeoIPAndEcommerce.php4
-rw-r--r--tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php4
-rw-r--r--tests/PHPUnit/Fixtures/OneVisitorTwoVisits.php2
-rw-r--r--tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php6
-rw-r--r--tests/PHPUnit/Fixtures/SomeVisitsManyPageviewsWithTransitions.php4
-rw-r--r--tests/PHPUnit/Fixtures/ThreeVisitsWithCustomEvents.php16
-rw-r--r--tests/PHPUnit/Fixtures/TwoSitesTwoVisitorsDifferentDays.php2
-rw-r--r--tests/PHPUnit/Framework/Fixture.php21
-rw-r--r--tests/PHPUnit/Framework/TestCase/BenchmarkTestCase.php2
-rw-r--r--tests/PHPUnit/Framework/TestCase/SystemTestCase.php2
-rw-r--r--tests/PHPUnit/Framework/TestDataHelper/LogHelper.php2
-rw-r--r--tests/PHPUnit/Framework/TestingEnvironmentManipulator.php2
-rw-r--r--tests/PHPUnit/Integration/AccessTest.php2
-rw-r--r--tests/PHPUnit/Integration/CacheTest.php2
-rw-r--r--tests/PHPUnit/Integration/ReleaseCheckListTest.php2
-rw-r--r--tests/PHPUnit/Integration/SegmentTest.php12
-rw-r--r--tests/PHPUnit/Integration/Tracker/PingRequestTest.php2
-rw-r--r--tests/PHPUnit/Integration/Tracker/RequestTest.php2
-rw-r--r--tests/PHPUnit/Integration/Tracker/VisitTest.php2
-rw-r--r--tests/PHPUnit/System/TrackerResponseTest.php2
-rw-r--r--tests/PHPUnit/Unit/CacheTest.php6
-rw-r--r--tests/PHPUnit/Unit/LegacyAutoLoaderTest.php57
-rw-r--r--tests/PHPUnit/Unit/Tracker/RequestTest.php2
-rw-r--r--tests/PHPUnit/Unit/Translation/Loader/LoaderCacheTest.php8
-rw-r--r--tests/PHPUnit/bootstrap.php2
-rw-r--r--tests/resources/MatomoDummyClass.php7
29 files changed, 123 insertions, 67 deletions
diff --git a/tests/LocalTracker.php b/tests/LocalTracker.php
index fd98ccfd89..1510b15b74 100644
--- a/tests/LocalTracker.php
+++ b/tests/LocalTracker.php
@@ -12,12 +12,11 @@ require_once PIWIK_INCLUDE_PATH . '/core/Tracker/IgnoreCookie.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Visit.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/GoalManager.php';
require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Action.php';
-require_once PIWIK_INCLUDE_PATH . '/libs/PiwikTracker/PiwikTracker.php';
/**
* Tracker that uses core/Tracker.php directly.
*/
-class Piwik_LocalTracker extends PiwikTracker
+class Matomo_LocalTracker extends MatomoTracker
{
protected function sendRequest($url, $method = 'GET', $data = null, $force = false)
{
@@ -125,3 +124,4 @@ class Piwik_LocalTracker extends PiwikTracker
}
}
+class_alias('Matomo_LocalTracker', 'Piwik_LocalTracker'); \ No newline at end of file
diff --git a/tests/PHPUnit/Fixtures/FewVisitsWithSetVisitorId.php b/tests/PHPUnit/Fixtures/FewVisitsWithSetVisitorId.php
index b182324bb6..f678ff0e56 100644
--- a/tests/PHPUnit/Fixtures/FewVisitsWithSetVisitorId.php
+++ b/tests/PHPUnit/Fixtures/FewVisitsWithSetVisitorId.php
@@ -9,9 +9,8 @@ namespace Piwik\Tests\Fixtures;
use Piwik\Date;
use Piwik\Plugins\Goals\API;
-use Piwik\Tracker\Visit;
use Piwik\Tests\Framework\Fixture;
-use PiwikTracker;
+use MatomoTracker;
use Exception;
/**
@@ -193,7 +192,7 @@ class FewVisitsWithSetVisitorId extends Fixture
}
- private function settingInvalidVisitorIdShouldThrow(PiwikTracker $t)
+ private function settingInvalidVisitorIdShouldThrow(MatomoTracker $t)
{
try {
$t->setVisitorId('test');
@@ -215,7 +214,7 @@ class FewVisitsWithSetVisitorId extends Fixture
}
}
- private function settingInvalidUserIdShouldThrow(PiwikTracker $t)
+ private function settingInvalidUserIdShouldThrow(MatomoTracker $t)
{
try {
$t->setUserId('');
diff --git a/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php b/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php
index 39f5129cdd..a34fd1f3c4 100644
--- a/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php
+++ b/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php
@@ -129,13 +129,13 @@ class ManyVisitsWithGeoIP extends Fixture
/**
* Insert a new visit into the database.
- * @param \PiwikTracker $t The tracker to record the visits on
+ * @param \MatomoTracker $t The tracker to record the visits on
* @param int $fixtureCounter Number of times this fixture has been run
* @param int $visitorCounter Visitor counter within this execution of the fixture
* @param boolean $doBulk Should this visit be left for bulk insert later, or processed now?
* @param array $params Other params as required to set up the visit
*/
- protected function trackVisit(\PiwikTracker $t, $fixtureCounter, $visitorCounter, $doBulk, array $params)
+ protected function trackVisit(\MatomoTracker $t, $fixtureCounter, $visitorCounter, $doBulk, array $params)
{
$setIp = isset($params['setIp']) && $params['setIp'];
diff --git a/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIPAndEcommerce.php b/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIPAndEcommerce.php
index db094351a5..cb9e24c543 100644
--- a/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIPAndEcommerce.php
+++ b/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIPAndEcommerce.php
@@ -12,13 +12,13 @@ class ManyVisitsWithGeoIPAndEcommerce extends ManyVisitsWithGeoIP
{
/**
* Insert a new visit into the database.
- * @param \PiwikTracker $t The tracker to record the visits on
+ * @param \MatomoTracker $t The tracker to record the visits on
* @param int $fixtureCounter Number of times this fixture has been run
* @param int $visitorCounter Visitor counter within this execution of the fixture
* @param boolean $doBulk Should this visit be left for bulk insert later, or processed now?
* @param array $params Other params as required to set up the visit
*/
- protected function trackVisit(\PiwikTracker $t, $fixtureCounter, $visitorCounter, $doBulk, array $params)
+ protected function trackVisit(\MatomoTracker $t, $fixtureCounter, $visitorCounter, $doBulk, array $params)
{
parent::trackVisit($t, $fixtureCounter, $visitorCounter, $doBulk, $params);
diff --git a/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php b/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php
index 887f542d7c..78f77c134e 100644
--- a/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php
+++ b/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php
@@ -138,7 +138,7 @@ class ManyVisitsWithMockLocationProvider extends Fixture
$this->trackOrders($t);
}
- private function trackActions(\PiwikTracker $t, &$visitorCounter, $actionType, $userAgents, $resolutions,
+ private function trackActions(\MatomoTracker $t, &$visitorCounter, $actionType, $userAgents, $resolutions,
$referrers = null, $customVars = null)
{
for ($i = 0; $i != 5; ++$i, ++$visitorCounter) {
@@ -207,7 +207,7 @@ class ManyVisitsWithMockLocationProvider extends Fixture
}
}
- private function trackAction(\PiwikTracker $t, $actionType, $visitorCounter, $actionNum)
+ private function trackAction(\MatomoTracker $t, $actionType, $visitorCounter, $actionNum)
{
if ($actionType == 'pageview') {
self::checkResponse($t->doTrackPageView(
diff --git a/tests/PHPUnit/Fixtures/OneVisitorTwoVisits.php b/tests/PHPUnit/Fixtures/OneVisitorTwoVisits.php
index ed4a717aa8..a4945fcaba 100644
--- a/tests/PHPUnit/Fixtures/OneVisitorTwoVisits.php
+++ b/tests/PHPUnit/Fixtures/OneVisitorTwoVisits.php
@@ -192,7 +192,7 @@ class OneVisitorTwoVisits extends Fixture
$t->setForceVisitDateTime(Date::factory($dateTime)->addHour(1)->getDatetime());
$t->setUrl('http://example.org/store/purchase.htm');
$t->setUrlReferrer('http://search.yahoo.com/search?p=purchase');
- // Temporary, until we implement 1st party cookies in PiwikTracker
+ // Temporary, until we implement 1st party cookies in MatomoTracker
$t->DEBUG_APPEND_URL = '&_idvc=2';
// Goal Tracking URL matching, testing custom referrer including keyword
diff --git a/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php b/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php
index d8bd02903f..22c2ff5c20 100644
--- a/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php
+++ b/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php
@@ -11,7 +11,7 @@ use Piwik\Date;
use Piwik\Plugins\Goals\API;
use Piwik\Tests\Framework\Fixture;
use Piwik\Tests\Framework\TestingEnvironmentVariables;
-use PiwikTracker;
+use MatomoTracker;
/**
* Add one site and track many visits with custom variables & campaign IDs and
@@ -211,7 +211,7 @@ class SomeVisitsCustomVariablesCampaignsNotHeuristics extends Fixture
private function getFirstPartyCookieDomainHash()
{
$host = \Piwik\Url::getHost();
- $cookiePath = PiwikTracker::DEFAULT_COOKIE_PATH;
+ $cookiePath = MatomoTracker::DEFAULT_COOKIE_PATH;
return substr(sha1( $host . $cookiePath), 0, 4);
}
@@ -219,7 +219,7 @@ class SomeVisitsCustomVariablesCampaignsNotHeuristics extends Fixture
* Test setting/getting the first party cookie via the PHP Tracking Client
* @param $t
*/
- private function testFirstPartyCookies(PiwikTracker $t)
+ private function testFirstPartyCookies(MatomoTracker $t)
{
$domainHash = $this->getFirstPartyCookieDomainHash();
$idCookieName = '_pk_id_1_' . $domainHash;
diff --git a/tests/PHPUnit/Fixtures/SomeVisitsManyPageviewsWithTransitions.php b/tests/PHPUnit/Fixtures/SomeVisitsManyPageviewsWithTransitions.php
index 3a91bf6a91..21f011f75c 100644
--- a/tests/PHPUnit/Fixtures/SomeVisitsManyPageviewsWithTransitions.php
+++ b/tests/PHPUnit/Fixtures/SomeVisitsManyPageviewsWithTransitions.php
@@ -9,7 +9,7 @@ namespace Piwik\Tests\Fixtures;
use Piwik\Date;
use Piwik\Tests\Framework\Fixture;
-use PiwikTracker;
+use MatomoTracker;
/**
* Adds one site and tracks a couple visits with many pageviews. The
@@ -137,7 +137,7 @@ class SomeVisitsManyPageviewsWithTransitions extends Fixture
$prefix = $prefixes[$this->prefixCounter % 4];
$this->prefixCounter = $this->prefixCounter + 1;
- /** @var $visit PiwikTracker */
+ /** @var $visit MatomoTracker */
$visit->setUrl($prefix . 'example.org/' . $path);
$visit->setForceVisitDateTime(Date::factory($dateTime)->addHour($timeOffset)->getDatetime());
diff --git a/tests/PHPUnit/Fixtures/ThreeVisitsWithCustomEvents.php b/tests/PHPUnit/Fixtures/ThreeVisitsWithCustomEvents.php
index 078a315078..0096500959 100644
--- a/tests/PHPUnit/Fixtures/ThreeVisitsWithCustomEvents.php
+++ b/tests/PHPUnit/Fixtures/ThreeVisitsWithCustomEvents.php
@@ -10,7 +10,7 @@ namespace Piwik\Tests\Fixtures;
use Piwik\Date;
use Piwik\Plugins\Goals\API as APIGoals;
use Piwik\Tests\Framework\Fixture;
-use PiwikTracker;
+use MatomoTracker;
/**
* Tracks custom events
@@ -82,13 +82,13 @@ class ThreeVisitsWithCustomEvents extends Fixture
}
- private function moveTimeForward(PiwikTracker $vis, $minutes)
+ private function moveTimeForward(MatomoTracker $vis, $minutes)
{
$hour = $minutes / 60;
return $vis->setForceVisitDateTime(Date::factory($this->dateTime)->addHour($hour)->getDatetime());
}
- protected function trackEventWithoutUrl(PiwikTracker $vis)
+ protected function trackEventWithoutUrl(MatomoTracker $vis)
{
$url = $vis->pageUrl;
$vis->setUrl('');
@@ -108,7 +108,7 @@ class ThreeVisitsWithCustomEvents extends Fixture
$vis->setUrl($url);
}
- protected function trackMusicPlaying(PiwikTracker $vis)
+ protected function trackMusicPlaying(MatomoTracker $vis)
{
$this->moveTimeForward($vis, 1);
$this->setMusicEventCustomVar($vis);
@@ -129,7 +129,7 @@ class ThreeVisitsWithCustomEvents extends Fixture
self::checkResponse($vis->doTrackEvent('Music', 'playEnd', 'La fiancée de l\'eau'));
}
- protected function trackMusicRatings(PiwikTracker $vis)
+ protected function trackMusicRatings(MatomoTracker $vis)
{
$this->moveTimeForward($vis, 5);
$this->setMusicEventCustomVar($vis);
@@ -140,7 +140,7 @@ class ThreeVisitsWithCustomEvents extends Fixture
self::checkResponse($vis->doTrackEvent('Music', 'rating', 'La fiancée de l\'eau', 10));
}
- protected function trackMovieWatchingIncludingInterval(PiwikTracker $vis)
+ protected function trackMovieWatchingIncludingInterval(MatomoTracker $vis)
{
// First a pageview so the time on page is tracked properly
$this->moveTimeForward($vis, 30);
@@ -208,14 +208,14 @@ class ThreeVisitsWithCustomEvents extends Fixture
self::checkResponse($vis->doTrackEvent('Movie', 'Purchase'));
}
- private function setMusicEventCustomVar(PiwikTracker $vis)
+ private function setMusicEventCustomVar(MatomoTracker $vis)
{
$vis->setCustomVariable($id = 1, $name = 'Page Scope Custom var', $value = 'should not appear in events report', $scope = 'page');
$vis->setCustomVariable($id = 1, $name = 'album', $value = 'En attendant les caravanes...', $scope = 'event');
$vis->setCustomVariable($id = 1, $name = 'genre', $value = 'World music', $scope = 'event');
}
- private function setMovieEventCustomVar(PiwikTracker $vis)
+ private function setMovieEventCustomVar(MatomoTracker $vis)
{
$vis->setCustomVariable($id = 1, $name = 'country', $value = '日本', $scope = 'event');
$vis->setCustomVariable($id = 2, $name = 'genre', $value = 'Greatest animated films', $scope = 'event');
diff --git a/tests/PHPUnit/Fixtures/TwoSitesTwoVisitorsDifferentDays.php b/tests/PHPUnit/Fixtures/TwoSitesTwoVisitorsDifferentDays.php
index 1f6afab1b8..ba89314897 100644
--- a/tests/PHPUnit/Fixtures/TwoSitesTwoVisitorsDifferentDays.php
+++ b/tests/PHPUnit/Fixtures/TwoSitesTwoVisitorsDifferentDays.php
@@ -132,7 +132,7 @@ class TwoSitesTwoVisitorsDifferentDays extends Fixture
$visitorB->setForceVisitDateTime(Date::factory($dateTime)->addHour($hoursOffset)->getDatetime());
// visitor_returning is set to 1 only when visit count more than 1
- // Temporary, until we implement 1st party cookies in PiwikTracker
+ // Temporary, until we implement 1st party cookies in MatomoTracker
$visitorB->DEBUG_APPEND_URL .= '&_idvc=2&_viewts=' . Date::factory($dateTime)->getTimestamp();
$protocol = (0 === $days % 2) ? 'http' : 'https';
diff --git a/tests/PHPUnit/Framework/Fixture.php b/tests/PHPUnit/Framework/Fixture.php
index 3656785150..88b057f4e1 100644
--- a/tests/PHPUnit/Framework/Fixture.php
+++ b/tests/PHPUnit/Framework/Fixture.php
@@ -13,7 +13,7 @@ use Piwik\Archive;
use Piwik\ArchiveProcessor\PluginsArchiver;
use Piwik\Auth;
use Piwik\Auth\Password;
-use Piwik\Cache\Backend\File;
+use Matomo\Cache\Backend\File;
use Piwik\Cache as PiwikCache;
use Piwik\Common;
use Piwik\Config;
@@ -24,7 +24,7 @@ use Piwik\Date;
use Piwik\Db;
use Piwik\DbHelper;
use Piwik\FrontController;
-use Piwik\Ini\IniReader;
+use Matomo\Ini\IniReader;
use Piwik\Log;
use Piwik\NumberFormatter;
use Piwik\Option;
@@ -52,11 +52,8 @@ use Piwik\Tests\Framework\TestCase\SystemTestCase;
use Piwik\Tracker;
use Piwik\Tracker\Cache;
use Piwik\Translate;
-use Piwik\Url;
-use PHPUnit_Framework_Assert;
-use Piwik\Tests\Framework\TestingEnvironmentVariables;
-use PiwikTracker;
-use Piwik_LocalTracker;
+use MatomoTracker;
+use Matomo_LocalTracker;
use Piwik\Updater;
use Exception;
use ReflectionClass;
@@ -589,22 +586,22 @@ class Fixture extends \PHPUnit_Framework_Assert
}
/**
- * Returns a PiwikTracker object that you can then use to track pages or goals.
+ * Returns a MatomoTracker object that you can then use to track pages or goals.
*
* @param int $idSite
* @param string $dateTime
* @param boolean $defaultInit If set to true, the tracker object will have default IP, user agent, time, resolution, etc.
* @param bool $useLocal
*
- * @return PiwikTracker
+ * @return MatomoTracker
*/
public static function getTracker($idSite, $dateTime, $defaultInit = true, $useLocal = false)
{
if ($useLocal) {
require_once PIWIK_INCLUDE_PATH . '/tests/LocalTracker.php';
- $t = new Piwik_LocalTracker($idSite, self::getTrackerUrl());
+ $t = new Matomo_LocalTracker($idSite, self::getTrackerUrl());
} else {
- $t = new PiwikTracker($idSite, self::getTrackerUrl());
+ $t = new MatomoTracker($idSite, self::getTrackerUrl());
}
$t->setForceVisitDateTime($dateTime);
@@ -634,7 +631,7 @@ class Fixture extends \PHPUnit_Framework_Assert
$trans_gif_64 = "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
$expectedResponse = base64_decode($trans_gif_64);
- $url = "\n =========================== \n URL was: " . PiwikTracker::$DEBUG_LAST_REQUESTED_URL;
+ $url = "\n =========================== \n URL was: " . MatomoTracker::$DEBUG_LAST_REQUESTED_URL;
self::assertEquals($expectedResponse, $response, "Expected GIF beacon, got: <br/>\n"
. var_export($response, true)
. "\n If you are stuck, you can enable [Tracker] debug=1; in config.ini.php to get more debug info."
diff --git a/tests/PHPUnit/Framework/TestCase/BenchmarkTestCase.php b/tests/PHPUnit/Framework/TestCase/BenchmarkTestCase.php
index 3790b0f2a1..011d8aa8e0 100644
--- a/tests/PHPUnit/Framework/TestCase/BenchmarkTestCase.php
+++ b/tests/PHPUnit/Framework/TestCase/BenchmarkTestCase.php
@@ -83,7 +83,7 @@ abstract class BenchmarkTestCase extends SystemTestCase
{
require_once PIWIK_INCLUDE_PATH . '/tests/LocalTracker.php';
- $t = new \Piwik_LocalTracker($idSite, Fixture::getTrackerUrl());
+ $t = new \Matomo_LocalTracker($idSite, Fixture::getTrackerUrl());
$t->setUserAgent("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6 (.NET CLR 3.5.30729)");
$t->setBrowserLanguage('fr');
$t->setLocalTime('12:34:06');
diff --git a/tests/PHPUnit/Framework/TestCase/SystemTestCase.php b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php
index 3494cebd68..49963e32d0 100644
--- a/tests/PHPUnit/Framework/TestCase/SystemTestCase.php
+++ b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php
@@ -34,8 +34,6 @@ use Piwik\Tests\Framework\Fixture;
use Piwik\Translation\Translator;
use Piwik\Url;
-require_once PIWIK_INCLUDE_PATH . '/libs/PiwikTracker/PiwikTracker.php';
-
/**
* Base class for System tests.
*
diff --git a/tests/PHPUnit/Framework/TestDataHelper/LogHelper.php b/tests/PHPUnit/Framework/TestDataHelper/LogHelper.php
index 2346191dd2..0aaac97cd4 100644
--- a/tests/PHPUnit/Framework/TestDataHelper/LogHelper.php
+++ b/tests/PHPUnit/Framework/TestDataHelper/LogHelper.php
@@ -9,7 +9,7 @@
namespace Piwik\Tests\Framework\TestDataHelper;
use Piwik\Common;
-use Piwik\Network\IPUtils;
+use Matomo\Network\IPUtils;
use Piwik\Db;
/**
diff --git a/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php b/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php
index 12b648fe67..e9a5a9cb81 100644
--- a/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php
+++ b/tests/PHPUnit/Framework/TestingEnvironmentManipulator.php
@@ -107,7 +107,7 @@ class TestingEnvironmentManipulator implements EnvironmentManipulator
\Piwik\Profiler::setupProfilerXHProf($mainRun = false, $setupDuringTracking = true);
}
- \Piwik\Cache\Backend\File::$invalidateOpCacheBeforeRead = true;
+ \Matomo\Cache\Backend\File::$invalidateOpCacheBeforeRead = true;
}
public function onEnvironmentBootstrapped()
diff --git a/tests/PHPUnit/Integration/AccessTest.php b/tests/PHPUnit/Integration/AccessTest.php
index 69c3898712..daf6a3008e 100644
--- a/tests/PHPUnit/Integration/AccessTest.php
+++ b/tests/PHPUnit/Integration/AccessTest.php
@@ -11,7 +11,7 @@ namespace Piwik\Tests\Integration;
use Exception;
use Piwik\Access;
use Piwik\AuthResult;
-use Piwik\Cache\Cache;
+use Matomo\Cache\Cache;
use Piwik\Db;
use Piwik\NoAccessException;
use Piwik\Piwik;
diff --git a/tests/PHPUnit/Integration/CacheTest.php b/tests/PHPUnit/Integration/CacheTest.php
index a2d1fe06b8..097553a900 100644
--- a/tests/PHPUnit/Integration/CacheTest.php
+++ b/tests/PHPUnit/Integration/CacheTest.php
@@ -25,7 +25,7 @@ class CacheTest extends IntegrationTestCase
$cache->save('test', 'mycontent'); // make sure something was changed, otherwise it won't save anything
/** @var Cache\Backend $backend */
- $backend = StaticContainer::get('Piwik\Cache\Backend');
+ $backend = StaticContainer::get('Matomo\Cache\Backend');
$this->assertFalse($backend->doContains($storageId));
$result = ''; $module = 'CoreHome'; $action = 'index'; $params = array();
diff --git a/tests/PHPUnit/Integration/ReleaseCheckListTest.php b/tests/PHPUnit/Integration/ReleaseCheckListTest.php
index b4e4964e51..5e9bb24a3e 100644
--- a/tests/PHPUnit/Integration/ReleaseCheckListTest.php
+++ b/tests/PHPUnit/Integration/ReleaseCheckListTest.php
@@ -13,7 +13,7 @@ use Piwik\Config;
use Piwik\Container\StaticContainer;
use Piwik\Filesystem;
use Piwik\Http;
-use Piwik\Ini\IniReader;
+use Matomo\Ini\IniReader;
use Piwik\Plugin\Manager;
use Piwik\Tests\Framework\TestCase\SystemTestCase;
use Piwik\Tracker;
diff --git a/tests/PHPUnit/Integration/SegmentTest.php b/tests/PHPUnit/Integration/SegmentTest.php
index 5cb987fdd6..2b0d015a38 100644
--- a/tests/PHPUnit/Integration/SegmentTest.php
+++ b/tests/PHPUnit/Integration/SegmentTest.php
@@ -1696,17 +1696,17 @@ log_visit.visit_total_actions
{
$self = $this;
- $cacheProxy = $this->getMockBuilder('Piwik\Cache\Lazy')
+ $cacheProxy = $this->getMockBuilder('Matomo\Cache\Lazy')
->setMethods(array('fetch', 'contains', 'save', 'delete', 'flushAll'))
->disableOriginalConstructor()
->getMock();
$cacheProxy->expects($this->any())->method('fetch')->willReturnCallback(function ($id) {
- $realCache = StaticContainer::get('Piwik\Cache\Lazy');
+ $realCache = StaticContainer::get('Matomo\Cache\Lazy');
return $realCache->fetch($id);
});
$cacheProxy->expects($this->any())->method('contains')->willReturnCallback(function ($id) use ($self) {
- $realCache = StaticContainer::get('Piwik\Cache\Lazy');
+ $realCache = StaticContainer::get('Matomo\Cache\Lazy');
$result = $realCache->contains($id);
if ($result) {
@@ -1716,15 +1716,15 @@ log_visit.visit_total_actions
return $result;
});
$cacheProxy->expects($this->any())->method('save')->willReturnCallback(function ($id, $data, $lifetime = 0) {
- $realCache = StaticContainer::get('Piwik\Cache\Lazy');
+ $realCache = StaticContainer::get('Matomo\Cache\Lazy');
return $realCache->save($id, $data, $lifetime);
});
$cacheProxy->expects($this->any())->method('delete')->willReturnCallback(function ($id) {
- $realCache = StaticContainer::get('Piwik\Cache\Lazy');
+ $realCache = StaticContainer::get('Matomo\Cache\Lazy');
return $realCache->delete($id);
});
$cacheProxy->expects($this->any())->method('flushAll')->willReturnCallback(function () {
- $realCache = StaticContainer::get('Piwik\Cache\Lazy');
+ $realCache = StaticContainer::get('Matomo\Cache\Lazy');
return $realCache->flushAll();
});
diff --git a/tests/PHPUnit/Integration/Tracker/PingRequestTest.php b/tests/PHPUnit/Integration/Tracker/PingRequestTest.php
index cb103514cb..353e9c7d26 100644
--- a/tests/PHPUnit/Integration/Tracker/PingRequestTest.php
+++ b/tests/PHPUnit/Integration/Tracker/PingRequestTest.php
@@ -183,7 +183,7 @@ class PingRequestTest extends IntegrationTestCase
return Db::fetchOne("SELECT $columnName FROM " . Common::prefixTable('log_visit') . " WHERE idvisit = ?", array($idVisit));
}
- private function doPingRequest(\PiwikTracker $tracker, $pingTime, $changeDimensionValues)
+ private function doPingRequest(\MatomoTracker $tracker, $pingTime, $changeDimensionValues)
{
if ($changeDimensionValues) {
$tracker->setUserAgent(self::CHANGED_USER_AGENT);
diff --git a/tests/PHPUnit/Integration/Tracker/RequestTest.php b/tests/PHPUnit/Integration/Tracker/RequestTest.php
index 7465cc7dc8..aea944fa15 100644
--- a/tests/PHPUnit/Integration/Tracker/RequestTest.php
+++ b/tests/PHPUnit/Integration/Tracker/RequestTest.php
@@ -8,7 +8,7 @@
namespace Piwik\Tests\Integration\Tracker;
-use Piwik\Network\IPUtils;
+use Matomo\Network\IPUtils;
use Piwik\Piwik;
use Piwik\Plugins\CustomVariables\CustomVariables;
use Piwik\Plugins\UsersManager\API;
diff --git a/tests/PHPUnit/Integration/Tracker/VisitTest.php b/tests/PHPUnit/Integration/Tracker/VisitTest.php
index e62f6e6482..7d0cb60440 100644
--- a/tests/PHPUnit/Integration/Tracker/VisitTest.php
+++ b/tests/PHPUnit/Integration/Tracker/VisitTest.php
@@ -11,7 +11,7 @@ namespace Piwik\Tests\Integration\Tracker;
use Piwik\Cache;
use Piwik\Container\StaticContainer;
use Piwik\Date;
-use Piwik\Network\IPUtils;
+use Matomo\Network\IPUtils;
use Piwik\Plugin\Manager;
use Piwik\Plugins\SitesManager\API;
use Piwik\Tests\Framework\Fixture;
diff --git a/tests/PHPUnit/System/TrackerResponseTest.php b/tests/PHPUnit/System/TrackerResponseTest.php
index 427a664e82..35813e870c 100644
--- a/tests/PHPUnit/System/TrackerResponseTest.php
+++ b/tests/PHPUnit/System/TrackerResponseTest.php
@@ -20,7 +20,7 @@ class TrackerResponseTest extends SystemTestCase
public static $fixture = null;
/**
- * @var \PiwikTracker
+ * @var \MatomoTracker
*/
private $tracker;
diff --git a/tests/PHPUnit/Unit/CacheTest.php b/tests/PHPUnit/Unit/CacheTest.php
index c56964d54e..8b01843f97 100644
--- a/tests/PHPUnit/Unit/CacheTest.php
+++ b/tests/PHPUnit/Unit/CacheTest.php
@@ -19,7 +19,7 @@ class CacheTest extends \PHPUnit_Framework_TestCase
{
$cache = Cache::getLazyCache();
- $this->assertTrue($cache instanceof Cache\Lazy);
+ $this->assertTrue($cache instanceof \Matomo\Cache\Lazy);
}
public function test_getLazyCache_shouldAlwaysReturnTheSameInstance()
@@ -34,7 +34,7 @@ class CacheTest extends \PHPUnit_Framework_TestCase
{
$cache = Cache::getEagerCache();
- $this->assertTrue($cache instanceof Cache\Eager);
+ $this->assertTrue($cache instanceof \Matomo\Cache\Eager);
}
public function test_getEagerCache_shouldAlwaysReturnTheSameInstance()
@@ -49,7 +49,7 @@ class CacheTest extends \PHPUnit_Framework_TestCase
{
$cache = Cache::getTransientCache();
- $this->assertTrue($cache instanceof Cache\Transient);
+ $this->assertTrue($cache instanceof \Matomo\Cache\Transient);
}
public function test_getTransientCache_shouldAlwaysReturnTheSameInstance()
diff --git a/tests/PHPUnit/Unit/LegacyAutoLoaderTest.php b/tests/PHPUnit/Unit/LegacyAutoLoaderTest.php
new file mode 100644
index 0000000000..ea0f9dadb0
--- /dev/null
+++ b/tests/PHPUnit/Unit/LegacyAutoLoaderTest.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link https://matomo.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+namespace Piwik\Tests\Unit;
+
+/**
+ * @group Core
+ * @group LegacyAutoLoader
+ */
+class LegacyAutoLoaderTest extends \PHPUnit_Framework_TestCase
+{
+ public function testPackageClassWorks()
+ {
+ $class = new \Piwik\Ini\IniWriter();
+
+ $this->assertInstanceOf(\Matomo\Ini\IniWriter::class, $class);
+ }
+
+ public function testPackageClassStaticMethodWorks()
+ {
+ $ip = '123.13.12.123';
+
+ $binary = \Piwik\Network\IPUtils::stringToBinaryIP($ip);
+
+ $this->assertEquals($ip, \Matomo\Network\IPUtils::binaryToStringIP($binary));
+ }
+
+ public function testManuallyRequiredClassWorks()
+ {
+ require_once PIWIK_INCLUDE_PATH . '/tests/resources/MatomoDummyClass.php';
+
+ $class = new \Piwik\DummyClass();
+
+ $this->assertInstanceOf(\Matomo\DummyClass::class, $class);
+ }
+
+ /**
+ * @expectedException \Error
+ */
+ public function testNotExistingMatomoClassStillFails()
+ {
+ $class = new \Matomo\ClassNotFound();
+ }
+
+ /**
+ * @expectedException \Error
+ */
+ public function testNotExistingPiwikClassStillFails()
+ {
+ $class = new \Piwik\ClassNotFound();
+ }
+}
diff --git a/tests/PHPUnit/Unit/Tracker/RequestTest.php b/tests/PHPUnit/Unit/Tracker/RequestTest.php
index 81eded4f3b..b5563f5bd1 100644
--- a/tests/PHPUnit/Unit/Tracker/RequestTest.php
+++ b/tests/PHPUnit/Unit/Tracker/RequestTest.php
@@ -9,7 +9,7 @@
namespace Piwik\Tests\Unit\Tracker;
use Piwik\Cookie;
-use Piwik\Network\IPUtils;
+use Matomo\Network\IPUtils;
use Piwik\Piwik;
use Piwik\Plugins\CustomVariables\CustomVariables;
use Piwik\Tests\Framework\TestCase\UnitTestCase;
diff --git a/tests/PHPUnit/Unit/Translation/Loader/LoaderCacheTest.php b/tests/PHPUnit/Unit/Translation/Loader/LoaderCacheTest.php
index 9aa552e1a1..bace2d8b35 100644
--- a/tests/PHPUnit/Unit/Translation/Loader/LoaderCacheTest.php
+++ b/tests/PHPUnit/Unit/Translation/Loader/LoaderCacheTest.php
@@ -8,8 +8,8 @@
namespace Piwik\Tests\Unit\Translation\Loader;
-use Piwik\Cache\Backend\ArrayCache;
-use Piwik\Cache\Lazy;
+use Matomo\Cache\Backend\ArrayCache;
+use Matomo\Cache\Lazy;
use Piwik\Translation\Loader\LoaderCache;
/**
@@ -19,7 +19,7 @@ class LoaderCacheTest extends \PHPUnit_Framework_TestCase
{
public function test_shouldNotLoad_ifInCache()
{
- $cache = $this->getMock('Piwik\Cache\Lazy', array(), array(), '', false);
+ $cache = $this->getMock('Matomo\Cache\Lazy', array(), array(), '', false);
$cache->expects($this->any())
->method('fetch')
->willReturn(array('translations!'));
@@ -35,7 +35,7 @@ class LoaderCacheTest extends \PHPUnit_Framework_TestCase
public function test_shouldLoad_ifNotInCache()
{
- $cache = $this->getMock('Piwik\Cache\Lazy', array(), array(), '', false);
+ $cache = $this->getMock('Matomo\Cache\Lazy', array(), array(), '', false);
$cache->expects($this->any())
->method('fetch')
->willReturn(null);
diff --git a/tests/PHPUnit/bootstrap.php b/tests/PHPUnit/bootstrap.php
index 8aa0f0a842..c5bc17aa18 100644
--- a/tests/PHPUnit/bootstrap.php
+++ b/tests/PHPUnit/bootstrap.php
@@ -45,8 +45,6 @@ $GLOBALS['MATOMO_PLUGIN_DIRS'] = array(
require_once PIWIK_INCLUDE_PATH . '/core/bootstrap.php';
-require_once PIWIK_INCLUDE_PATH . '/libs/PiwikTracker/PiwikTracker.php';
-
if (getenv('PIWIK_USE_XHPROF') == 1) {
\Piwik\Profiler::setupProfilerXHProf();
}
diff --git a/tests/resources/MatomoDummyClass.php b/tests/resources/MatomoDummyClass.php
new file mode 100644
index 0000000000..5ca637c4b6
--- /dev/null
+++ b/tests/resources/MatomoDummyClass.php
@@ -0,0 +1,7 @@
+<?php
+
+namespace Matomo;
+
+class DummyClass {
+
+} \ No newline at end of file