diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f1561a5852244d1b8adf2be212f4e97cc11f482..9d875c96acbde6dc2c52bbae9883df23192d1dbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,10 +18,13 @@ This is a changelog for Piwik platform developers. All changes for our HTTP API' ### Deprecations * The `Piwik::setUserHasSuperUserAccess` method is deprecated, instead use Access::doAsSuperUser. This method will ensure that super user access is properly rescinded after the callback finishes. -* The class is `\IntegrationTestCase` deprecated and will be removed from February 6th 2015. Use `\Piwik\Tests\Impl\SystemTestCase` instead. -* The class is `\DatabaseTestCase` deprecated and will be removed from February 6th 2015. Use `\Piwik\Tests\Impl\IntegrationTestCase` instead. -* The class is `\Piwik\Tests\Fixture` deprecated and will be removed from February 6th 2015. Use `\Piwik\Tests\Impl\Fixture` instead. -* The class is `\Piwik\Tests\OverrideLogin` deprecated and will be removed from February 6ths 2015. Use `\Piwik\Tests\Impl\OverrideLogin` instead. +* The class is `\IntegrationTestCase` deprecated and will be removed from February 6th 2015. Use `\Piwik\Tests\Framework\TestCase\SystemTestCase` instead. +* The class is `\DatabaseTestCase` deprecated and will be removed from February 6th 2015. Use `\Piwik\Tests\Framework\TestCase\IntegrationTestCase` instead. +* The class is `\BenchmarkTestCase` deprecated and will be removed from February 6th 2015. Use `\Piwik\Tests\Framework\TestCase\BenchmarkTestCase` instead. +* The class is `\ConsoleCommandTestCase` deprecated and will be removed from February 6th 2015. Use `\Piwik\Tests\Framework\TestCase\ConsoleCommandTestCase` instead. +* The class is `\FakeAccess` deprecated and will be removed from February 6th 2015. Use `\Piwik\Tests\Framework\Mock\FakeAccess` instead. +* The class is `\Piwik\Tests\Fixture` deprecated and will be removed from February 6th 2015. Use `\Piwik\Tests\Framework\Fixture` instead. +* The class is `\Piwik\Tests\OverrideLogin` deprecated and will be removed from February 6ths 2015. Use `\Piwik\Framework\Framework\OverrideLogin` instead. ### New API Features * The pivotBy and related query parameters can be used to pivot reports by another dimension. Read more about the new query parameters [here](http://developer.piwik.org/api-reference/reporting-api#optional-api-parameters). diff --git a/console b/console index 41b4ec5835a6ed628f42086bca7d90afc3278b7d..f0b25f3d8e96451ff377a740eaf3b166fc30198e 100755 --- a/console +++ b/console @@ -14,9 +14,9 @@ require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php'; @date_default_timezone_set('UTC'); -require_once file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php') - ? PIWIK_INCLUDE_PATH . '/vendor/autoload.php' // Piwik is the main project - : PIWIK_INCLUDE_PATH . '/../../autoload.php'; // Piwik is installed as a dependency +require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; +\Piwik\Loader::init(); + require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php'; Piwik\Translate::loadEnglishTranslation(); diff --git a/core/Loader.php b/core/Loader.php new file mode 100644 index 0000000000000000000000000000000000000000..932c89d5bd9b8ebaf6209309cd3c0b74541f8620 --- /dev/null +++ b/core/Loader.php @@ -0,0 +1,47 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ + +namespace Piwik; + +/** + * Initializes the Composer Autoloader + * @package Piwik + */ +class Loader +{ + public static function init() + { + return self::getLoader(); + } + + /** + * @return \Composer\Autoload\ClassLoader + */ + private static function getLoader() + { + if (file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php')) { + $path = PIWIK_INCLUDE_PATH . '/vendor/autoload.php'; // Piwik is the main project + } else { + $path = PIWIK_INCLUDE_PATH . '/../../autoload.php'; // Piwik is installed as a dependency + } + + $loader = require $path; + + return $loader; + } + + public static function registerTestNamespace() + { + $prefix = 'Piwik\\Tests\\'; + $paths = PIWIK_INCLUDE_PATH . '/tests/PHPUnit'; + + $loader = self::getLoader(); + $loader->addPsr4($prefix, $paths, $prepend = false); + } +} diff --git a/index.php b/index.php index baee05066c4f636d2f193b673eba3d781e0f53df..e142d64ea06b37ce212ffd86000c5446aab9ff5a 100644 --- a/index.php +++ b/index.php @@ -35,9 +35,9 @@ require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php'; session_cache_limiter('nocache'); @date_default_timezone_set('UTC'); -require_once file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php') - ? PIWIK_INCLUDE_PATH . '/vendor/autoload.php' // Piwik is the main project - : PIWIK_INCLUDE_PATH . '/../../autoload.php'; // Piwik is installed as a dependency + +require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; +\Piwik\Loader::init(); if(!defined('PIWIK_PRINT_ERROR_BACKTRACE')) { define('PIWIK_PRINT_ERROR_BACKTRACE', false); diff --git a/js/tracker.php b/js/tracker.php index a8d768e6bcd2447160c70fd172109d4de73b0de6..ac85498cb930eb298b6f9adaa9b84454da8484d4 100644 --- a/js/tracker.php +++ b/js/tracker.php @@ -27,7 +27,8 @@ define('PIWIK_DOCUMENT_ROOT', '..'); define('PIWIK_USER_PATH', '..'); require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php'; -require_once PIWIK_INCLUDE_PATH . '/vendor/autoload.php'; +require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; +\Piwik\Loader::init(); $file = '../piwik.js'; diff --git a/misc/others/cli-script-bootstrap.php b/misc/others/cli-script-bootstrap.php index bd1f7ea6ec21fd2d042a9efb48c09d54e1a6b8bf..f26d45abcc2437eed2760c8f68952dd33a7c193d 100644 --- a/misc/others/cli-script-bootstrap.php +++ b/misc/others/cli-script-bootstrap.php @@ -28,9 +28,8 @@ set_time_limit(0); require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php'; require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php'; -require_once file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php') - ? PIWIK_INCLUDE_PATH . '/vendor/autoload.php' // Piwik is the main project - : PIWIK_INCLUDE_PATH . '/../../autoload.php'; // Piwik is installed as a dependency +require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; +\Piwik\Loader::init(); $GLOBALS['PIWIK_TRACKER_DEBUG'] = false; define('PIWIK_ENABLE_DISPATCH', false); diff --git a/plugins/API/tests/Integration/RowEvolutionTest.php b/plugins/API/tests/Integration/RowEvolutionTest.php index cb3dc66a99444b0b0c12144757b310e421b69830..b796562cacdef6b3d8ee193cb2b6be1500565c08 100644 --- a/plugins/API/tests/Integration/RowEvolutionTest.php +++ b/plugins/API/tests/Integration/RowEvolutionTest.php @@ -9,8 +9,8 @@ namespace Piwik\Plugins\API\tests\Integration; use Piwik\Plugins\API\RowEvolution; -use Piwik\Tests\Impl\Fixture; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group API diff --git a/plugins/API/tests/Integration/RssRendererTest.php b/plugins/API/tests/Integration/RssRendererTest.php index 3011273d696a7dcab9c1b0deb173e1ee493b85a4..20ed016a617f5690ea33d74d1aec6e382cb8021a 100644 --- a/plugins/API/tests/Integration/RssRendererTest.php +++ b/plugins/API/tests/Integration/RssRendererTest.php @@ -11,8 +11,8 @@ namespace Piwik\Plugins\API\tests\Integration; use Piwik\Access; use Piwik\DataTable; use Piwik\Plugins\API\Renderer\Rss; -use Piwik\Tests\Impl\Fixture; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group Plugin diff --git a/plugins/Contents/tests/Fixtures/TwoVisitsWithContents.php b/plugins/Contents/tests/Fixtures/TwoVisitsWithContents.php index 9d4c08746ac3f2edaa5a2f510474d0019522be39..92a6e5e3197109742e36dfdae7cd889542105897 100644 --- a/plugins/Contents/tests/Fixtures/TwoVisitsWithContents.php +++ b/plugins/Contents/tests/Fixtures/TwoVisitsWithContents.php @@ -9,7 +9,7 @@ namespace Piwik\Plugins\Contents\tests\Fixtures; use Piwik\Date; use Piwik\Plugins\Goals\API as APIGoals; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; use PiwikTracker; /** diff --git a/plugins/Contents/tests/System/ContentsTest.php b/plugins/Contents/tests/System/ContentsTest.php index c5304fb19e7b44484b4d24fe86979a7e76e22dad..433221762252081345a7408c9f547e9af9af790e 100644 --- a/plugins/Contents/tests/System/ContentsTest.php +++ b/plugins/Contents/tests/System/ContentsTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Plugins\Contents\tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Plugins\Contents\tests\Fixtures\TwoVisitsWithContents; use Piwik\Translate; diff --git a/plugins/CoreConsole/Commands/TestsSetupFixture.php b/plugins/CoreConsole/Commands/TestsSetupFixture.php index 11f5761b935ea199e2fb1933e2b2f641b61f9d2f..fc3ccd49090a0c1a6ec880d26bb50191a797fa12 100644 --- a/plugins/CoreConsole/Commands/TestsSetupFixture.php +++ b/plugins/CoreConsole/Commands/TestsSetupFixture.php @@ -11,7 +11,7 @@ namespace Piwik\Plugins\CoreConsole\Commands; use Piwik\Config; use Piwik\Plugin\ConsoleCommand; use Piwik\Url; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -213,12 +213,11 @@ class TestsSetupFixture extends ConsoleCommand private function requireFixtureFiles(InputInterface $input) { + \Piwik\Loader::registerTestNamespace(); + require_once PIWIK_INCLUDE_PATH . '/libs/PiwikTracker/PiwikTracker.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/FakeAccess.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/TestingEnvironment.php'; - require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Impl/SystemTestCase.php'; - require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Impl/Fixture.php'; - require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Impl/IntegrationTestCase.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/IntegrationTestCase.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Fixture.php'; diff --git a/plugins/CorePluginsAdmin/tests/Integration/UpdateCommunicationTest.php b/plugins/CorePluginsAdmin/tests/Integration/UpdateCommunicationTest.php index 5743c42e46d85db4ab1898c3c9d39c6d6a08b6b6..0aeb99dae8e965aa92df0f0a0afd5383f5f8731b 100644 --- a/plugins/CorePluginsAdmin/tests/Integration/UpdateCommunicationTest.php +++ b/plugins/CorePluginsAdmin/tests/Integration/UpdateCommunicationTest.php @@ -11,7 +11,7 @@ namespace Piwik\Plugins\CorePluginsAdmin\tests\Integration; use Piwik\Config; use Piwik\Option; use Piwik\Plugins\CorePluginsAdmin\UpdateCommunication; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Class Plugins_CorePluginsAdmin_UpdateCommunicationTest diff --git a/plugins/CoreUpdater/tests/Integration/UpdateCommunicationTest.php b/plugins/CoreUpdater/tests/Integration/UpdateCommunicationTest.php index 10f408206ff3b70d253fafa4eb9dfd3622dc1eee..8bda8a269945be2648c40565e9e60752c1f83018 100644 --- a/plugins/CoreUpdater/tests/Integration/UpdateCommunicationTest.php +++ b/plugins/CoreUpdater/tests/Integration/UpdateCommunicationTest.php @@ -13,7 +13,7 @@ use Piwik\Option; use Piwik\Plugins\CoreUpdater\UpdateCommunication; use Piwik\UpdateCheck; use Piwik\Version; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Class Plugins_CoreUpdater_UpdateCommunicationTest diff --git a/plugins/CustomVariables/tests/Commands/InfoTest.php b/plugins/CustomVariables/tests/Commands/InfoTest.php index 455cdd10e2cf324df9406d4cb201306802ffc93a..fe9e1cc7e6490ae8a8f2c34c41d099ce95e79772 100644 --- a/plugins/CustomVariables/tests/Commands/InfoTest.php +++ b/plugins/CustomVariables/tests/Commands/InfoTest.php @@ -13,7 +13,7 @@ use Piwik\Plugins\CustomVariables\Commands\Info; use Piwik\Plugins\CustomVariables\Model; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group CustomVariables diff --git a/plugins/CustomVariables/tests/Commands/SetNumberOfCustomVariablesTest.php b/plugins/CustomVariables/tests/Commands/SetNumberOfCustomVariablesTest.php index f48473b5e96e60cae9fcfec10fa8b09ee179106e..e70c3515bbca1d6121e2ec3090d9e54fe20e3373 100644 --- a/plugins/CustomVariables/tests/Commands/SetNumberOfCustomVariablesTest.php +++ b/plugins/CustomVariables/tests/Commands/SetNumberOfCustomVariablesTest.php @@ -13,7 +13,7 @@ use Piwik\Plugins\CustomVariables\Commands\SetNumberOfCustomVariables; use Piwik\Plugins\CustomVariables\CustomVariables; use Symfony\Component\Console\Application; use Symfony\Component\Console\Tester\CommandTester; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group CustomVariables diff --git a/plugins/CustomVariables/tests/Fixtures/VisitWithManyCustomVariables.php b/plugins/CustomVariables/tests/Fixtures/VisitWithManyCustomVariables.php index 82b8129bbb34bf3540d91e825b61f5c7a5a47bac..c1a75e0b2661911be4c4a5ebfb7febf6bcab8f63 100644 --- a/plugins/CustomVariables/tests/Fixtures/VisitWithManyCustomVariables.php +++ b/plugins/CustomVariables/tests/Fixtures/VisitWithManyCustomVariables.php @@ -9,7 +9,7 @@ namespace Piwik\Plugins\CustomVariables\tests\Fixtures; use Piwik\Plugins\CustomVariables\Model; use Piwik\Plugins\Goals\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds one site with two goals and tracks two visits with custom variables. diff --git a/plugins/CustomVariables/tests/Integration/CustomVariablesTest.php b/plugins/CustomVariables/tests/Integration/CustomVariablesTest.php index 5144dc4489f9c84dc6d27e791cd0d4455a84e889..75832efe3704ae43e9fe23342bfd89920bbc4a76 100644 --- a/plugins/CustomVariables/tests/Integration/CustomVariablesTest.php +++ b/plugins/CustomVariables/tests/Integration/CustomVariablesTest.php @@ -9,7 +9,7 @@ namespace Piwik\Plugins\CustomVariables\tests; use Piwik\Plugins\CustomVariables\CustomVariables; use Piwik\Tracker\Cache; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group CustomVariables diff --git a/plugins/CustomVariables/tests/Integration/ModelTest.php b/plugins/CustomVariables/tests/Integration/ModelTest.php index 384d20447888d481e8591006674924c77e7bd039..128e5b09ef4cec35f5a0fe75de9a4c9fd080f0b8 100644 --- a/plugins/CustomVariables/tests/Integration/ModelTest.php +++ b/plugins/CustomVariables/tests/Integration/ModelTest.php @@ -9,7 +9,7 @@ namespace Piwik\Plugins\CustomVariables\tests; use Piwik\Db; use Piwik\Plugins\CustomVariables\Model; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group CustomVariables diff --git a/plugins/CustomVariables/tests/System/CustomVariablesSystemTest.php b/plugins/CustomVariables/tests/System/CustomVariablesSystemTest.php index 00158a1e48cac0853238afa95caa7fa09ad6ae44..79c6f5ec436160e06eb713287d2f19aea9db78dc 100644 --- a/plugins/CustomVariables/tests/System/CustomVariablesSystemTest.php +++ b/plugins/CustomVariables/tests/System/CustomVariablesSystemTest.php @@ -8,7 +8,7 @@ namespace Piwik\Plugins\CustomVariables\tests; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; /** * @group CustomVariables diff --git a/plugins/ExamplePlugin/tests/Fixtures/SimpleFixtureTrackFewVisits.php b/plugins/ExamplePlugin/tests/Fixtures/SimpleFixtureTrackFewVisits.php index 2c0b38d1721803c4ce28695a145a3e94d70d608b..89d99a7005e8f42452b8df61b7c40694b1b174bc 100644 --- a/plugins/ExamplePlugin/tests/Fixtures/SimpleFixtureTrackFewVisits.php +++ b/plugins/ExamplePlugin/tests/Fixtures/SimpleFixtureTrackFewVisits.php @@ -8,7 +8,7 @@ namespace Piwik\Plugins\ExamplePlugin\tests\Fixtures; use Piwik\Date; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Generates tracker testing data for our SimpleSystemTest diff --git a/plugins/ExamplePlugin/tests/Integration/SimpleTest.php b/plugins/ExamplePlugin/tests/Integration/SimpleTest.php index 01ff197cf83191023ae9340a60e8ca84fd5b4cb6..3d8ac904f8c875b79f0e18b35f664128b13fddb6 100644 --- a/plugins/ExamplePlugin/tests/Integration/SimpleTest.php +++ b/plugins/ExamplePlugin/tests/Integration/SimpleTest.php @@ -8,7 +8,7 @@ namespace Piwik\Plugins\ExamplePlugin\tests\Integration; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group ExamplePlugin diff --git a/plugins/ExamplePlugin/tests/System/SimpleSystemTest.php b/plugins/ExamplePlugin/tests/System/SimpleSystemTest.php index 873c4e4fbe45e9c0fa2e2ec23b706943537a9063..4594c3be4cd28f95d5bcb60f44cd9d5979e30fdb 100644 --- a/plugins/ExamplePlugin/tests/System/SimpleSystemTest.php +++ b/plugins/ExamplePlugin/tests/System/SimpleSystemTest.php @@ -9,7 +9,7 @@ namespace Piwik\Plugins\ExamplePlugin\tests\System; use Piwik\Plugins\ExamplePlugin\tests\fixtures\SimpleFixtureTrackFewVisits; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; /** * @group ExamplePlugin diff --git a/plugins/Goals/tests/Integration/APITest.php b/plugins/Goals/tests/Integration/APITest.php index bc3a960e83e55bd7aef0247848fa8103c9e6a4ae..8f641170391feef3324e8ca6c4c588cdc1d10e5f 100644 --- a/plugins/Goals/tests/Integration/APITest.php +++ b/plugins/Goals/tests/Integration/APITest.php @@ -11,8 +11,8 @@ namespace Piwik\Plugins\Goals\tests\Integration; use Piwik\Access; use Piwik\Piwik; use Piwik\Plugins\Goals\API; -use Piwik\Tests\Impl\Fixture; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group Goals diff --git a/plugins/Insights/tests/Fixtures/SomeVisitsDifferentPathsOnTwoDays.php b/plugins/Insights/tests/Fixtures/SomeVisitsDifferentPathsOnTwoDays.php index 7041e6b573dfb618b65f5354b8183a452123b754..e2a8e7f2c46b818e97a4e2bbe2e273001a417094 100644 --- a/plugins/Insights/tests/Fixtures/SomeVisitsDifferentPathsOnTwoDays.php +++ b/plugins/Insights/tests/Fixtures/SomeVisitsDifferentPathsOnTwoDays.php @@ -9,7 +9,7 @@ namespace Piwik\Plugins\Insights\tests\Fixtures; use Piwik\Date; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds one website and tracks several visits from one visitor on diff --git a/plugins/Insights/tests/Integration/ApiTest.php b/plugins/Insights/tests/Integration/ApiTest.php index 2a75247021b97653f09f258086c5cc73eae603af..dfa76dcde17c245034c2966a971c087cfed09aa9 100644 --- a/plugins/Insights/tests/Integration/ApiTest.php +++ b/plugins/Insights/tests/Integration/ApiTest.php @@ -14,9 +14,7 @@ use Piwik\DataTable; use Piwik\DataTable\Row; use Piwik\Plugins\Insights\API; use Piwik\Plugins\Insights\tests\Fixtures\SomeVisitsDifferentPathsOnTwoDays; -use Piwik\Tests\Impl\IntegrationTestCase; -use Piwik\Tests\Impl\SystemTestCase; -use Piwik\Tracker\Cache; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Translate; /** diff --git a/plugins/Insights/tests/Integration/ModelTest.php b/plugins/Insights/tests/Integration/ModelTest.php index 4f62630bd9ee39263a4837286a6a0d80d5c0ac74..2226684ab7db6e3011a2bef9f6ed723715a9661c 100644 --- a/plugins/Insights/tests/Integration/ModelTest.php +++ b/plugins/Insights/tests/Integration/ModelTest.php @@ -11,7 +11,7 @@ namespace Piwik\Plugins\Insights\tests; use Piwik\DataTable; use Piwik\Plugins\Insights\Model; use Piwik\Plugins\Insights\tests\Fixtures\SomeVisitsDifferentPathsOnTwoDays; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; /** * @group Insights diff --git a/plugins/LeftMenu/tests/Integration/APITest.php b/plugins/LeftMenu/tests/Integration/APITest.php index e4500b2e41a86b0aca9fa0356fa5413ca5dfa18d..00bf03830f2594068aa5e3ba65c4536bb5373e34 100644 --- a/plugins/LeftMenu/tests/Integration/APITest.php +++ b/plugins/LeftMenu/tests/Integration/APITest.php @@ -12,7 +12,7 @@ use Piwik\Access; use Piwik\Plugins\LeftMenu\API; use Piwik\Plugins\LeftMenu\Settings; use \FakeAccess; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group LeftMenu diff --git a/plugins/Live/tests/Integration/APITest.php b/plugins/Live/tests/Integration/APITest.php index fcfc410bcf570ead1177d8e3b9a01276274ca8e3..fc56b0d16e51d041cbe15a179dbf10c1e29dd444 100644 --- a/plugins/Live/tests/Integration/APITest.php +++ b/plugins/Live/tests/Integration/APITest.php @@ -14,8 +14,8 @@ use Piwik\Plugins\Goals\API as GoalsApi; use Piwik\Plugins\Live\API; use FakeAccess; use Piwik\Access; -use Piwik\Tests\Impl\Fixture; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\SystemTestCase; /** * @group Live diff --git a/plugins/Login/tests/Integration/LoginTest.php b/plugins/Login/tests/Integration/LoginTest.php index 4007061bd5fbb86996af2d2e923cfe33ba2ea4bb..b250bcf8e0a5774ae1256a1892dc1f9052c70115 100644 --- a/plugins/Login/tests/Integration/LoginTest.php +++ b/plugins/Login/tests/Integration/LoginTest.php @@ -13,7 +13,7 @@ use Piwik\AuthResult; use Piwik\DbHelper; use Piwik\Plugins\Login\Auth; use Piwik\Plugins\UsersManager\API; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; use FakeAccess; require_once PIWIK_INCLUDE_PATH . '/plugins/Login/Auth.php'; diff --git a/plugins/MobileMessaging/tests/Integration/MobileMessagingTest.php b/plugins/MobileMessaging/tests/Integration/MobileMessagingTest.php index f387534bf30d6442dfbb10d46fe321182ca801c8..022dfda9baa3bd1262ea8dc7ca898c73b68324fa 100644 --- a/plugins/MobileMessaging/tests/Integration/MobileMessagingTest.php +++ b/plugins/MobileMessaging/tests/Integration/MobileMessagingTest.php @@ -14,7 +14,7 @@ use Piwik\Plugins\MobileMessaging\MobileMessaging; use Piwik\Plugins\MobileMessaging\SMSProvider; use Piwik\Plugins\ScheduledReports\API as APIScheduledReports; use Piwik\Plugins\SitesManager\API as APISitesManager; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; use FakeAccess; /** diff --git a/plugins/MultiSites/tests/Integration/MultiSitesTest.php b/plugins/MultiSites/tests/Integration/MultiSitesTest.php index a5f372b7a512a835bd4e0e9aad28da74ab3856ed..8b6d7924a71282a7ae795ec8a63d6664fe737452 100644 --- a/plugins/MultiSites/tests/Integration/MultiSitesTest.php +++ b/plugins/MultiSites/tests/Integration/MultiSitesTest.php @@ -11,7 +11,7 @@ namespace Piwik\Plugins\MultiSites\tests\Integration; use Piwik\Access; use Piwik\Plugins\MultiSites\API as APIMultiSites; use Piwik\Plugins\SitesManager\API as APISitesManager; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Class Plugins_MultiSitesTest diff --git a/plugins/PrivacyManager/tests/Integration/PrivacyManagerConfigTest.php b/plugins/PrivacyManager/tests/Integration/PrivacyManagerConfigTest.php index 07092248feac311f67b717f428942bf97fcb47be..4d2a121ee3ff01e3cd5e3275697b53edc8fa700d 100644 --- a/plugins/PrivacyManager/tests/Integration/PrivacyManagerConfigTest.php +++ b/plugins/PrivacyManager/tests/Integration/PrivacyManagerConfigTest.php @@ -10,7 +10,7 @@ namespace Piwik\Plugins\PrivacyManager\tests; use Piwik\Option; use Piwik\Plugins\PrivacyManager\Config as PrivacyManagerConfig; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Class Plugins_SitesManagerTest diff --git a/plugins/PrivacyManager/tests/Integration/PrivacyManagerTest.php b/plugins/PrivacyManager/tests/Integration/PrivacyManagerTest.php index 50fce5f0a7ff2b8e7326ce045d6e97d24a1b4918..2b8233ffa709f03a11bf776785cb659fb1114fb3 100644 --- a/plugins/PrivacyManager/tests/Integration/PrivacyManagerTest.php +++ b/plugins/PrivacyManager/tests/Integration/PrivacyManagerTest.php @@ -9,7 +9,7 @@ namespace Piwik\Plugins\PrivacyManager\tests; use Piwik\Plugins\PrivacyManager\PrivacyManager; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Class Plugins_SitesManagerTest diff --git a/plugins/ScheduledReports/tests/Integration/ApiTest.php b/plugins/ScheduledReports/tests/Integration/ApiTest.php index be13cb2b1011a99f256c30e16eabdf045c87c10b..e1efb7fdcb556a8c0ac888005743dc271124d276 100644 --- a/plugins/ScheduledReports/tests/Integration/ApiTest.php +++ b/plugins/ScheduledReports/tests/Integration/ApiTest.php @@ -19,7 +19,7 @@ use Piwik\ScheduledTask; use Piwik\ScheduledTime\Monthly; use Piwik\ScheduledTime; use Piwik\Site; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; use FakeAccess; use Exception; use ReflectionMethod; diff --git a/plugins/ScheduledReports/tests/Integration/ScheduledReportsTest.php b/plugins/ScheduledReports/tests/Integration/ScheduledReportsTest.php index b0bb56363f4d536781098c858eaa97938b4a386e..dfe17b9dfd918b71af2f1b27225175ae1e83687a 100644 --- a/plugins/ScheduledReports/tests/Integration/ScheduledReportsTest.php +++ b/plugins/ScheduledReports/tests/Integration/ScheduledReportsTest.php @@ -12,8 +12,8 @@ use Piwik\Db; use Piwik\Piwik; use Piwik\Plugins\ScheduledReports\API; use Piwik\Plugins\ScheduledReports\ScheduledReports; -use Piwik\Tests\Impl\Fixture; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group ScheduledReports diff --git a/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php b/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php index e5d863e92c425cbb3a4acfc26370dd73b64e981c..ca90f3b43cea0c9fac7e4eeac0c71bcb9c64cc8f 100644 --- a/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php +++ b/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php @@ -14,7 +14,7 @@ use Piwik\Piwik; use Piwik\Plugins\SegmentEditor\API; use Piwik\Plugins\SegmentEditor\Model; use Piwik\Plugins\SitesManager\API as APISitesManager; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; use FakeAccess; use Exception; diff --git a/plugins/SitesManager/tests/Integration/SiteUrlsTest.php b/plugins/SitesManager/tests/Integration/SiteUrlsTest.php index 8cc7cc5b14612821b4f4806c440c9a0c6452638c..4614f7cecea2a186c547403c3d1cff62c2728d1d 100644 --- a/plugins/SitesManager/tests/Integration/SiteUrlsTest.php +++ b/plugins/SitesManager/tests/Integration/SiteUrlsTest.php @@ -10,7 +10,7 @@ namespace Piwik\Plugins\SitesManager\tests\Integration; use Piwik\CacheFile; use Piwik\Plugins\SitesManager\API; use Piwik\Plugins\SitesManager\SiteUrls; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group SitesManager diff --git a/plugins/SitesManager/tests/Integration/SitesManagerTest.php b/plugins/SitesManager/tests/Integration/SitesManagerTest.php index 2d2ac466ef408bf53f0c4486e44f9f24c4d3002b..c49ff6b5e4545bf03f21df8902550abd79daa5e1 100644 --- a/plugins/SitesManager/tests/Integration/SitesManagerTest.php +++ b/plugins/SitesManager/tests/Integration/SitesManagerTest.php @@ -12,7 +12,7 @@ use Piwik\Access; use Piwik\Plugins\SitesManager\API; use Piwik\Plugins\UsersManager\API as APIUsersManager; use Piwik\Site; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; use FakeAccess; use Exception; use PHPUnit_Framework_Constraint_IsType; diff --git a/plugins/UserSettings/tests/Fixtures/LanguageFixture.php b/plugins/UserSettings/tests/Fixtures/LanguageFixture.php index 6cbd9d8343f26bade5f727b52385a3ed4bff51ba..dd3089a36571491e404814d3a1830567b1c19f58 100644 --- a/plugins/UserSettings/tests/Fixtures/LanguageFixture.php +++ b/plugins/UserSettings/tests/Fixtures/LanguageFixture.php @@ -10,7 +10,7 @@ namespace Piwik\Plugins\UserSettings\tests\Fixtures; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; use Piwik\Date; use Piwik\Common; diff --git a/plugins/UserSettings/tests/System/GetLanguageSystemTest.php b/plugins/UserSettings/tests/System/GetLanguageSystemTest.php index 70db55616b0f0acbbc8a75b200cdb30d89cf8434..3c409c111276b3c7f1b5ffcdba878c01f48c9af5 100644 --- a/plugins/UserSettings/tests/System/GetLanguageSystemTest.php +++ b/plugins/UserSettings/tests/System/GetLanguageSystemTest.php @@ -10,7 +10,7 @@ namespace Piwik\Plugins\UserSettings\tests\System; use Piwik\Plugins\UserSettings\tests\Fixtures\LanguageFixture; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; /** * Class GetLanguageSystemTest diff --git a/plugins/UsersManager/tests/Integration/APITest.php b/plugins/UsersManager/tests/Integration/APITest.php index e84cd5b750280a634abceec7032c6d163ee4f18f..038fee293471851102d40d9bca6b758998c186fd 100644 --- a/plugins/UsersManager/tests/Integration/APITest.php +++ b/plugins/UsersManager/tests/Integration/APITest.php @@ -11,8 +11,8 @@ use Piwik\Access; use FakeAccess; use Piwik\Piwik; use Piwik\Plugins\UsersManager\API; -use Piwik\Tests\Impl\Fixture; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group UsersManager diff --git a/plugins/UsersManager/tests/Integration/UserPreferencesTest.php b/plugins/UsersManager/tests/Integration/UserPreferencesTest.php index cd23e7baa37239d918575078970dc903d69f1067..34a5907c0a09f79954ce8aeeec9e6605ed25b767 100644 --- a/plugins/UsersManager/tests/Integration/UserPreferencesTest.php +++ b/plugins/UsersManager/tests/Integration/UserPreferencesTest.php @@ -13,8 +13,8 @@ use Piwik\Plugins\UsersManager\UserPreferences; use Piwik\Plugins\UsersManager\API as APIUsersManager; use FakeAccess; use Piwik\Access; -use Piwik\Tests\Impl\Fixture; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group UsersManager diff --git a/plugins/UsersManager/tests/Integration/UsersManagerTest.php b/plugins/UsersManager/tests/Integration/UsersManagerTest.php index e813c2ac1b2dfa57b7c9851916a18ce3208d29d4..6b847e6d5adb083a40ebb5796e73aa938a68e626 100644 --- a/plugins/UsersManager/tests/Integration/UsersManagerTest.php +++ b/plugins/UsersManager/tests/Integration/UsersManagerTest.php @@ -13,7 +13,7 @@ use Piwik\Plugins\SitesManager\API as APISitesManager; use Piwik\Plugins\UsersManager\API; use Piwik\Plugins\UsersManager\Model; use Piwik\Translate; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; use FakeAccess; use Exception; diff --git a/tests/PHPUnit/BenchmarkTestCase.php b/tests/PHPUnit/BenchmarkTestCase.php index 40f53095273a41b477e2398d0f268e7a2a7ef19c..d3775bb15d68e9fad8ad2df1cc9e3707181c5da7 100755 --- a/tests/PHPUnit/BenchmarkTestCase.php +++ b/tests/PHPUnit/BenchmarkTestCase.php @@ -5,110 +5,10 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -use Piwik\Config; -use Piwik\Db; -use Piwik\Plugins\Goals\API; -use Piwik\Tests\Impl\Fixture; - -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Impl/SystemTestCase.php'; -require_once PIWIK_INCLUDE_PATH . '/tests/LocalTracker.php'; - -// require fixtures -foreach (glob(PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Benchmarks/Fixtures/*.php') as $file) { - require_once $file; -} /** * Base class for benchmarks. */ -abstract class BenchmarkTestCase extends \Piwik\Tests\Impl\SystemTestCase +abstract class BenchmarkTestCase extends \Piwik\Tests\Framework\TestCase\BenchmarkTestCase { - protected static $fixture; - - public static function setUpBeforeClass() - { - $dbName = false; - if (!empty($GLOBALS['PIWIK_BENCHMARK_DATABASE'])) { - $dbName = $GLOBALS['PIWIK_BENCHMARK_DATABASE']; - } - - // connect to database - self::createTestConfig(); - self::connectWithoutDatabase(); - - // create specified fixture (global var not set, use default no-data fixture (see end of this file)) - if (empty($GLOBALS['PIWIK_BENCHMARK_FIXTURE'])) { - $fixtureName = 'Piwik_Test_Fixture_EmptyOneSite'; - } else { - $fixtureName = 'Piwik_Test_Fixture_' . $GLOBALS['PIWIK_BENCHMARK_FIXTURE']; - } - self::$fixture = new $fixtureName; - - // figure out if the desired fixture has already been setup, and if not empty the database - $installedFixture = false; - try { - if (isset(self::$fixture->tablesPrefix)) { - Config::getInstance()->database['tables_prefix'] = self::$fixture->tablesPrefix; - } - - Db::query("USE " . $dbName); - $installedFixture = \Piwik\Option::get('benchmark_fixture_name'); - } catch (Exception $ex) { - // ignore - } - - $createEmptyDatabase = $fixtureName != $installedFixture; - parent::_setUpBeforeClass($dbName, $createEmptyDatabase); - - // if we created an empty database, setup the fixture - if ($createEmptyDatabase) { - self::$fixture->setUp(); - \Piwik\Option::set('benchmark_fixture_name', $fixtureName); - } - } - - public static function tearDownAfterClass() - { - // only drop the database if PIWIK_BENCHMARK_DATABASE isn't set - $dropDatabase = empty($GLOBALS['PIWIK_BENCHMARK_DATABASE']); - parent::_tearDownAfterClass($dropDatabase); - } - - /** - * Creates a tracking object that invokes the tracker directly (w/o going through HTTP). - */ - public static function getLocalTracker($idSite) - { - $t = new Piwik_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'); - $t->setResolution(1024, 768); - $t->setBrowserHasCookies(true); - $t->setPlugins($flash = true, $java = true, $director = false); - $t->setTokenAuth(Fixture::getTokenAuth()); - return $t; - } -} - -/** - * Reusable fixture. Adds one site w/ goals and no visit data. - */ -class Piwik_Test_Fixture_EmptyOneSite -{ - public $date = '2010-01-01'; - public $period = 'day'; - public $idSite = 1; - - public function setUp() - { - // add one site - Fixture::createWebsite( - $this->date, $ecommerce = 1, $siteName = "Site #0", $siteUrl = "http://whatever.com/"); - - // add two goals - $goals = API::getInstance(); - $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains', false, 5); - $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains'); - } } diff --git a/tests/PHPUnit/Benchmarks/ArchiveQueryBenchmark.php b/tests/PHPUnit/Benchmarks/ArchiveQueryBenchmark.php index 05e14b02fdc138b54348add56e3f64cb6bade6b2..4b2109adb48fe1501fb5f87f897b5636ed053368 100644 --- a/tests/PHPUnit/Benchmarks/ArchiveQueryBenchmark.php +++ b/tests/PHPUnit/Benchmarks/ArchiveQueryBenchmark.php @@ -10,8 +10,7 @@ use Piwik\DataAccess\ArchiveTableCreator; use Piwik\Date; use Piwik\Period; use Piwik\Plugins\VisitsSummary\API; - -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/BenchmarkTestCase.php'; +use Piwik\Tests\Framework\TestCase\BenchmarkTestCase; /** * Runs the archiving process. diff --git a/tests/PHPUnit/Benchmarks/ArchivingProcessBenchmark.php b/tests/PHPUnit/Benchmarks/ArchivingProcessBenchmark.php index 04175d224804c481487a80f5901d7311f6f58420..b769556a5b4392f824791b763b1f04789d11f889 100755 --- a/tests/PHPUnit/Benchmarks/ArchivingProcessBenchmark.php +++ b/tests/PHPUnit/Benchmarks/ArchivingProcessBenchmark.php @@ -6,8 +6,7 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ use Piwik\Plugins\VisitsSummary\API; - -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/BenchmarkTestCase.php'; +use Piwik\Tests\Framework\TestCase\BenchmarkTestCase; /** * Runs the archiving process. diff --git a/tests/PHPUnit/Benchmarks/Fixtures/ManyThousandSitesOneVisitEach.php b/tests/PHPUnit/Benchmarks/Fixtures/ManyThousandSitesOneVisitEach.php index 4fbbef1bb9c9c4b07fcd897e36f0c6b75d818ed6..6671a52f9c11697e9668f68edbe8c61f2fc7f97b 100644 --- a/tests/PHPUnit/Benchmarks/Fixtures/ManyThousandSitesOneVisitEach.php +++ b/tests/PHPUnit/Benchmarks/Fixtures/ManyThousandSitesOneVisitEach.php @@ -7,7 +7,8 @@ */ use Piwik\Date; use Piwik\Plugins\Goals\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\BenchmarkTestCase; /** * Reusable fixture. Adds 20,000 sites and tracks one pageview for each on one day. diff --git a/tests/PHPUnit/Benchmarks/Fixtures/OneSiteThousandsOfDistinctUrlsOverMonth.php b/tests/PHPUnit/Benchmarks/Fixtures/OneSiteThousandsOfDistinctUrlsOverMonth.php index 2a997554a3f7a812652df3d60329f215cf19f742..659712786dce0a17377e1698668e629b63ed355d 100644 --- a/tests/PHPUnit/Benchmarks/Fixtures/OneSiteThousandsOfDistinctUrlsOverMonth.php +++ b/tests/PHPUnit/Benchmarks/Fixtures/OneSiteThousandsOfDistinctUrlsOverMonth.php @@ -7,7 +7,8 @@ */ use Piwik\Date; use Piwik\Plugins\Goals\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\BenchmarkTestCase; /** * Adds one site and 1000 actions for every day of one month (January). Each diff --git a/tests/PHPUnit/Benchmarks/Fixtures/OneSiteTwelveThousandVisitsOneYear.php b/tests/PHPUnit/Benchmarks/Fixtures/OneSiteTwelveThousandVisitsOneYear.php index aed08bb332deaa1b2576d49e320d928f97bb49ae..2108f3155eb8e27e8999f8d5ec79cc6c1c47d68c 100755 --- a/tests/PHPUnit/Benchmarks/Fixtures/OneSiteTwelveThousandVisitsOneYear.php +++ b/tests/PHPUnit/Benchmarks/Fixtures/OneSiteTwelveThousandVisitsOneYear.php @@ -7,7 +7,8 @@ */ use Piwik\Date; use Piwik\Plugins\Goals\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\BenchmarkTestCase; /** * Reusable fixture. Tracks twelve thousand page views over a year for one site. diff --git a/tests/PHPUnit/Benchmarks/Fixtures/ThousandSitesTwelveVisitsEachOneDay.php b/tests/PHPUnit/Benchmarks/Fixtures/ThousandSitesTwelveVisitsEachOneDay.php index 79dba76fe7415d63d8d848b0342a576a8bd793c7..c0cd881d9ff62f5c9add0aa42776a48cc41a80e8 100755 --- a/tests/PHPUnit/Benchmarks/Fixtures/ThousandSitesTwelveVisitsEachOneDay.php +++ b/tests/PHPUnit/Benchmarks/Fixtures/ThousandSitesTwelveVisitsEachOneDay.php @@ -6,8 +6,8 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ use Piwik\Date; -use Piwik\Plugins\Goals\API as APIGoals; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\BenchmarkTestCase; /** * Reusable fixture. Tracks twelve thousand page views for 1000 sites on one day. diff --git a/tests/PHPUnit/Benchmarks/MultiSitesBenchmark.php b/tests/PHPUnit/Benchmarks/MultiSitesBenchmark.php index 249b006251007811211896e7699a45c8eebc7ad0..4242cad984052ff70580962a82374ce0ae1b76f6 100644 --- a/tests/PHPUnit/Benchmarks/MultiSitesBenchmark.php +++ b/tests/PHPUnit/Benchmarks/MultiSitesBenchmark.php @@ -9,8 +9,7 @@ use Piwik\ArchiveProcessor\Rules; use Piwik\DataAccess\ArchiveTableCreator; use Piwik\Plugins\MultiSites\API as APIMultiSites; use Piwik\Plugins\VisitsSummary\API as APIVisitsSummary; - -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/BenchmarkTestCase.php'; +use Piwik\Tests\Framework\TestCase\BenchmarkTestCase; /** * Tests MultiSites API. Should be used with ManyThousandSitesOneVisitEach benchmark fixture. diff --git a/tests/PHPUnit/Benchmarks/TrackerBenchmark.php b/tests/PHPUnit/Benchmarks/TrackerBenchmark.php index 4ed79791d5ca9c3b18544b00b7fee96a36111318..2cc9609ec1fbc5763c855b19db02dba54a9b598f 100755 --- a/tests/PHPUnit/Benchmarks/TrackerBenchmark.php +++ b/tests/PHPUnit/Benchmarks/TrackerBenchmark.php @@ -6,8 +6,7 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ use Piwik\Date; - -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/BenchmarkTestCase.php'; +use Piwik\Tests\Framework\TestCase\BenchmarkTestCase; /** * Tracks 12,500 pageviews on one site. Uses bulk tracking (no diff --git a/tests/PHPUnit/ConsoleCommandTestCase.php b/tests/PHPUnit/ConsoleCommandTestCase.php index 72b231f41f253a5c6bcec77a18ba84ffca9b437d..f32533077c5d85d856ac9d8f94869bdb3bc1ea30 100644 --- a/tests/PHPUnit/ConsoleCommandTestCase.php +++ b/tests/PHPUnit/ConsoleCommandTestCase.php @@ -8,50 +8,6 @@ namespace Piwik\Tests; -use Piwik\Config; -use Piwik\Console; -use Piwik\Tests\Impl\SystemTestCase; -use Symfony\Component\Console\Tester\ApplicationTester; - -/** - * Base class for test cases that test Piwik console commands. Derives from SystemTestCase - * so the entire Piwik environment is set up. - * - * This will create an ApplicationTester instance (provided by Symfony) which should be used to - * test commands like this: - * - * public function testThisAndThat() - * { - * $result = $this->applicationTester->run(array( - * 'command' => 'my-command', - * 'arg1' => 'value1', - * 'arg2' => 'value2', - * '--option' => true, - * '--another-option' => 'value3' - * )); - * $this->assertEquals(0, $result, $this->getCommandDisplayOutputErrorMessage()); - * - * // other checks - * } - */ -class ConsoleCommandTestCase extends SystemTestCase +class ConsoleCommandTestCase extends Framework\TestCase\ConsoleCommandTestCase { - protected $applicationTester = null; - - public function setUp() - { - parent::setUp(); - - $application = new Console(); - $application->setAutoExit(false); - - $this->applicationTester = new ApplicationTester($application); - - Config::unsetInstance(); - } - - protected function getCommandDisplayOutputErrorMessage() - { - return "Command did not behave as expected. Command output: " . $this->applicationTester->getDisplay(); - } } \ No newline at end of file diff --git a/tests/PHPUnit/DatabaseTestCase.php b/tests/PHPUnit/DatabaseTestCase.php index d1d0e06cdc96a8ac0faa33f9ae75894ef1ceac89..70a06ca303fdcff26a1d95980675626ea645302c 100755 --- a/tests/PHPUnit/DatabaseTestCase.php +++ b/tests/PHPUnit/DatabaseTestCase.php @@ -7,14 +7,14 @@ */ /** - * @deprecated since 2.8.0 use \Piwik\Tests\Impl\IntegrationTestCase instead + * @deprecated since 2.8.0 use \Piwik\Tests\Framework\TestCase\IntegrationTestCase instead */ -class DatabaseTestCase extends \Piwik\Tests\Impl\IntegrationTestCase +class DatabaseTestCase extends \Piwik\Tests\Framework\TestCase\IntegrationTestCase { public static function setUpBeforeClass() { - \Piwik\Log::debug('\DatabaseTestCase is deprecated since 2.8.0 extend \Piwik\Tests\Impl\IntegrationTestCase instead'); + \Piwik\Log::debug('\DatabaseTestCase is deprecated since 2.8.0 extend \Piwik\Tests\Framework\TestCase\IntegrationTestCase instead'); parent::setUpBeforeClass(); } diff --git a/tests/PHPUnit/FakeAccess.php b/tests/PHPUnit/FakeAccess.php index 3a7ab32e69e07bb3b9c4539b6e1e4101de0134d0..2cac223994fa1ac40d97e59f457bb745308b2ab7 100644 --- a/tests/PHPUnit/FakeAccess.php +++ b/tests/PHPUnit/FakeAccess.php @@ -5,174 +5,12 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -use Piwik\Plugins\SitesManager\API; -use Piwik\Site; + +use \Piwik\Tests\Framework\Mock\FakeAccess as MockFakeAccess; /** * FakeAccess for UnitTests */ -class FakeAccess +class FakeAccess extends MockFakeAccess { - public static $superUser = false; - public static $idSitesAdmin = array(); - public static $idSitesView = array(); - public static $identity = 'superUserLogin'; - public static $superUserLogin = 'superUserLogin'; - - public function getTokenAuth() - { - return false; - } - - public function __construct() - { - self::$superUser = false; - self::$idSitesAdmin = array(); - self::$idSitesView = array(); - self::$identity = 'superUserLogin'; - } - - public static function setIdSitesAdmin($ids) - { - self::$superUser = false; - self::$idSitesAdmin = $ids; - } - - public static function setIdSitesView($ids) - { - self::$superUser = false; - self::$idSitesView = $ids; - } - - public static function hasSuperUserAccess() - { - return self::$superUser; - } - - public static function checkUserHasSuperUserAccess() - { - if (!self::$superUser) { - throw new Exception("checkUserHasSuperUserAccess Fake exception // string not to be tested"); - } - } - - public static function setSuperUserAccess($bool = true) - { - self::$superUser = $bool; - } - - public static function reloadAccess() - { - } - - public static function checkUserHasAdminAccess($idSites) - { - if (!self::$superUser) { - $websitesAccess = self::$idSitesAdmin; - } else { - $websitesAccess = API::getInstance()->getAllSitesId(); - } - - $idSites = Site::getIdSitesFromIdSitesString($idSites); - - foreach ($idSites as $idsite) { - if (!in_array($idsite, $websitesAccess)) { - throw new Exception("checkUserHasAdminAccess Fake exception // string not to be tested"); - } - } - } - - //means at least view access - public static function checkUserHasViewAccess($idSites) - { - if (self::$superUser) { - return; - } - - $websitesAccess = array_merge(self::$idSitesView, self::$idSitesAdmin); - - if (!is_array($idSites)) { - if ($idSites == 'all') { - $idSites = API::getInstance()->getAllSitesId(); - } else { - $idSites = explode(',', $idSites); - } - } - - if (empty($websitesAccess)) { - throw new Exception("checkUserHasViewAccess Fake exception // string not to be tested"); - } - - foreach ($idSites as $idsite) { - if (!in_array($idsite, $websitesAccess)) { - throw new Exception("checkUserHasViewAccess Fake exception // string not to be tested"); - } - } - } - - public static function checkUserHasSomeViewAccess() - { - if (!self::$superUser) { - if (count(self::$idSitesView) == 0) { - throw new Exception("checkUserHasSomeViewAccess Fake exception // string not to be tested"); - } - } else { - return; - } - } - - //means at least view access - public static function checkUserHasSomeAdminAccess() - { - if (!self::$superUser) { - if (count(self::$idSitesAdmin) == 0) { - throw new Exception("checkUserHasSomeAdminAccess Fake exception // string not to be tested"); - } - } else { - return; //Super User has some admin rights - } - } - - public static function getLogin() - { - return self::$identity; - } - - public static function getSitesIdWithAdminAccess() - { - if (self::$superUser) { - return API::getInstance()->getAllSitesId(); - } - - return self::$idSitesAdmin; - } - - public static function getSitesIdWithViewAccess() - { - if (self::$superUser) { - return API::getInstance()->getAllSitesId(); - } - - return self::$idSitesView; - } - - public static function getSitesIdWithAtLeastViewAccess() - { - if (self::$superUser) { - return API::getInstance()->getAllSitesId(); - } - - return array_merge(self::$idSitesView, self::$idSitesAdmin); - } - - public function getRawSitesWithSomeViewAccess($login) - { - $result = array(); - - foreach (array_merge(self::$idSitesView, self::$idSitesAdmin) as $idSite) { - $result[] = array('idsite' => $idSite); - } - - return $result; - } } \ No newline at end of file diff --git a/tests/PHPUnit/Fixture.php b/tests/PHPUnit/Fixture.php index ad13e7eb3c3996701f8674b14301c5fe338c454e..4d15574808bf17608d5d50b8851e4e2f8d2e7696 100644 --- a/tests/PHPUnit/Fixture.php +++ b/tests/PHPUnit/Fixture.php @@ -9,23 +9,23 @@ namespace Piwik\Tests; use Piwik\Log; /** - * @deprecated since 2.8.0 use \Piwik\Tests\Impl\Fixture instead + * @deprecated since 2.8.0 use \Piwik\Tests\Framework\Fixture instead */ -class Fixture extends \Piwik\Tests\Impl\Fixture +class Fixture extends Framework\Fixture { /** Adds data to Piwik. Creates sites, tracks visits, imports log files, etc. */ public function setUp() { - Log::warning('Piwik\Tests\Fixture is deprecated, use \Piwik\Tests\Impl\Fixture instead'); + Log::warning('Piwik\Tests\Fixture is deprecated, use \Piwik\Tests\Framework\Fixture instead'); parent::setUp(); } } /** - * @deprecated since 2.8.0 use \Piwik\Tests\Impl\OverrideLogin instead + * @deprecated since 2.8.0 use \Piwik\Tests\Framework\OverrideLogin instead */ -class OverrideLogin extends \Piwik\Tests\Impl\OverrideLogin +class OverrideLogin extends Framework\OverrideLogin { } \ No newline at end of file diff --git a/tests/PHPUnit/Fixtures/FewVisitsWithSetVisitorIdAndUserId.php b/tests/PHPUnit/Fixtures/FewVisitsWithSetVisitorIdAndUserId.php index 01156c1d0ab801e9540607dfa8be0daf7172b125..f1444bf2f2c400255c35e348d3cc43fa6d4cae81 100644 --- a/tests/PHPUnit/Fixtures/FewVisitsWithSetVisitorIdAndUserId.php +++ b/tests/PHPUnit/Fixtures/FewVisitsWithSetVisitorIdAndUserId.php @@ -10,7 +10,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; use Piwik\Plugins\Goals\API; use Piwik\Tracker\Visit; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; use PiwikTracker; use Exception; diff --git a/tests/PHPUnit/Fixtures/InvalidVisits.php b/tests/PHPUnit/Fixtures/InvalidVisits.php index 4c16226406a9c118a203f7a3c86bf061cd00e1d9..ef7ece2803f7be4607f6a85058f7ffceffae377c 100644 --- a/tests/PHPUnit/Fixtures/InvalidVisits.php +++ b/tests/PHPUnit/Fixtures/InvalidVisits.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Http; use Piwik\Plugins\SitesManager\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; use Exception; /** diff --git a/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php b/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php index 38a6479de7303593cf9e533c348d4a0683ab72d4..e72708a11d7438589afdc85acdef08ea6fd4b889 100644 --- a/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php +++ b/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php @@ -12,8 +12,8 @@ use Piwik\Plugins\Goals\API as APIGoals; use Piwik\Plugins\SegmentEditor\API as APISegmentEditor; use Piwik\Plugins\UserCountry\LocationProvider\GeoIp; use Piwik\Plugins\UserCountry\LocationProvider; -use Piwik\Tests\Impl\Fixture; -use Piwik\Tests\OverrideLogin; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\OverrideLogin; /** * Imports visits from several log files using the python log importer. diff --git a/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php b/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php index 6c4cf6952610369fe2d7a5e99e6931a89b4d8446..07e2ca357ce97dc303a3a77e01001c345fabb37d 100644 --- a/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php +++ b/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php @@ -11,7 +11,7 @@ use Piwik\Date; use Piwik\Db; use Piwik\Plugins\Annotations\API as APIAnnotations; use Piwik\Plugins\Goals\API as APIGoals; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Fixtures/ManySitesImportedLogs.php'; diff --git a/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php b/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php index f8783f8b7d65a120896181501b77b3bdc267c266..92dd1408c51cc40dcc86aa8654fae29aa4cab85b 100644 --- a/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php +++ b/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIP.php @@ -11,10 +11,9 @@ use Piwik\Date; use Piwik\Plugins\Goals\API; use Piwik\Plugins\UserCountry\LocationProvider\GeoIp; use Piwik\Plugins\UserCountry\LocationProvider; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; use Exception; - -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/MockLocationProvider.php'; +use Piwik\Tests\Framework\Mock\LocationProvider as MockLocationProvider; /** * Adds one new website and tracks 35 visits from 18 visitors with geolocation using @@ -211,7 +210,7 @@ class ManyVisitsWithGeoIP extends Fixture { LocationProvider::$providers = null; LocationProvider::setCurrentProvider('mock_provider'); - \MockLocationProvider::$locations = array( + MockLocationProvider::$locations = array( self::makeLocation('Stratford-upon-Avon', 'P3', 'gb', 123.456, 21.321), // template location // same region, different city, same country diff --git a/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php b/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php index cf3434632c66101056f95c70815115980dfb11df..38541a65f5c23788024d98bd0c9b48922a746c0b 100644 --- a/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php +++ b/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php @@ -9,9 +9,8 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; use Piwik\Plugins\UserCountry\LocationProvider; -use Piwik\Tests\Impl\Fixture; - -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/MockLocationProvider.php'; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\Mock\LocationProvider as MockLocationProvider; /** * Adds one site and tracks 60 visits (15 visitors, one action per visit). @@ -210,7 +209,7 @@ class ManyVisitsWithMockLocationProvider extends Fixture private function setMockLocationProvider() { LocationProvider::setCurrentProvider('mock_provider'); - \MockLocationProvider::$locations = array( + MockLocationProvider::$locations = array( self::makeLocation('Toronto', 'ON', 'CA', $lat = null, $long = null, $isp = 'comcast.net'), self::makeLocation('Nice', 'B8', 'FR', $lat = null, $long = null, $isp = 'comcast.net'), diff --git a/tests/PHPUnit/Fixtures/ManyVisitsWithSubDirReferrersAndCustomVars.php b/tests/PHPUnit/Fixtures/ManyVisitsWithSubDirReferrersAndCustomVars.php index 8250174878dc805b5943f71593a6cb5b9d03f036..174fd4c9d2f3932ee815cf4760d53e20917356ca 100644 --- a/tests/PHPUnit/Fixtures/ManyVisitsWithSubDirReferrersAndCustomVars.php +++ b/tests/PHPUnit/Fixtures/ManyVisitsWithSubDirReferrersAndCustomVars.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds one site and tracks 13 visits all with custom variables and referrer URLs diff --git a/tests/PHPUnit/Fixtures/OmniFixture.php b/tests/PHPUnit/Fixtures/OmniFixture.php index 176764f3c261d8d802b01c23d072f3a1be45d602..c7b9f70826b66c709630ae59d6f6e76a51e3fbad 100644 --- a/tests/PHPUnit/Fixtures/OmniFixture.php +++ b/tests/PHPUnit/Fixtures/OmniFixture.php @@ -12,8 +12,8 @@ use Piwik\Access; use Piwik\Option; use ReflectionClass; use Piwik\Plugins\VisitsSummary\API as VisitsSummaryAPI; -use Piwik\Tests\Impl\Fixture; -use Piwik\Tests\OverrideLogin; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\OverrideLogin; /** * This fixture is the combination of every other fixture defined by Piwik. Should be used diff --git a/tests/PHPUnit/Fixtures/OneVisitSeveralPageViews.php b/tests/PHPUnit/Fixtures/OneVisitSeveralPageViews.php index 899df68e7a0d972240575371e18afe2c60ed2d4c..35bb91feedc0fc706038964e142689b747e3a475 100644 --- a/tests/PHPUnit/Fixtures/OneVisitSeveralPageViews.php +++ b/tests/PHPUnit/Fixtures/OneVisitSeveralPageViews.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds one site and tracks one visit with several pageviews. diff --git a/tests/PHPUnit/Fixtures/OneVisitWithAbnormalPageviewUrls.php b/tests/PHPUnit/Fixtures/OneVisitWithAbnormalPageviewUrls.php index 22999000ee4592f4b2edd7f4e31c9846ae496818..f7dc5ac337400a070bd223ad6af38eab329da2ae 100644 --- a/tests/PHPUnit/Fixtures/OneVisitWithAbnormalPageviewUrls.php +++ b/tests/PHPUnit/Fixtures/OneVisitWithAbnormalPageviewUrls.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds one site and tracks one visit w/ pageview URLs that are not normalized. diff --git a/tests/PHPUnit/Fixtures/OneVisitorTwoVisits.php b/tests/PHPUnit/Fixtures/OneVisitorTwoVisits.php index f8f4202c5185c82d1c9448fdcbee31c6348fad61..e7af179e101b813db643d7b71644821dd7ef8a78 100644 --- a/tests/PHPUnit/Fixtures/OneVisitorTwoVisits.php +++ b/tests/PHPUnit/Fixtures/OneVisitorTwoVisits.php @@ -10,7 +10,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; use Piwik\Plugins\Goals\API as APIGoals; use Piwik\Plugins\SitesManager\API as APISitesManager; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * This fixture adds one website and tracks two visits by one visitor. diff --git a/tests/PHPUnit/Fixtures/SomeVisitsAllConversions.php b/tests/PHPUnit/Fixtures/SomeVisitsAllConversions.php index b8645c92081c751aa239b8e6aa4986a457addb1c..2c5e96cbed69b1061bb3f25a984db8016790f286 100644 --- a/tests/PHPUnit/Fixtures/SomeVisitsAllConversions.php +++ b/tests/PHPUnit/Fixtures/SomeVisitsAllConversions.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; use Piwik\Plugins\Goals\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds one site and tracks a couple conversions. diff --git a/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php b/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php index 1985b9090cc9175f7611fd8ca9cde467b95ee626..3c73972a7a94a1c5ffc30fce12606634d3b3316e 100644 --- a/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php +++ b/tests/PHPUnit/Fixtures/SomeVisitsCustomVariablesCampaignsNotHeuristics.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; use Piwik\Plugins\Goals\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; use PiwikTracker; /** diff --git a/tests/PHPUnit/Fixtures/SomeVisitsManyPageviewsWithTransitions.php b/tests/PHPUnit/Fixtures/SomeVisitsManyPageviewsWithTransitions.php index 309f5713da312eb922829cee4c4ffd5582e03cc3..ed0647f64cd83a4d2e6eeb45eb602ed55147787e 100644 --- a/tests/PHPUnit/Fixtures/SomeVisitsManyPageviewsWithTransitions.php +++ b/tests/PHPUnit/Fixtures/SomeVisitsManyPageviewsWithTransitions.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds one site and tracks a couple visits with many pageviews. The diff --git a/tests/PHPUnit/Fixtures/SomeVisitsWithLongUrls.php b/tests/PHPUnit/Fixtures/SomeVisitsWithLongUrls.php index 7104a9db4089ba1e61f06438d054535ae8e348c3..52b5ca704407c8ef7952f664c58962607cec9fa5 100644 --- a/tests/PHPUnit/Fixtures/SomeVisitsWithLongUrls.php +++ b/tests/PHPUnit/Fixtures/SomeVisitsWithLongUrls.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds one site and tracks 7 visits w/ some long-ish urls (as page urls and diff --git a/tests/PHPUnit/Fixtures/SomeVisitsWithNonUnicodePageTitles.php b/tests/PHPUnit/Fixtures/SomeVisitsWithNonUnicodePageTitles.php index 6b173301f2cfe30dc5be17b389478bf0fa415d1f..798ed1a620e13418c2d76a953d5750c89ba410e8 100644 --- a/tests/PHPUnit/Fixtures/SomeVisitsWithNonUnicodePageTitles.php +++ b/tests/PHPUnit/Fixtures/SomeVisitsWithNonUnicodePageTitles.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; use Piwik\Plugins\SitesManager\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds one website and some visits with non unicode page titles. diff --git a/tests/PHPUnit/Fixtures/SqlDump.php b/tests/PHPUnit/Fixtures/SqlDump.php index 354726666909ee615eee3ca882ff7e62a3a96176..589ffd1e0f7a8cb05cf840fdbfb0027dc9570126 100644 --- a/tests/PHPUnit/Fixtures/SqlDump.php +++ b/tests/PHPUnit/Fixtures/SqlDump.php @@ -11,7 +11,7 @@ use Piwik\Access; use Piwik\ArchiveProcessor\Rules; use Piwik\Config; use Piwik\Db; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; use Exception; /** diff --git a/tests/PHPUnit/Fixtures/ThreeGoalsOnePageview.php b/tests/PHPUnit/Fixtures/ThreeGoalsOnePageview.php index fcb72a3487fddd7fc2559720436400f6709203e7..4d7ca6ab46fd56ca3718ecce182b3a206432b202 100644 --- a/tests/PHPUnit/Fixtures/ThreeGoalsOnePageview.php +++ b/tests/PHPUnit/Fixtures/ThreeGoalsOnePageview.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; use Piwik\Plugins\Goals\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Fixture that adds one site with three goals and tracks one pageview & one manual diff --git a/tests/PHPUnit/Fixtures/ThreeSitesWithManyVisitsWithSiteSearch.php b/tests/PHPUnit/Fixtures/ThreeSitesWithManyVisitsWithSiteSearch.php index 1b6086dddeff0082e6f3e99e59ace9d6e76fa834..9b90c82e8580396943675cea8a46114adc63c138 100644 --- a/tests/PHPUnit/Fixtures/ThreeSitesWithManyVisitsWithSiteSearch.php +++ b/tests/PHPUnit/Fixtures/ThreeSitesWithManyVisitsWithSiteSearch.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; use Piwik\Plugins\SitesManager\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds three websites with different site search configurations and adds diff --git a/tests/PHPUnit/Fixtures/ThreeSitesWithSharedVisitors.php b/tests/PHPUnit/Fixtures/ThreeSitesWithSharedVisitors.php index 79f04d69f73213009796771aad7fb65d2aef3280..cbdc0ddf6423a01546d65eab055ccf00c2cea83f 100644 --- a/tests/PHPUnit/Fixtures/ThreeSitesWithSharedVisitors.php +++ b/tests/PHPUnit/Fixtures/ThreeSitesWithSharedVisitors.php @@ -10,7 +10,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Common; use Piwik\Date; use Piwik\Db; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds three sites and tracks some visits w/ visitors that visit each site. diff --git a/tests/PHPUnit/Fixtures/TwoSitesEcommerceOrderWithItems.php b/tests/PHPUnit/Fixtures/TwoSitesEcommerceOrderWithItems.php index a2b00b32d63aded14110b2aae17d93c6d304562e..b841f029d15de54c80726adef90c2bff4f51eb78 100644 --- a/tests/PHPUnit/Fixtures/TwoSitesEcommerceOrderWithItems.php +++ b/tests/PHPUnit/Fixtures/TwoSitesEcommerceOrderWithItems.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; use Piwik\Plugins\Goals\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds two sites and tracks some visits with ecommerce orders. diff --git a/tests/PHPUnit/Fixtures/TwoSitesManyVisitsOverSeveralDaysWithSearchEngineReferrers.php b/tests/PHPUnit/Fixtures/TwoSitesManyVisitsOverSeveralDaysWithSearchEngineReferrers.php index 8b154fd31fcbd179b354aa07d2f99f39472a0444..8983d1eea558e138a09eec59ec37abfe50041362 100644 --- a/tests/PHPUnit/Fixtures/TwoSitesManyVisitsOverSeveralDaysWithSearchEngineReferrers.php +++ b/tests/PHPUnit/Fixtures/TwoSitesManyVisitsOverSeveralDaysWithSearchEngineReferrers.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; use Piwik\Plugins\Goals\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds one website and tracks visits on different days over a month diff --git a/tests/PHPUnit/Fixtures/TwoSitesTwoVisitorsDifferentDays.php b/tests/PHPUnit/Fixtures/TwoSitesTwoVisitorsDifferentDays.php index 8c3ab81f71d0063b4aab25e7940e3df861c7accc..8ccf2c6b8c3dca445fc8943a6ee594ae7d01d34f 100644 --- a/tests/PHPUnit/Fixtures/TwoSitesTwoVisitorsDifferentDays.php +++ b/tests/PHPUnit/Fixtures/TwoSitesTwoVisitorsDifferentDays.php @@ -10,7 +10,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; use Piwik\Plugins\Goals\API as APIGoals; use Piwik\Plugins\SitesManager\API as APISitesManager; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds two websites and tracks visits from two visitors on different days. diff --git a/tests/PHPUnit/Fixtures/TwoSitesVisitsInPast.php b/tests/PHPUnit/Fixtures/TwoSitesVisitsInPast.php index 7d8f967d99f8282d194b93c18fafcc8bc40abdfc..5e508f9d0bb6bc89f8aac144227ee2659d3f3ba8 100644 --- a/tests/PHPUnit/Fixtures/TwoSitesVisitsInPast.php +++ b/tests/PHPUnit/Fixtures/TwoSitesVisitsInPast.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds two sites and tracks several visits all in the past. diff --git a/tests/PHPUnit/Fixtures/TwoSitesWithAnnotations.php b/tests/PHPUnit/Fixtures/TwoSitesWithAnnotations.php index 9cd6938d277d234d1d862dcffafdb9ec81a43b1d..b549bb6c8e5e5f2feccf38981916aa6d345cc3fe 100644 --- a/tests/PHPUnit/Fixtures/TwoSitesWithAnnotations.php +++ b/tests/PHPUnit/Fixtures/TwoSitesWithAnnotations.php @@ -10,7 +10,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Access; use Piwik\Date; use Piwik\Plugins\Annotations\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; use FakeAccess; /** diff --git a/tests/PHPUnit/Fixtures/TwoVisitsNoKeywordWithBot.php b/tests/PHPUnit/Fixtures/TwoVisitsNoKeywordWithBot.php index d2a66893fd48bf4cf7eade132bad773f405f5458..86c144f8c1a71cd532a344c512b18e39bec8d8c0 100644 --- a/tests/PHPUnit/Fixtures/TwoVisitsNoKeywordWithBot.php +++ b/tests/PHPUnit/Fixtures/TwoVisitsNoKeywordWithBot.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; use Piwik\Plugins\Goals\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds one site and tracks two visits. One visit is a bot and one has no keyword diff --git a/tests/PHPUnit/Fixtures/TwoVisitsWithCustomEvents.php b/tests/PHPUnit/Fixtures/TwoVisitsWithCustomEvents.php index 043fa4aaca937add421db92f9e6a76274d523cc4..9fbff49def52c012eb83647914f56fae76b2195f 100644 --- a/tests/PHPUnit/Fixtures/TwoVisitsWithCustomEvents.php +++ b/tests/PHPUnit/Fixtures/TwoVisitsWithCustomEvents.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; use Piwik\Plugins\Goals\API as APIGoals; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; use PiwikTracker; /** diff --git a/tests/PHPUnit/Fixtures/TwoVisitsWithCustomVariables.php b/tests/PHPUnit/Fixtures/TwoVisitsWithCustomVariables.php index a472add11bf22507b096b3b5f42a9f473026d21c..047c7e5a655a9093887a212deb068b0fbab41d3e 100644 --- a/tests/PHPUnit/Fixtures/TwoVisitsWithCustomVariables.php +++ b/tests/PHPUnit/Fixtures/TwoVisitsWithCustomVariables.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; use Piwik\Plugins\Goals\API; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds one site with two goals and tracks two visits with custom variables. diff --git a/tests/PHPUnit/Fixtures/UITestFixture.php b/tests/PHPUnit/Fixtures/UITestFixture.php index 6f404adefd4214ed559e3263bff999def674c3e8..88921238fa3d4c7e39d78cb670aa022460bcc1d9 100644 --- a/tests/PHPUnit/Fixtures/UITestFixture.php +++ b/tests/PHPUnit/Fixtures/UITestFixture.php @@ -20,7 +20,7 @@ use Piwik\Plugins\SegmentEditor\API as APISegmentEditor; use Piwik\Plugins\UsersManager\API as UsersManagerAPI; use Piwik\Plugins\SitesManager\API as SitesManagerAPI; use Piwik\WidgetsList; -use Piwik\Tests\OverrideLogin; +use Piwik\Tests\Framework\OverrideLogin; /** * Fixture for UI tests. diff --git a/tests/PHPUnit/Fixtures/VisitOverSeveralDaysImportedLogs.php b/tests/PHPUnit/Fixtures/VisitOverSeveralDaysImportedLogs.php index 216d49f377457e607a5f9a90dc117fa30beb2a1a..16d6849a09b5a8241ea8031abfb3bde2ed3fef61 100644 --- a/tests/PHPUnit/Fixtures/VisitOverSeveralDaysImportedLogs.php +++ b/tests/PHPUnit/Fixtures/VisitOverSeveralDaysImportedLogs.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\Fixtures; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Import a same visitor, over three different days, in reverse chronological order diff --git a/tests/PHPUnit/Fixtures/VisitsInDifferentTimezones.php b/tests/PHPUnit/Fixtures/VisitsInDifferentTimezones.php index 0a1dce05fdc989cc50efd972b0b94bb5a1883a48..d5c1070f2dc800227dcbc76e3a28948669e9aa73 100644 --- a/tests/PHPUnit/Fixtures/VisitsInDifferentTimezones.php +++ b/tests/PHPUnit/Fixtures/VisitsInDifferentTimezones.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds one site with a non UTC timezone and tracks a couple visits near the end of the day. diff --git a/tests/PHPUnit/Fixtures/VisitsOverSeveralDays.php b/tests/PHPUnit/Fixtures/VisitsOverSeveralDays.php index 923a7dcb3b1d845fe22c3db5c9834c721399e716..8f15052b0289db1e3e10791cba7db8db2fd43aee 100644 --- a/tests/PHPUnit/Fixtures/VisitsOverSeveralDays.php +++ b/tests/PHPUnit/Fixtures/VisitsOverSeveralDays.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds one website and tracks several visits from one visitor on diff --git a/tests/PHPUnit/Fixtures/VisitsTwoWebsitesWithAdditionalVisits.php b/tests/PHPUnit/Fixtures/VisitsTwoWebsitesWithAdditionalVisits.php index 321af65330b9caa158b2c4aef5561d8446926524..fa9f3c7c0da7b3acef7e765a06315e0e4f6701f7 100644 --- a/tests/PHPUnit/Fixtures/VisitsTwoWebsitesWithAdditionalVisits.php +++ b/tests/PHPUnit/Fixtures/VisitsTwoWebsitesWithAdditionalVisits.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\Fixtures; use Piwik\Date; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Adds two sites and tracks several visits with possibility to add new visits to the same days diff --git a/tests/PHPUnit/Impl/Fixture.php b/tests/PHPUnit/Framework/Fixture.php similarity index 98% rename from tests/PHPUnit/Impl/Fixture.php rename to tests/PHPUnit/Framework/Fixture.php index bfb212107fdd02a9ad7e77c580589b8134d3d14e..4d6f6ae2d8236d0287ee74ff4561deb8193c681b 100644 --- a/tests/PHPUnit/Impl/Fixture.php +++ b/tests/PHPUnit/Framework/Fixture.php @@ -5,7 +5,7 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -namespace Piwik\Tests\Impl; +namespace Piwik\Tests\Framework; use Piwik\Access; use Piwik\Common; @@ -28,6 +28,7 @@ use Piwik\Plugins\UsersManager\API as APIUsersManager; use Piwik\Plugins\UsersManager\UsersManager; use Piwik\ReportRenderer; use Piwik\Site; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tracker\Cache; use Piwik\Translate; use Piwik\Url; @@ -54,7 +55,7 @@ use Exception; * Related TODO: we should try and reduce the amount of existing fixtures by * merging some together. */ -class Fixture extends PHPUnit_Framework_Assert +class Fixture extends \PHPUnit_Framework_Assert { const IMAGES_GENERATED_ONLY_FOR_OS = 'linux'; const IMAGES_GENERATED_FOR_PHP = '5.5'; @@ -87,12 +88,14 @@ class Fixture extends PHPUnit_Framework_Assert */ protected static function getPythonBinary() { - if(\Piwik\SettingsServer::isWindows()) { + if (\Piwik\SettingsServer::isWindows()) { return "C:\Python27\python.exe"; } - if(SystemTestCase::isTravisCI()) { + + if (SystemTestCase::isTravisCI()) { return 'python2.6'; } + return 'python'; } @@ -850,12 +853,3 @@ class Fixture extends PHPUnit_Framework_Assert return $result; } } - -// needed by tests that use stored segments w/ the proxy index.php -class OverrideLogin extends Access -{ - public function getLogin() - { - return 'superUserLogin'; - } -} \ No newline at end of file diff --git a/tests/PHPUnit/Framework/Mock/FakeAccess.php b/tests/PHPUnit/Framework/Mock/FakeAccess.php new file mode 100644 index 0000000000000000000000000000000000000000..f750e1814c0550e6de2d0d2eafcfb0cf309066b4 --- /dev/null +++ b/tests/PHPUnit/Framework/Mock/FakeAccess.php @@ -0,0 +1,181 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ +namespace Piwik\Tests\Framework\Mock; + +use Piwik\Plugins\SitesManager\API; +use Piwik\Site; +use Exception; + +/** + * FakeAccess for UnitTests + */ +class FakeAccess +{ + public static $superUser = false; + public static $idSitesAdmin = array(); + public static $idSitesView = array(); + public static $identity = 'superUserLogin'; + public static $superUserLogin = 'superUserLogin'; + + public function getTokenAuth() + { + return false; + } + + public function __construct() + { + self::$superUser = false; + self::$idSitesAdmin = array(); + self::$idSitesView = array(); + self::$identity = 'superUserLogin'; + } + + public static function setIdSitesAdmin($ids) + { + self::$superUser = false; + self::$idSitesAdmin = $ids; + } + + public static function setIdSitesView($ids) + { + self::$superUser = false; + self::$idSitesView = $ids; + } + + public static function hasSuperUserAccess() + { + return self::$superUser; + } + + public static function checkUserHasSuperUserAccess() + { + if (!self::$superUser) { + throw new Exception("checkUserHasSuperUserAccess Fake exception // string not to be tested"); + } + } + + public static function setSuperUserAccess($bool = true) + { + self::$superUser = $bool; + } + + public static function reloadAccess() + { + } + + public static function checkUserHasAdminAccess($idSites) + { + if (!self::$superUser) { + $websitesAccess = self::$idSitesAdmin; + } else { + $websitesAccess = API::getInstance()->getAllSitesId(); + } + + $idSites = Site::getIdSitesFromIdSitesString($idSites); + + foreach ($idSites as $idsite) { + if (!in_array($idsite, $websitesAccess)) { + throw new Exception("checkUserHasAdminAccess Fake exception // string not to be tested"); + } + } + } + + //means at least view access + public static function checkUserHasViewAccess($idSites) + { + if (self::$superUser) { + return; + } + + $websitesAccess = array_merge(self::$idSitesView, self::$idSitesAdmin); + + if (!is_array($idSites)) { + if ($idSites == 'all') { + $idSites = API::getInstance()->getAllSitesId(); + } else { + $idSites = explode(',', $idSites); + } + } + + if (empty($websitesAccess)) { + throw new Exception("checkUserHasViewAccess Fake exception // string not to be tested"); + } + + foreach ($idSites as $idsite) { + if (!in_array($idsite, $websitesAccess)) { + throw new Exception("checkUserHasViewAccess Fake exception // string not to be tested"); + } + } + } + + public static function checkUserHasSomeViewAccess() + { + if (!self::$superUser) { + if (count(self::$idSitesView) == 0) { + throw new Exception("checkUserHasSomeViewAccess Fake exception // string not to be tested"); + } + } else { + return; + } + } + + //means at least view access + public static function checkUserHasSomeAdminAccess() + { + if (!self::$superUser) { + if (count(self::$idSitesAdmin) == 0) { + throw new Exception("checkUserHasSomeAdminAccess Fake exception // string not to be tested"); + } + } else { + return; //Super User has some admin rights + } + } + + public static function getLogin() + { + return self::$identity; + } + + public static function getSitesIdWithAdminAccess() + { + if (self::$superUser) { + return API::getInstance()->getAllSitesId(); + } + + return self::$idSitesAdmin; + } + + public static function getSitesIdWithViewAccess() + { + if (self::$superUser) { + return API::getInstance()->getAllSitesId(); + } + + return self::$idSitesView; + } + + public static function getSitesIdWithAtLeastViewAccess() + { + if (self::$superUser) { + return API::getInstance()->getAllSitesId(); + } + + return array_merge(self::$idSitesView, self::$idSitesAdmin); + } + + public function getRawSitesWithSomeViewAccess($login) + { + $result = array(); + + foreach (array_merge(self::$idSitesView, self::$idSitesAdmin) as $idSite) { + $result[] = array('idsite' => $idSite); + } + + return $result; + } +} \ No newline at end of file diff --git a/tests/PHPUnit/MockLocationProvider.php b/tests/PHPUnit/Framework/Mock/LocationProvider.php similarity index 87% rename from tests/PHPUnit/MockLocationProvider.php rename to tests/PHPUnit/Framework/Mock/LocationProvider.php index 45cb0c8c04f493f7ced9ceec164f0b3f8c41eb29..646225af626ec5c1407e124d21e9fc7a41315273 100755 --- a/tests/PHPUnit/MockLocationProvider.php +++ b/tests/PHPUnit/Framework/Mock/LocationProvider.php @@ -5,10 +5,11 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ +namespace Piwik\Tests\Framework\Mock; -use Piwik\Plugins\UserCountry\LocationProvider; +use Piwik\Plugins\UserCountry\LocationProvider as CountryLocationProvider; -class MockLocationProvider extends LocationProvider +class LocationProvider extends CountryLocationProvider { public static $locations = array(); private $currentLocation = 0; diff --git a/tests/PHPUnit/MockPiwikOption.php b/tests/PHPUnit/Framework/Mock/PiwikOption.php similarity index 88% rename from tests/PHPUnit/MockPiwikOption.php rename to tests/PHPUnit/Framework/Mock/PiwikOption.php index 1aaeea92fcbf26447686e1b90b3def7958632c6c..302232b94b59100f320f3ab156e5cd8b3f245bb9 100644 --- a/tests/PHPUnit/MockPiwikOption.php +++ b/tests/PHPUnit/Framework/Mock/PiwikOption.php @@ -5,9 +5,11 @@ * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ +namespace Piwik\Tests\Framework\Mock; + use Piwik\Option; -class MockPiwikOption extends Option +class PiwikOption extends Option { private $forcedOptionValue = false; diff --git a/tests/PHPUnit/Framework/OverrideLogin.php b/tests/PHPUnit/Framework/OverrideLogin.php new file mode 100644 index 0000000000000000000000000000000000000000..20a30fa8fa17b9bcd6801fa416f69a1138eb4d41 --- /dev/null +++ b/tests/PHPUnit/Framework/OverrideLogin.php @@ -0,0 +1,19 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ +namespace Piwik\Tests\Framework; + +use Piwik\Access; + +// needed by tests that use stored segments w/ the proxy index.php +class OverrideLogin extends Access +{ + public function getLogin() + { + return 'superUserLogin'; + } +} \ No newline at end of file diff --git a/tests/PHPUnit/Framework/TestCase/BenchmarkTestCase.php b/tests/PHPUnit/Framework/TestCase/BenchmarkTestCase.php new file mode 100755 index 0000000000000000000000000000000000000000..e2a782b0945ac5ba2db7a6a46ba3c9536ecacb39 --- /dev/null +++ b/tests/PHPUnit/Framework/TestCase/BenchmarkTestCase.php @@ -0,0 +1,116 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ +namespace Piwik\Tests\Framework\TestCase; + +use Piwik\Config; +use Piwik\Db; +use Piwik\Plugins\Goals\API; +use Exception; +use Piwik\Tests\Framework\Fixture; + +require_once PIWIK_INCLUDE_PATH . '/tests/LocalTracker.php'; + +// require fixtures +foreach (glob(PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Benchmarks/Fixtures/*.php') as $file) { + require_once $file; +} + +/** + * Base class for benchmarks. + */ +abstract class BenchmarkTestCase extends SystemTestCase +{ + public static $fixture; + + public static function setUpBeforeClass() + { + $dbName = false; + if (!empty($GLOBALS['PIWIK_BENCHMARK_DATABASE'])) { + $dbName = $GLOBALS['PIWIK_BENCHMARK_DATABASE']; + } + + // connect to database + self::createTestConfig(); + self::connectWithoutDatabase(); + + // create specified fixture (global var not set, use default no-data fixture (see end of this file)) + if (empty($GLOBALS['PIWIK_BENCHMARK_FIXTURE'])) { + $fixtureName = 'Piwik_Test_Fixture_EmptyOneSite'; + } else { + $fixtureName = 'Piwik_Test_Fixture_' . $GLOBALS['PIWIK_BENCHMARK_FIXTURE']; + } + self::$fixture = new $fixtureName; + + // figure out if the desired fixture has already been setup, and if not empty the database + $installedFixture = false; + try { + if (isset(self::$fixture->tablesPrefix)) { + Config::getInstance()->database['tables_prefix'] = self::$fixture->tablesPrefix; + } + + Db::query("USE " . $dbName); + $installedFixture = \Piwik\Option::get('benchmark_fixture_name'); + } catch (Exception $ex) { + // ignore + } + + $createEmptyDatabase = $fixtureName != $installedFixture; + parent::_setUpBeforeClass($dbName, $createEmptyDatabase); + + // if we created an empty database, setup the fixture + if ($createEmptyDatabase) { + self::$fixture->setUp(); + \Piwik\Option::set('benchmark_fixture_name', $fixtureName); + } + } + + public static function tearDownAfterClass() + { + // only drop the database if PIWIK_BENCHMARK_DATABASE isn't set + $dropDatabase = empty($GLOBALS['PIWIK_BENCHMARK_DATABASE']); + parent::_tearDownAfterClass($dropDatabase); + } + + /** + * Creates a tracking object that invokes the tracker directly (w/o going through HTTP). + */ + public static function getLocalTracker($idSite) + { + $t = new \Piwik_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'); + $t->setResolution(1024, 768); + $t->setBrowserHasCookies(true); + $t->setPlugins($flash = true, $java = true, $director = false); + $t->setTokenAuth(Fixture::getTokenAuth()); + return $t; + } +} + +/** + * Reusable fixture. Adds one site w/ goals and no visit data. + */ +class Piwik_Test_Fixture_EmptyOneSite +{ + public $date = '2010-01-01'; + public $period = 'day'; + public $idSite = 1; + + public function setUp() + { + // add one site + Fixture::createWebsite( + $this->date, $ecommerce = 1, $siteName = "Site #0", $siteUrl = "http://whatever.com/"); + + // add two goals + $goals = API::getInstance(); + $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains', false, 5); + $goals->addGoal($this->idSite, 'all', 'url', 'http', 'contains'); + } +} diff --git a/tests/PHPUnit/Framework/TestCase/ConsoleCommandTestCase.php b/tests/PHPUnit/Framework/TestCase/ConsoleCommandTestCase.php new file mode 100644 index 0000000000000000000000000000000000000000..eb2805397e51f2f4ad630293f5aa75f4a8b76273 --- /dev/null +++ b/tests/PHPUnit/Framework/TestCase/ConsoleCommandTestCase.php @@ -0,0 +1,56 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +namespace Piwik\Tests\Framework\TestCase; + +use Piwik\Config; +use Piwik\Console; +use Symfony\Component\Console\Tester\ApplicationTester; + +/** + * Base class for test cases that test Piwik console commands. Derives from SystemTestCase + * so the entire Piwik environment is set up. + * + * This will create an ApplicationTester instance (provided by Symfony) which should be used to + * test commands like this: + * + * public function testThisAndThat() + * { + * $result = $this->applicationTester->run(array( + * 'command' => 'my-command', + * 'arg1' => 'value1', + * 'arg2' => 'value2', + * '--option' => true, + * '--another-option' => 'value3' + * )); + * $this->assertEquals(0, $result, $this->getCommandDisplayOutputErrorMessage()); + * + * // other checks + * } + */ +class ConsoleCommandTestCase extends SystemTestCase +{ + protected $applicationTester = null; + + public function setUp() + { + parent::setUp(); + + $application = new Console(); + $application->setAutoExit(false); + + $this->applicationTester = new ApplicationTester($application); + + Config::unsetInstance(); + } + + protected function getCommandDisplayOutputErrorMessage() + { + return "Command did not behave as expected. Command output: " . $this->applicationTester->getDisplay(); + } +} \ No newline at end of file diff --git a/tests/PHPUnit/Impl/IntegrationTestCase.php b/tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php similarity index 96% rename from tests/PHPUnit/Impl/IntegrationTestCase.php rename to tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php index da805e2e075c7fe8e298c38fd36e272f4d716af1..73238169d64f09370e46d49a8f32ab764ff17c8e 100644 --- a/tests/PHPUnit/Impl/IntegrationTestCase.php +++ b/tests/PHPUnit/Framework/TestCase/IntegrationTestCase.php @@ -6,10 +6,11 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -namespace Piwik\Tests\Impl; +namespace Piwik\Tests\Framework\TestCase; use Piwik\Config; use Piwik\Db; +use Piwik\Tests\Framework\Fixture; /** * Tests extending IntegrationTestCase are much slower to run: the setUp will diff --git a/tests/PHPUnit/Impl/SystemTestCase.php b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php similarity index 96% rename from tests/PHPUnit/Impl/SystemTestCase.php rename to tests/PHPUnit/Framework/TestCase/SystemTestCase.php index 222fc5a38f9537421a9fbc9bd8efe1883ceec3f6..d0259cbabbb1fcacb5ce6edb7207a541bbe0c352 100755 --- a/tests/PHPUnit/Impl/SystemTestCase.php +++ b/tests/PHPUnit/Framework/TestCase/SystemTestCase.php @@ -6,7 +6,7 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -namespace Piwik\Tests\Impl; +namespace Piwik\Tests\Framework\TestCase; use Exception; use Piwik\ArchiveProcessor\Rules; @@ -16,10 +16,13 @@ use Piwik\DataAccess\ArchiveTableCreator; use Piwik\Db; use Piwik\DbHelper; use Piwik\ReportRenderer; +use Piwik\Tests\Framework\TestRequest\ApiTestConfig; +use Piwik\Tests\Framework\TestRequest\Collection; +use Piwik\Tests\Framework\TestRequest\Response; use Piwik\Translate; -use Piwik\Tests\Impl\Fixture; use Piwik\Log; use PHPUnit_Framework_TestCase; +use Piwik\Tests\Framework\Fixture; require_once PIWIK_INCLUDE_PATH . '/libs/PiwikTracker/PiwikTracker.php'; @@ -275,7 +278,7 @@ abstract class SystemTestCase extends PHPUnit_Framework_TestCase $_GET = $requestUrl; unset($_GET['serialize']); - $processedResponse = TestRequestResponse::loadFromApi($params, $requestUrl); + $processedResponse = Response::loadFromApi($params, $requestUrl); if (empty($compareAgainst)) { $processedResponse->save($processedFilePath); } @@ -283,20 +286,20 @@ abstract class SystemTestCase extends PHPUnit_Framework_TestCase $_GET = $originalGET; try { - $expectedResponse = TestRequestResponse::loadFromFile($expectedFilePath, $params, $requestUrl); + $expectedResponse = Response::loadFromFile($expectedFilePath, $params, $requestUrl); } catch (Exception $ex) { $this->handleMissingExpectedFile($expectedFilePath, $processedResponse); return; } try { - TestRequestResponse::assertEquals($expectedResponse, $processedResponse, "Differences with expected in '$processedFilePath'"); + Response::assertEquals($expectedResponse, $processedResponse, "Differences with expected in '$processedFilePath'"); } catch (Exception $ex) { $this->comparisonFailures[] = $ex; } } - private function handleMissingExpectedFile($expectedFilePath, TestRequestResponse $processedResponse) + private function handleMissingExpectedFile($expectedFilePath, Response $processedResponse) { $this->missingExpectedFiles[] = $expectedFilePath; @@ -427,7 +430,7 @@ abstract class SystemTestCase extends PHPUnit_Framework_TestCase $this->changeLanguage($testConfig->language); } - $testRequests = new TestRequestCollection($api, $testConfig, $api); + $testRequests = new Collection($api, $testConfig, $api); foreach ($testRequests->getRequestUrls() as $apiId => $requestUrl) { $this->_testApiUrl($testName . $testConfig->testSuffix, $apiId, $requestUrl, $testConfig->compareAgainst, $testConfig->xmlFieldsToRemove, $params); @@ -490,7 +493,9 @@ abstract class SystemTestCase extends PHPUnit_Framework_TestCase */ public static function getPathToTestDirectory() { - return dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'System'; + $up = DIRECTORY_SEPARATOR . '..'; + + return dirname(__FILE__) . $up . $up . DIRECTORY_SEPARATOR . 'System'; } /** @@ -574,7 +579,7 @@ abstract class SystemTestCase extends PHPUnit_Framework_TestCase protected function skipWhenPhp53() { - if(\Piwik\Tests\Impl\SystemTestCase::isPhpVersion53()) { + if(self::isPhpVersion53()) { $this->markTestSkipped('Sometimes fail on php 5.3'); } } diff --git a/tests/PHPUnit/Impl/ApiTestConfig.php b/tests/PHPUnit/Framework/TestRequest/ApiTestConfig.php similarity index 98% rename from tests/PHPUnit/Impl/ApiTestConfig.php rename to tests/PHPUnit/Framework/TestRequest/ApiTestConfig.php index 5458f88db633bd28888c0cb73568742d4a3bec60..f8fa02a691cb928859202876f1940fb7f6ed494b 100644 --- a/tests/PHPUnit/Impl/ApiTestConfig.php +++ b/tests/PHPUnit/Framework/TestRequest/ApiTestConfig.php @@ -6,7 +6,7 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -namespace Piwik\Tests\Impl; +namespace Piwik\Tests\Framework\TestRequest; use \Exception; @@ -116,7 +116,7 @@ class ApiTestConfig /** * This property is used to test API methods that return subtables and should be set to the API method that - * returns the super table of the API method being tested. If set, TestRequestCollection will look for the + * returns the super table of the API method being tested. If set, TestRequest\Collection will look for the * first valid idSubtable value to use in the test request. Since these values are assigned dynamically, * there's no other way to set idSubtable. * diff --git a/tests/PHPUnit/Impl/TestRequestCollection.php b/tests/PHPUnit/Framework/TestRequest/Collection.php similarity index 99% rename from tests/PHPUnit/Impl/TestRequestCollection.php rename to tests/PHPUnit/Framework/TestRequest/Collection.php index 556ab1bb244cc1a74b98f0290901e892e8b4f3b5..da1987181b661c10ec1cf321990a0032e5d36a85 100644 --- a/tests/PHPUnit/Impl/TestRequestCollection.php +++ b/tests/PHPUnit/Framework/TestRequest/Collection.php @@ -6,20 +6,20 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -namespace Piwik\Tests\Impl; +namespace Piwik\Tests\Framework\TestRequest; use Piwik\API\DocumentationGenerator; use Piwik\API\Proxy; use Piwik\API\Request; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\UrlHelper; use \Exception; -use \PHPUnit_Framework_Assert; /** * Utility class used to generate a set of API requests given API methods to call, API * methods to exclude, and an ApiTestConfig instance. */ -class TestRequestCollection +class Collection { public $defaultApiNotToCall = array( 'LanguagesManager', diff --git a/tests/PHPUnit/Impl/TestRequestResponse.php b/tests/PHPUnit/Framework/TestRequest/Response.php similarity index 95% rename from tests/PHPUnit/Impl/TestRequestResponse.php rename to tests/PHPUnit/Framework/TestRequest/Response.php index 026f2c43b48a2301c52ac203281fa2b65a7894ef..76bf43c149325a095a2db2f89917467061f52a9c 100644 --- a/tests/PHPUnit/Impl/TestRequestResponse.php +++ b/tests/PHPUnit/Framework/TestRequest/Response.php @@ -6,16 +6,17 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -namespace Piwik\Tests\Impl; +namespace Piwik\Tests\Framework\TestRequest; use Piwik\API\Request; use PHPUnit_Framework_Assert as Asserts; use Exception; +use Piwik\Tests\Framework\TestCase\SystemTestCase; /** * Utility class used to obtain and process API responses for API tests. */ -class TestRequestResponse +class Response { private $processedResponseText; @@ -50,7 +51,7 @@ class TestRequestResponse throw new Exception("$path does not exist"); } - return new TestRequestResponse($contents, $params, $requestUrl); + return new Response($contents, $params, $requestUrl); } public static function loadFromApi($params, $requestUrl) @@ -61,10 +62,10 @@ class TestRequestResponse // with format=original, objects or php arrays can be returned. $response = (string) $testRequest->process(); - return new TestRequestResponse($response, $params, $requestUrl); + return new Response($response, $params, $requestUrl); } - public static function assertEquals(TestRequestResponse $expected, TestRequestResponse $actual, $message = false) + public static function assertEquals(Response $expected, Response $actual, $message = false) { $expectedText = $expected->getResponseText(); $actualText = $actual->getResponseText(); @@ -121,10 +122,11 @@ class TestRequestResponse private function normalizeEncodingPhp533($apiResponse) { - if(!SystemTestCase::isPhpVersion53() + if (!SystemTestCase::isPhpVersion53() || strpos($apiResponse, '<result') === false) { return $apiResponse; } + return str_replace('&#039;', "'", $apiResponse); } @@ -250,6 +252,7 @@ class TestRequestResponse $response = str_replace('.00</revenue>', '</revenue>', $response); $response = str_replace('.1</revenue>', '</revenue>', $response); $response = str_replace('.11</revenue>', '</revenue>', $response); + return $response; } @@ -258,6 +261,7 @@ class TestRequestResponse if (strpos($this->requestUrl['format'], 'json') === 0) { $apiResponse = str_replace(' ', '\u00a0', $apiResponse); } + return $apiResponse; } } \ No newline at end of file diff --git a/tests/PHPUnit/Integration/AccessTest.php b/tests/PHPUnit/Integration/AccessTest.php index aad0e227667f7ac3c56f0f9a32ac9bacf5dceae7..f309d1dc9947e824c918b4dc74ce1202a1203ec5 100644 --- a/tests/PHPUnit/Integration/AccessTest.php +++ b/tests/PHPUnit/Integration/AccessTest.php @@ -7,7 +7,7 @@ */ use Piwik\Access; use Piwik\AuthResult; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Class Core_AccessTest diff --git a/tests/PHPUnit/Integration/ArchiveProcessingTest.php b/tests/PHPUnit/Integration/ArchiveProcessingTest.php index 88ec83bea6557e761f192b3a81e0165eebe2837f..6514a101341b47513fa5ef93f25966d2582cf4b6 100644 --- a/tests/PHPUnit/Integration/ArchiveProcessingTest.php +++ b/tests/PHPUnit/Integration/ArchiveProcessingTest.php @@ -20,7 +20,7 @@ use Piwik\Plugins\SitesManager\API; use Piwik\Segment; use Piwik\SettingsServer; use Piwik\Site; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; class Core_ArchiveProcessorTest extends ArchiveProcessor\Loader { diff --git a/tests/PHPUnit/Integration/CliMultiTest.php b/tests/PHPUnit/Integration/CliMultiTest.php index 65df6b89ba8e6b7995faa328411a0fbd19615cd5..d96a109e669d0b39491edda529ad7461a29a64bf 100644 --- a/tests/PHPUnit/Integration/CliMultiTest.php +++ b/tests/PHPUnit/Integration/CliMultiTest.php @@ -8,8 +8,8 @@ use Piwik\CliMulti; use Piwik\Version; -use Piwik\Tests\Impl\SystemTestCase; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\TestCase\SystemTestCase; +use Piwik\Tests\Framework\Fixture; /** * Class Core_CliMultiTest diff --git a/tests/PHPUnit/Integration/CronArchive/SharedSiteIdsTest.php b/tests/PHPUnit/Integration/CronArchive/SharedSiteIdsTest.php index 4fcba84352dab91c90067ad4613349ac80ad027c..43962ff17b1f6076a3389ac76c5b7b94d0ff11e1 100644 --- a/tests/PHPUnit/Integration/CronArchive/SharedSiteIdsTest.php +++ b/tests/PHPUnit/Integration/CronArchive/SharedSiteIdsTest.php @@ -7,7 +7,7 @@ */ use Piwik\CronArchive\SharedSiteIds; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group Core diff --git a/tests/PHPUnit/Integration/DbTest.php b/tests/PHPUnit/Integration/DbTest.php index 562e8f9a350509114b2ceada4469acae2a4bda32..c7a8e465eb4207f516ea6d6605a758a3fb214d78 100644 --- a/tests/PHPUnit/Integration/DbTest.php +++ b/tests/PHPUnit/Integration/DbTest.php @@ -7,7 +7,7 @@ */ use Piwik\Common; use Piwik\Db; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Class Core_DbTest diff --git a/tests/PHPUnit/Integration/HttpTest.php b/tests/PHPUnit/Integration/HttpTest.php index 07d7736bfd9f786096aac2943d42938c76c526db..4b54785f66f57223dc319c58fe75b4b0c5fcda93 100644 --- a/tests/PHPUnit/Integration/HttpTest.php +++ b/tests/PHPUnit/Integration/HttpTest.php @@ -6,7 +6,7 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ use Piwik\Http; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * @group HttpTest diff --git a/tests/PHPUnit/Integration/JsProxyTest.php b/tests/PHPUnit/Integration/JsProxyTest.php index dc900930cfc2d0607de346047f316f93018f124d..d95224a452263a9dc85eb9a254415571606b6603 100644 --- a/tests/PHPUnit/Integration/JsProxyTest.php +++ b/tests/PHPUnit/Integration/JsProxyTest.php @@ -6,7 +6,7 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; class Test_Piwik_JsProxy extends PHPUnit_Framework_TestCase { diff --git a/tests/PHPUnit/Integration/LogTest.php b/tests/PHPUnit/Integration/LogTest.php index 6e453fa858618cb85748c21d9fb6b18e44d0295e..8934e31e856a2eeeae34f8c3964aa113f2cfe584 100644 --- a/tests/PHPUnit/Integration/LogTest.php +++ b/tests/PHPUnit/Integration/LogTest.php @@ -12,7 +12,7 @@ use Piwik\Error; use Piwik\ExceptionHandler; use Piwik\Log; use Piwik\Plugins\TestPlugin\TestLoggingUtility; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; require_once PIWIK_INCLUDE_PATH . '/tests/resources/TestPluginLogClass.php'; diff --git a/tests/PHPUnit/Integration/OptionTest.php b/tests/PHPUnit/Integration/OptionTest.php index 42c8418e12ed4748c87e43b8ea92a168ad6b48d9..0e6b8cba7d93cdb1b4f37c903220ac1b4d31bf20 100644 --- a/tests/PHPUnit/Integration/OptionTest.php +++ b/tests/PHPUnit/Integration/OptionTest.php @@ -8,7 +8,7 @@ use Piwik\Common; use Piwik\Db; use Piwik\Option; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Class Core_OptionTest diff --git a/tests/PHPUnit/Integration/PiwikTest.php b/tests/PHPUnit/Integration/PiwikTest.php index c73f8bb0b48396d89e8bb6f46961f2a82db1f661..f81aeae08167ec6ee48e7651a80f61686d0c5405 100644 --- a/tests/PHPUnit/Integration/PiwikTest.php +++ b/tests/PHPUnit/Integration/PiwikTest.php @@ -11,7 +11,7 @@ use Piwik\MetricsFormatter; use Piwik\Piwik; use Piwik\Plugins\SitesManager\API; use Piwik\Translate; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Class Core_PiwikTest diff --git a/tests/PHPUnit/Integration/Plugin/SettingsTest.php b/tests/PHPUnit/Integration/Plugin/SettingsTest.php index 29b4cb3b392ba2f102d6aa0d21f90bbd35d1025d..ffec54ce5808159b4636392a632749742d9dd3fa 100644 --- a/tests/PHPUnit/Integration/Plugin/SettingsTest.php +++ b/tests/PHPUnit/Integration/Plugin/SettingsTest.php @@ -9,7 +9,7 @@ use Piwik\Access; use Piwik\Plugin\Settings as PluginSettings; use Piwik\Settings\Setting; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; class CorePluginSettingsTest extends \Piwik\Plugins\ExampleSettingsPlugin\Settings { diff --git a/tests/PHPUnit/Integration/ReportTest.php b/tests/PHPUnit/Integration/ReportTest.php index ce3d87d38f3bda5bce609e7b3465d5f8867542b0..a9a3ef74be59d7cc6cf4d194fd99adff7eff022d 100644 --- a/tests/PHPUnit/Integration/ReportTest.php +++ b/tests/PHPUnit/Integration/ReportTest.php @@ -18,8 +18,8 @@ use Piwik\WidgetsList; use Piwik\Translate; use Piwik\Menu\MenuReporting; use Piwik\Plugin\Manager as PluginManager; -use Piwik\Tests\Impl\Fixture; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; class GetBasicReport extends Report { diff --git a/tests/PHPUnit/Integration/SegmentTest.php b/tests/PHPUnit/Integration/SegmentTest.php index 15277e379d1491c27ac4ef257aadda33380f94e7..c4721b233975fd5f2b41469b19d8a51b6294366a 100644 --- a/tests/PHPUnit/Integration/SegmentTest.php +++ b/tests/PHPUnit/Integration/SegmentTest.php @@ -8,7 +8,7 @@ use Piwik\Access; use Piwik\Common; use Piwik\Segment; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group SegmentTest diff --git a/tests/PHPUnit/Integration/ServeStaticFileTest.php b/tests/PHPUnit/Integration/ServeStaticFileTest.php index c8ff7f9c69439ef6e87e74d780b482c5838ed54d..bdf288efd4b746860a23eb3b4e4ca9522378f0f3 100644 --- a/tests/PHPUnit/Integration/ServeStaticFileTest.php +++ b/tests/PHPUnit/Integration/ServeStaticFileTest.php @@ -17,7 +17,7 @@ use Piwik\ProxyHttp; use Piwik\SettingsServer; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; define("TEST_FILE_LOCATION", realpath(dirname(__FILE__) . "/../../resources/lipsum.txt")); define("TEST_FILE_CONTENT_TYPE", "text/plain"); diff --git a/tests/PHPUnit/Integration/SqlTest.php b/tests/PHPUnit/Integration/SqlTest.php index 3d6fbac9e3530eebf11100a67160c2b64d1edfe2..aed82013c974695e7ef7f29aa75b9a809a408b67 100755 --- a/tests/PHPUnit/Integration/SqlTest.php +++ b/tests/PHPUnit/Integration/SqlTest.php @@ -1,6 +1,6 @@ <?php use Piwik\Db; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Piwik - free/libre analytics platform diff --git a/tests/PHPUnit/Integration/Tracker/ActionTest.php b/tests/PHPUnit/Integration/Tracker/ActionTest.php index 17da150bd69a7ba45309e9a389d600c5cf80f7cb..dd3388a56cc943bc8af9c00e471fcab32b455011 100644 --- a/tests/PHPUnit/Integration/Tracker/ActionTest.php +++ b/tests/PHPUnit/Integration/Tracker/ActionTest.php @@ -13,7 +13,7 @@ use Piwik\Tracker\PageUrl; use Piwik\Tracker\Request; use Piwik\Translate; use Piwik\Plugin\Manager as PluginManager; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Piwik - free/libre analytics platform diff --git a/tests/PHPUnit/Integration/Tracker/DbTest.php b/tests/PHPUnit/Integration/Tracker/DbTest.php index 91d01d0cfeaea1acc34f3e9aacdea635d5d33425..8bfdd5232f5df069eab2d4a23d3104e8eff9115e 100644 --- a/tests/PHPUnit/Integration/Tracker/DbTest.php +++ b/tests/PHPUnit/Integration/Tracker/DbTest.php @@ -7,7 +7,7 @@ */ use Piwik\Common; use Piwik\Db; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Tracker DB test diff --git a/tests/PHPUnit/Integration/Tracker/Visit2Test.php b/tests/PHPUnit/Integration/Tracker/Visit2Test.php index a5b3c0541cd257bd78e7a95fdf73c35f5a6ed753..5c191d90ee97ec4c0e262ad5b38ea9ff4d93ad37 100644 --- a/tests/PHPUnit/Integration/Tracker/Visit2Test.php +++ b/tests/PHPUnit/Integration/Tracker/Visit2Test.php @@ -14,8 +14,8 @@ use Piwik\Tracker\Request; use Piwik\Tracker\Visitor; use Piwik\Piwik; use Piwik\EventDispatcher; -use Piwik\Tests\Impl\Fixture; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; class FakeTrackerVisitDimension1 extends VisitDimension { diff --git a/tests/PHPUnit/Integration/Tracker/VisitTest.php b/tests/PHPUnit/Integration/Tracker/VisitTest.php index cdc69110d4f59704c2d058d9322b99394682cecb..0d1837e2c109f0f2e7936b1a431305ae1014401a 100644 --- a/tests/PHPUnit/Integration/Tracker/VisitTest.php +++ b/tests/PHPUnit/Integration/Tracker/VisitTest.php @@ -10,7 +10,7 @@ use Piwik\IP; use Piwik\Plugins\SitesManager\API; use Piwik\Tracker\Request; use Piwik\Tracker\VisitExcluded; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Class Core_Tracker_VisitTest diff --git a/tests/PHPUnit/Integration/TrackerTest.php b/tests/PHPUnit/Integration/TrackerTest.php index 53865b09933f9f075700083069c1a025ad9ecb16..59fa07cd97929f9ac7e639c4674b99949563b5a8 100644 --- a/tests/PHPUnit/Integration/TrackerTest.php +++ b/tests/PHPUnit/Integration/TrackerTest.php @@ -6,8 +6,8 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -use Piwik\Tests\Impl\Fixture; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * @group Core diff --git a/tests/PHPUnit/Integration/TravisEnvironmentTest.php b/tests/PHPUnit/Integration/TravisEnvironmentTest.php index c8fce30ba279a03cfdee6c034c92b7746c367310..5faf9cbe1005cdae4de6c5cd5ba400939d284a73 100644 --- a/tests/PHPUnit/Integration/TravisEnvironmentTest.php +++ b/tests/PHPUnit/Integration/TravisEnvironmentTest.php @@ -1,7 +1,7 @@ <?php use Piwik\Translate; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Class TravisEnvironmentTest diff --git a/tests/PHPUnit/Integration/UpdaterTest.php b/tests/PHPUnit/Integration/UpdaterTest.php index a0b7662b63e85d278b7ea3cfd5929f96468ec7e6..563de9abfed8dbc61c747a6e8fc7460fcb098669 100644 --- a/tests/PHPUnit/Integration/UpdaterTest.php +++ b/tests/PHPUnit/Integration/UpdaterTest.php @@ -7,9 +7,9 @@ */ namespace Piwik\Tests\Integration\Core; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; use Piwik\Updater; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Class Core_UpdaterTest diff --git a/tests/PHPUnit/Integration/ViewDataTable/ManagerTest.php b/tests/PHPUnit/Integration/ViewDataTable/ManagerTest.php index 6f738188017f17f64c7d076b720fd74552c0cf44..b6ef41d9f6727e62ecc65df02ff2099f52f8cf74 100644 --- a/tests/PHPUnit/Integration/ViewDataTable/ManagerTest.php +++ b/tests/PHPUnit/Integration/ViewDataTable/ManagerTest.php @@ -8,7 +8,7 @@ use Piwik\Access; use Piwik\ViewDataTable\Manager as ViewDataTableManager; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Class Core_Plugin_SettingsTest diff --git a/tests/PHPUnit/Integration/WidgetsListTest.php b/tests/PHPUnit/Integration/WidgetsListTest.php index 865dd5a72a6165bb943476ec2162915dfb778df8..9c980e872cf849a389a4f4de6b40a41e2663d9b9 100644 --- a/tests/PHPUnit/Integration/WidgetsListTest.php +++ b/tests/PHPUnit/Integration/WidgetsListTest.php @@ -9,8 +9,8 @@ use Piwik\Access; use Piwik\Plugins\Goals\API; use Piwik\WidgetsList; -use Piwik\Tests\Impl\Fixture; -use Piwik\Tests\Impl\IntegrationTestCase; +use Piwik\Tests\Framework\Fixture; +use Piwik\Tests\Framework\TestCase\IntegrationTestCase; /** * Class Core_WidgetsListTest diff --git a/tests/PHPUnit/IntegrationTestCase.php b/tests/PHPUnit/IntegrationTestCase.php index 8cd33978dcfaf3cdd744aa2b5ce82ba064ab180e..6c1c4953405a6d3420a45f4de8fd97238594ffcc 100644 --- a/tests/PHPUnit/IntegrationTestCase.php +++ b/tests/PHPUnit/IntegrationTestCase.php @@ -7,17 +7,17 @@ */ /** - * @deprecated since 2.8.0 extend \Piwik\Tests\Impl\SystemTestCase instead + * @deprecated since 2.8.0 extend \Piwik\Tests\Framework\TestCase\SystemTestCase instead */ -class IntegrationTestCase extends \Piwik\Tests\Impl\SystemTestCase +class IntegrationTestCase extends \Piwik\Tests\Framework\TestCase\SystemTestCase { public static function setUpBeforeClass() { - \Piwik\Log::debug('\IntegrationTestCase is deprecated since 2.8.0 extend \Piwik\Tests\Impl\SystemTestCase instead'); + \Piwik\Log::debug('\IntegrationTestCase is deprecated since 2.8.0 extend \Piwik\Tests\Framework\TestCase\SystemTestCase instead'); parent::setUpBeforeClass(); } } -IntegrationTestCase::$fixture = new \Piwik\Tests\Impl\Fixture(); \ No newline at end of file +IntegrationTestCase::$fixture = new \Piwik\Tests\Framework\Fixture(); \ No newline at end of file diff --git a/tests/PHPUnit/System/AnnotationsTest.php b/tests/PHPUnit/System/AnnotationsTest.php index 42a5bb237615e280167a5087dc25759628bec0eb..722b104978155b5c2929aba68fadf3564f58df9b 100755 --- a/tests/PHPUnit/System/AnnotationsTest.php +++ b/tests/PHPUnit/System/AnnotationsTest.php @@ -10,7 +10,7 @@ namespace Piwik\Tests\System; use Piwik\Access; use Piwik\API\Request; use Piwik\Plugins\Annotations\API; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoSitesWithAnnotations; use FakeAccess; use Exception; diff --git a/tests/PHPUnit/System/ApiGetReportMetadataTest.php b/tests/PHPUnit/System/ApiGetReportMetadataTest.php index 7772da62240e892eff6e270c3ac760ef894060b8..1270361c3984c8a18c7efc63c139f7c9bddf6525 100755 --- a/tests/PHPUnit/System/ApiGetReportMetadataTest.php +++ b/tests/PHPUnit/System/ApiGetReportMetadataTest.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\System; use Piwik\API\Proxy; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\ThreeGoalsOnePageview; /** diff --git a/tests/PHPUnit/System/ApiGetReportMetadataYearTest.php b/tests/PHPUnit/System/ApiGetReportMetadataYearTest.php index 78edafbb19f34958d5e8f03c833aeb2b1eb1f6c2..c9b8f30e0dcac99416eb950b54b957c50c25ca84 100755 --- a/tests/PHPUnit/System/ApiGetReportMetadataYearTest.php +++ b/tests/PHPUnit/System/ApiGetReportMetadataYearTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\InvalidVisits; /** diff --git a/tests/PHPUnit/System/ArchiveCronTest.php b/tests/PHPUnit/System/ArchiveCronTest.php index 3d328a39274229f41dbe8069c132bf74815a227c..c0a834b5d79a52f09ee9024263ba96c6fea00690 100644 --- a/tests/PHPUnit/System/ArchiveCronTest.php +++ b/tests/PHPUnit/System/ArchiveCronTest.php @@ -9,9 +9,9 @@ namespace Piwik\Tests\System; use Piwik\Date; use Piwik\Plugins\SitesManager\API; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\ManySitesImportedLogs; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; use Exception; /** diff --git a/tests/PHPUnit/System/ArchiveInvalidationTest.php b/tests/PHPUnit/System/ArchiveInvalidationTest.php index 1a0d1dff3855d0147eba90d9589ef8be2e2fe1d3..bd97f784134bd1b5eed46065d73fd3b0c284d766 100644 --- a/tests/PHPUnit/System/ArchiveInvalidationTest.php +++ b/tests/PHPUnit/System/ArchiveInvalidationTest.php @@ -10,7 +10,7 @@ namespace Piwik\Tests\System; use Piwik\API\Request; use Piwik\Config; use Piwik\Tests\Fixtures\VisitsTwoWebsitesWithAdditionalVisits; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; /** * Track visits before website creation date and test that Piwik handles them correctly. diff --git a/tests/PHPUnit/System/ArchiveWebTest.php b/tests/PHPUnit/System/ArchiveWebTest.php index 610c83de450c507f88ab0a568fd29c2601a42116..869795dec6612c6877d8c2dc5997a2c46ab0389e 100644 --- a/tests/PHPUnit/System/ArchiveWebTest.php +++ b/tests/PHPUnit/System/ArchiveWebTest.php @@ -9,9 +9,9 @@ namespace Piwik\Tests\System; use Piwik\Option; use Piwik\Http; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\ManySitesImportedLogs; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; use Exception; /** diff --git a/tests/PHPUnit/System/AutoSuggestAPITest.php b/tests/PHPUnit/System/AutoSuggestAPITest.php index f86e6b869cc52fad405e5403e8db7007f56fc92a..d7d23f58c58f3f3ab0e18e6fa8605b6c1a5bd4bb 100644 --- a/tests/PHPUnit/System/AutoSuggestAPITest.php +++ b/tests/PHPUnit/System/AutoSuggestAPITest.php @@ -9,9 +9,9 @@ namespace Piwik\Tests\System; use Piwik\API\Request; use Piwik\Date; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\ManyVisitsWithGeoIP; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * testing a the auto suggest API for all known segments diff --git a/tests/PHPUnit/System/BackwardsCompatibility1XTest.php b/tests/PHPUnit/System/BackwardsCompatibility1XTest.php index 0ed7dc208d25f3d3735096a6362bed8aaf076041..cc13b51e9193ffdf8d5660e2d906e1dd0e9fa2b1 100644 --- a/tests/PHPUnit/System/BackwardsCompatibility1XTest.php +++ b/tests/PHPUnit/System/BackwardsCompatibility1XTest.php @@ -10,9 +10,9 @@ namespace Piwik\Tests\System; use Piwik\Common; use Piwik\Db; use Piwik\Plugins\VisitFrequency\API as VisitFrequencyApi; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\SqlDump; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * Tests that Piwik 2.0 works w/ data from Piwik 1.12. diff --git a/tests/PHPUnit/System/BlobReportLimitingTest.php b/tests/PHPUnit/System/BlobReportLimitingTest.php index f38ee05da71c8a52d9a069445a527f7d14470da6..f54a6aaafd5696fa751ef3f098488a4eb76200b1 100755 --- a/tests/PHPUnit/System/BlobReportLimitingTest.php +++ b/tests/PHPUnit/System/BlobReportLimitingTest.php @@ -9,11 +9,9 @@ namespace Piwik\Tests\System; use Piwik\Config; use Piwik\Plugins\Actions\ArchivingHelper; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\ManyVisitsWithMockLocationProvider; -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/MockLocationProvider.php'; - /** * Test Piwik's report limiting code. Make sure the datatable_archiving_maximum_rows_... * config options limit the size of certain reports when archiving. diff --git a/tests/PHPUnit/System/CsvExportTest.php b/tests/PHPUnit/System/CsvExportTest.php index 2069b70cd46e64b9e17d4e2bd92725c579fec79c..5c251186c6aec562b41a9cd20bbec977ca3c9b72 100755 --- a/tests/PHPUnit/System/CsvExportTest.php +++ b/tests/PHPUnit/System/CsvExportTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoVisitsWithCustomVariables; /** diff --git a/tests/PHPUnit/System/CustomEventsTest.php b/tests/PHPUnit/System/CustomEventsTest.php index 1560a91b217b7ea294cac0ed8b750bf4c738a38c..a655750164f9e64f9cd1706caa09df0b802bd936 100644 --- a/tests/PHPUnit/System/CustomEventsTest.php +++ b/tests/PHPUnit/System/CustomEventsTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoVisitsWithCustomEvents; /** diff --git a/tests/PHPUnit/System/EcommerceOrderWithItemsTest.php b/tests/PHPUnit/System/EcommerceOrderWithItemsTest.php index 0cf6423a8dfdf51aee3d0f7e60417ab6782e1d3c..5ac300b2e99d228818a9dd2b4aa05d33475e7e66 100755 --- a/tests/PHPUnit/System/EcommerceOrderWithItemsTest.php +++ b/tests/PHPUnit/System/EcommerceOrderWithItemsTest.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\System; use Piwik\Date; use Piwik\Piwik; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoSitesEcommerceOrderWithItems; /** diff --git a/tests/PHPUnit/System/FlattenReportsTest.php b/tests/PHPUnit/System/FlattenReportsTest.php index 046bdb8d3d972076edd2b0d576a7c3dc739d534b..5d3a64560789067f165f59abaf88ad824db3c171 100644 --- a/tests/PHPUnit/System/FlattenReportsTest.php +++ b/tests/PHPUnit/System/FlattenReportsTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\ManyVisitsWithSubDirReferrersAndCustomVars; /** diff --git a/tests/PHPUnit/System/ImportLogsTest.php b/tests/PHPUnit/System/ImportLogsTest.php index 9dcbbd2a1dbd2261000e64f581b1139525ca12cf..44c6b7b0b9c137d7b33c5fca26e8f8ae1322b213 100755 --- a/tests/PHPUnit/System/ImportLogsTest.php +++ b/tests/PHPUnit/System/ImportLogsTest.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\System; use Piwik\Access; use Piwik\Plugins\SitesManager\API; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\ManySitesImportedLogs; /** diff --git a/tests/PHPUnit/System/LabelFilterTest.php b/tests/PHPUnit/System/LabelFilterTest.php index d58f42bc4cf0a0e480fb34aefc91274aa29ccfaa..809409754bdf9bdfab1dfd5d8e31bd9edab9e410 100644 --- a/tests/PHPUnit/System/LabelFilterTest.php +++ b/tests/PHPUnit/System/LabelFilterTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\OneVisitSeveralPageViews; /** diff --git a/tests/PHPUnit/System/ManyVisitorsOneWebsiteTest.php b/tests/PHPUnit/System/ManyVisitorsOneWebsiteTest.php index 72994a3f16e0b17f396a002ab2621abbca7c9e6d..8910c8568e674464f0b9bcfbcd22876af8aa7a6d 100755 --- a/tests/PHPUnit/System/ManyVisitorsOneWebsiteTest.php +++ b/tests/PHPUnit/System/ManyVisitorsOneWebsiteTest.php @@ -7,10 +7,8 @@ */ namespace Piwik\Tests\System; -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/MockLocationProvider.php'; - use Piwik\Date; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\ManyVisitsWithGeoIP; /** diff --git a/tests/PHPUnit/System/MultipleSitesArchivingTest.php b/tests/PHPUnit/System/MultipleSitesArchivingTest.php index 25a1c1569cb4a91cc8af504f5f08f16267f1b205..b62feb8263e6c3824d9be97aff09adf8030ef07b 100644 --- a/tests/PHPUnit/System/MultipleSitesArchivingTest.php +++ b/tests/PHPUnit/System/MultipleSitesArchivingTest.php @@ -9,9 +9,9 @@ namespace Piwik\Tests\System; use Piwik\Config; use Piwik\Piwik; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; use Piwik\Tests\Fixtures\ThreeSitesWithSharedVisitors; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; /** * @group Core diff --git a/tests/PHPUnit/System/NoVisitTest.php b/tests/PHPUnit/System/NoVisitTest.php index a9851358bf4f2cd8a668db2fedc7b20d7198075f..fb4f498386e71db3321f2691b68ce98252a9d8b6 100755 --- a/tests/PHPUnit/System/NoVisitTest.php +++ b/tests/PHPUnit/System/NoVisitTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\InvalidVisits; /** diff --git a/tests/PHPUnit/System/NonUnicodeTest.php b/tests/PHPUnit/System/NonUnicodeTest.php index 5bcbfe1dd0477181a7139b655d4f5c4e5776e5be..e498370559c223bdc6240b671faa5ac6d5b45629 100755 --- a/tests/PHPUnit/System/NonUnicodeTest.php +++ b/tests/PHPUnit/System/NonUnicodeTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\SomeVisitsWithNonUnicodePageTitles; /** diff --git a/tests/PHPUnit/System/OneVisitorLongUrlsTruncatedTest.php b/tests/PHPUnit/System/OneVisitorLongUrlsTruncatedTest.php index 5ec5f22d4a9a462b51156d0a88d4e6a19422dedb..d6f2742da5ae4a65774f5780cec0c69cb61e806e 100644 --- a/tests/PHPUnit/System/OneVisitorLongUrlsTruncatedTest.php +++ b/tests/PHPUnit/System/OneVisitorLongUrlsTruncatedTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\SomeVisitsWithLongUrls; /** diff --git a/tests/PHPUnit/System/OneVisitorNoKeywordSpecifiedTest.php b/tests/PHPUnit/System/OneVisitorNoKeywordSpecifiedTest.php index 23d418b0ade510e0c96c6d3261cf2b9b5eea33a1..0e2f56aa4dce73d62681798307aca06d1fa5da30 100755 --- a/tests/PHPUnit/System/OneVisitorNoKeywordSpecifiedTest.php +++ b/tests/PHPUnit/System/OneVisitorNoKeywordSpecifiedTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoVisitsNoKeywordWithBot; /** diff --git a/tests/PHPUnit/System/OneVisitorOneWebsiteSeveralDaysDateRangeArchivingTestsTest.php b/tests/PHPUnit/System/OneVisitorOneWebsiteSeveralDaysDateRangeArchivingTestsTest.php index 85dcb876737e21065c631cb83826d004dccdf0fe..1ab4ed0505e8f9d95dbd32263a2f52c66471ab4c 100755 --- a/tests/PHPUnit/System/OneVisitorOneWebsiteSeveralDaysDateRangeArchivingTestsTest.php +++ b/tests/PHPUnit/System/OneVisitorOneWebsiteSeveralDaysDateRangeArchivingTestsTest.php @@ -10,7 +10,7 @@ namespace Piwik\Tests\System; use Piwik\Common; use Piwik\Db; use Piwik\Piwik; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\VisitsOverSeveralDays; /** diff --git a/tests/PHPUnit/System/OneVisitorOneWebsiteSeveralDaysDateRangeTest.php b/tests/PHPUnit/System/OneVisitorOneWebsiteSeveralDaysDateRangeTest.php index 82629f69ec2438af327302fe89d6d87e1cacc25c..a0bdae8d8fb8b27bb0b84a19e5f9b29da233f5cc 100755 --- a/tests/PHPUnit/System/OneVisitorOneWebsiteSeveralDaysDateRangeTest.php +++ b/tests/PHPUnit/System/OneVisitorOneWebsiteSeveralDaysDateRangeTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\VisitsOverSeveralDays; /** diff --git a/tests/PHPUnit/System/OneVisitorSeveralDaysImportedInRandomOrderTest.php b/tests/PHPUnit/System/OneVisitorSeveralDaysImportedInRandomOrderTest.php index de66f3289bf5c9c2be828e1798790432cd48b144..76a165c35cdddddee6885cd764460a21d4251f65 100644 --- a/tests/PHPUnit/System/OneVisitorSeveralDaysImportedInRandomOrderTest.php +++ b/tests/PHPUnit/System/OneVisitorSeveralDaysImportedInRandomOrderTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\VisitOverSeveralDaysImportedLogs; /** diff --git a/tests/PHPUnit/System/OneVisitorTwoVisitsTest.php b/tests/PHPUnit/System/OneVisitorTwoVisitsTest.php index a3b25892ef50861da982d26469e54759f0573d75..287e6799f14d294f0fcf45eaef0149150fe68cc6 100755 --- a/tests/PHPUnit/System/OneVisitorTwoVisitsTest.php +++ b/tests/PHPUnit/System/OneVisitorTwoVisitsTest.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\System; use Piwik\API\Proxy; use Piwik\Archive; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\OneVisitorTwoVisits; use Exception; diff --git a/tests/PHPUnit/System/OneVisitorTwoVisitsWithCookieSupportTest.php b/tests/PHPUnit/System/OneVisitorTwoVisitsWithCookieSupportTest.php index 966382045d973f05d7d2e4b48d52434f80ad9730..82ce3d5e2320248c87e3fedf9d9887cb5423ab98 100755 --- a/tests/PHPUnit/System/OneVisitorTwoVisitsWithCookieSupportTest.php +++ b/tests/PHPUnit/System/OneVisitorTwoVisitsWithCookieSupportTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\OneVisitorTwoVisits; /** diff --git a/tests/PHPUnit/System/PeriodIsRangeDateIsLastNMetadataAndNormalAPITest.php b/tests/PHPUnit/System/PeriodIsRangeDateIsLastNMetadataAndNormalAPITest.php index 92f1a8bb4aea745953207e17b0114f5e2ef94154..e38c680f3037df07bf162c2f22bc7f11cc5b0837 100755 --- a/tests/PHPUnit/System/PeriodIsRangeDateIsLastNMetadataAndNormalAPITest.php +++ b/tests/PHPUnit/System/PeriodIsRangeDateIsLastNMetadataAndNormalAPITest.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\System; use Piwik\Date; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoVisitsWithCustomVariables; /** diff --git a/tests/PHPUnit/System/PivotByQueryParamTest.php b/tests/PHPUnit/System/PivotByQueryParamTest.php index 15af9b5373033bf488d2f66e837756053f343468..f46813e87985e171e9cc993cd1d22bc96de40215 100644 --- a/tests/PHPUnit/System/PivotByQueryParamTest.php +++ b/tests/PHPUnit/System/PivotByQueryParamTest.php @@ -10,7 +10,7 @@ namespace Piwik\Tests\System; use Piwik\Config; use Piwik\Date; use Piwik\Tests\Fixtures\ManyVisitsWithMockLocationProvider; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; /** * @group Core diff --git a/tests/PHPUnit/System/PrivacyManagerTest.php b/tests/PHPUnit/System/PrivacyManagerTest.php index 79fcd1bccdea1eec1ef22d41abd1f5ec6ad3da5b..18b197a4102eb215279cd01ad4d5110f8a86f57e 100644 --- a/tests/PHPUnit/System/PrivacyManagerTest.php +++ b/tests/PHPUnit/System/PrivacyManagerTest.php @@ -25,8 +25,8 @@ use Piwik\Plugins\VisitorInterest\API as APIVisitorInterest; use Piwik\Site; use Piwik\Tracker\Cache; use Piwik\Tracker\GoalManager; -use Piwik\Tests\Impl\SystemTestCase; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\TestCase\SystemTestCase; +use Piwik\Tests\Framework\Fixture; require_once PIWIK_INCLUDE_PATH . '/plugins/PrivacyManager/PrivacyManager.php'; diff --git a/tests/PHPUnit/System/PurgeDataTest.php b/tests/PHPUnit/System/PurgeDataTest.php index 3e1d8f4b530ede2a36398321f11f078fee9ff559..6573f63db040025f01a96189dcb8809aa400ccf6 100755 --- a/tests/PHPUnit/System/PurgeDataTest.php +++ b/tests/PHPUnit/System/PurgeDataTest.php @@ -7,12 +7,10 @@ */ namespace Piwik\Tests\System; -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/MockLocationProvider.php'; - use Piwik\API\Request; use Piwik\Plugins\PrivacyManager\PrivacyManager; use Piwik\Plugins\PrivacyManager\ReportsPurger; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\OneVisitorTwoVisits; /** diff --git a/tests/PHPUnit/System/RowEvolutionTest.php b/tests/PHPUnit/System/RowEvolutionTest.php index e70379279fb3ea36bea927e8cadb6eeeae9843b2..0fba18234dc1a96412b6e627c0c0124f7aa0048a 100755 --- a/tests/PHPUnit/System/RowEvolutionTest.php +++ b/tests/PHPUnit/System/RowEvolutionTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoSitesManyVisitsOverSeveralDaysWithSearchEngineReferrers; /** diff --git a/tests/PHPUnit/System/SiteSearchTest.php b/tests/PHPUnit/System/SiteSearchTest.php index 653d361951c2e801953b4a79e7978e48dbd87045..ee9c8bce467b527719440c1f9f452e5bcb8e85fd 100755 --- a/tests/PHPUnit/System/SiteSearchTest.php +++ b/tests/PHPUnit/System/SiteSearchTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\ThreeSitesWithManyVisitsWithSiteSearch; /** diff --git a/tests/PHPUnit/System/TimezonesTest.php b/tests/PHPUnit/System/TimezonesTest.php index 952f045c16be5df39e5c71967470fb53aad856a4..da5be4e6e5b5f0d8e0ca216bffe6799d426d0013 100644 --- a/tests/PHPUnit/System/TimezonesTest.php +++ b/tests/PHPUnit/System/TimezonesTest.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\System; use Piwik\Date; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\VisitsInDifferentTimezones; /** diff --git a/tests/PHPUnit/System/TrackCustomVariablesAndCampaignsForceUsingVisitIdNotHeuristicsTest.php b/tests/PHPUnit/System/TrackCustomVariablesAndCampaignsForceUsingVisitIdNotHeuristicsTest.php index 95da206c6aa8843c195317b0111a8432b38d2211..2a08882e8dba01e383ce41d2364479969dc18a4a 100755 --- a/tests/PHPUnit/System/TrackCustomVariablesAndCampaignsForceUsingVisitIdNotHeuristicsTest.php +++ b/tests/PHPUnit/System/TrackCustomVariablesAndCampaignsForceUsingVisitIdNotHeuristicsTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\SomeVisitsCustomVariablesCampaignsNotHeuristics; /** diff --git a/tests/PHPUnit/System/TrackGoalsAllowMultipleConversionsPerVisitTest.php b/tests/PHPUnit/System/TrackGoalsAllowMultipleConversionsPerVisitTest.php index ab345bee35a198c32f94d75492c1d4c8ca7a6b10..df052b6e6b4484663c1f65046245d19d1827f342 100755 --- a/tests/PHPUnit/System/TrackGoalsAllowMultipleConversionsPerVisitTest.php +++ b/tests/PHPUnit/System/TrackGoalsAllowMultipleConversionsPerVisitTest.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\System; use Piwik\Plugins\Goals\API; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\SomeVisitsAllConversions; /** diff --git a/tests/PHPUnit/System/TrackerWindowLookBackTest.php b/tests/PHPUnit/System/TrackerWindowLookBackTest.php index aa908ab3162fbb5813dd9aa40e6a1d4a8c61ff6e..9530c7c0b01c558589d7af15c23a6fc5404a483e 100644 --- a/tests/PHPUnit/System/TrackerWindowLookBackTest.php +++ b/tests/PHPUnit/System/TrackerWindowLookBackTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\VisitsOverSeveralDays; /** diff --git a/tests/PHPUnit/System/TransitionsTest.php b/tests/PHPUnit/System/TransitionsTest.php index fc0549bdbfe40a31d103f03fd8bf6542c9d1b12d..3049d0f823eb2358f4770f72ee44c2999e2fd66a 100644 --- a/tests/PHPUnit/System/TransitionsTest.php +++ b/tests/PHPUnit/System/TransitionsTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\SomeVisitsManyPageviewsWithTransitions; /** diff --git a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysArchivingDisabledTest.php b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysArchivingDisabledTest.php index 475575661413895d208141ecc7b44b33d768cb5d..0676950dc825e1545c0f69ccf34c07787ae37d1a 100755 --- a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysArchivingDisabledTest.php +++ b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysArchivingDisabledTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoSitesTwoVisitorsDifferentDays; /** diff --git a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php index 8c64abce71e9a6fecde877783926d60e41e859a7..3d9c595367f41de8cf52a3edf599e3ec7ecb45ca 100755 --- a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php +++ b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\System; use Piwik\Plugins\Goals\Archiver; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoSitesTwoVisitorsDifferentDays; require_once PIWIK_INCLUDE_PATH . '/plugins/Goals/Goals.php'; diff --git a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysTest.php b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysTest.php index 495ada90aa369497430a6f8242cb6cabcdad3c21..65ce66105e856a9eaa3cd1201f6d2fa0ca27f62c 100755 --- a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysTest.php +++ b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoSitesTwoVisitorsDifferentDays; /** diff --git a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentContainsTest.php b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentContainsTest.php index b2d85a893b3f03a635e933d4b942b2b8d20d4fc4..92a4f2dde2e4d1860c6283a6720703bfa0d8d1e1 100755 --- a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentContainsTest.php +++ b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentContainsTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoVisitsWithCustomVariables; /** diff --git a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchALLNoGoalDataTest.php b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchALLNoGoalDataTest.php index e0f579782f9aa12e630d683b3c73151db53df4d5..dca4a1f2943187774b26a845a763334ca1164543 100755 --- a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchALLNoGoalDataTest.php +++ b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchALLNoGoalDataTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoVisitsWithCustomVariables; /** diff --git a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchNONETest.php b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchNONETest.php index 1aa078b5b112d85b4b3ec63d3bacac637f5b5b57..2d9c155feec352b3503f9f28c3244de2d804ddfe 100755 --- a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchNONETest.php +++ b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchNONETest.php @@ -8,9 +8,9 @@ namespace Piwik\Tests\System; use Piwik\Plugins\API\API; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoVisitsWithCustomVariables; -use Piwik\Tests\Impl\Fixture; +use Piwik\Tests\Framework\Fixture; /** * testing a segment containing all supported fields diff --git a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchVisitorTypeTest.php b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchVisitorTypeTest.php index 01a5005278a71c0839dfc1cddc565999f00d6551..a6ba72de3d5f734f8da5322af1571d946c81a6a4 100755 --- a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchVisitorTypeTest.php +++ b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchVisitorTypeTest.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\System; use Piwik\Common; use Piwik\Db; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoVisitsWithCustomVariables; /** diff --git a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesTest.php b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesTest.php index 7bc80d3ade810bec374e44a0ef20f332d3c12027..eb2a28427dc086e42197810a01ef171d0a53ec9a 100755 --- a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesTest.php +++ b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesTest.php @@ -7,7 +7,7 @@ */ namespace Piwik\Tests\System; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoVisitsWithCustomVariables; /** diff --git a/tests/PHPUnit/System/UrlNormalizationTest.php b/tests/PHPUnit/System/UrlNormalizationTest.php index a91a01aad085679c9a4bf84364e79cfe89257d07..0b9a55aceac0332671afc4fa332aadb1398e2bb5 100644 --- a/tests/PHPUnit/System/UrlNormalizationTest.php +++ b/tests/PHPUnit/System/UrlNormalizationTest.php @@ -10,7 +10,7 @@ namespace Piwik\Tests\System; use Piwik\Common; use Piwik\Db; use Piwik\Tracker\Action; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\OneVisitWithAbnormalPageviewUrls; /** diff --git a/tests/PHPUnit/System/UserIdAndVisitorIdTest.php b/tests/PHPUnit/System/UserIdAndVisitorIdTest.php index 4bc0700c089b6bd55af3022cd6cb2e0f6ea337af..6652228b3a979aecdf9c0e8ffa425b6366c5dff8 100644 --- a/tests/PHPUnit/System/UserIdAndVisitorIdTest.php +++ b/tests/PHPUnit/System/UserIdAndVisitorIdTest.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\System; use Piwik\API\Proxy; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\FewVisitsWithSetVisitorId; /** diff --git a/tests/PHPUnit/System/VisitsInPastInvalidateOldReportsTest.php b/tests/PHPUnit/System/VisitsInPastInvalidateOldReportsTest.php index d958dcc894dbdb24a557a08ab370b799a46fa7b0..15149f0ec5294c4327e846ef31d5761535842aef 100644 --- a/tests/PHPUnit/System/VisitsInPastInvalidateOldReportsTest.php +++ b/tests/PHPUnit/System/VisitsInPastInvalidateOldReportsTest.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\System; use Piwik\API\Request; -use Piwik\Tests\Impl\SystemTestCase; +use Piwik\Tests\Framework\TestCase\SystemTestCase; use Piwik\Tests\Fixtures\TwoSitesVisitsInPast; use Exception; diff --git a/tests/PHPUnit/Unit/DeprecatedMethodsTest.php b/tests/PHPUnit/Unit/DeprecatedMethodsTest.php index 4d07c9385779e7cdf82bd4f8a9a1239251b15e48..8bd55c49f8a368fe991017c2105ec215203bd7dd 100644 --- a/tests/PHPUnit/Unit/DeprecatedMethodsTest.php +++ b/tests/PHPUnit/Unit/DeprecatedMethodsTest.php @@ -33,6 +33,9 @@ class DeprecatedMethodsTest extends PHPUnit_Framework_TestCase $validTill = '2015-02-06'; $this->assertDeprecatedClassIsRemoved('\IntegrationTestCase', $validTill); $this->assertDeprecatedClassIsRemoved('\DatabaseTestCase', $validTill); + $this->assertDeprecatedClassIsRemoved('\BenchmarkTestCase', $validTill); + $this->assertDeprecatedClassIsRemoved('\FakeAccess', $validTill); + $this->assertDeprecatedClassIsRemoved('\Piwik\Tests\ConsoleCommandTestCase', $validTill); $this->assertDeprecatedClassIsRemoved('\Piwik\Tests\Fixture', $validTill); $this->assertDeprecatedClassIsRemoved('\Piwik\Tests\OverrideLogin', $validTill); @@ -68,7 +71,7 @@ class DeprecatedMethodsTest extends PHPUnit_Framework_TestCase if (!$now->isLater($removalDate)) { - $errorMessage = $className . 'should still exists until ' . $removalDate . ' although it is deprecated.'; + $errorMessage = $className . ' should still exists until ' . $removalDate . ' although it is deprecated.'; $this->assertTrue($classExists, $errorMessage); return; } diff --git a/tests/PHPUnit/Unit/TaskSchedulerTest.php b/tests/PHPUnit/Unit/TaskSchedulerTest.php index 3ec8781df743ad85e21e8991a332b480b59277b0..70ec2f2ef4f9b567c83b4746d168211680497a1e 100644 --- a/tests/PHPUnit/Unit/TaskSchedulerTest.php +++ b/tests/PHPUnit/Unit/TaskSchedulerTest.php @@ -9,6 +9,7 @@ use Piwik\EventDispatcher; use Piwik\ScheduledTask; use Piwik\ScheduledTaskTimetable; use Piwik\TaskScheduler; +use Piwik\Tests\Framework\Mock\PiwikOption; class TaskSchedulerTest extends PHPUnit_Framework_TestCase { @@ -313,7 +314,7 @@ class TaskSchedulerTest extends PHPUnit_Framework_TestCase private static function stubPiwikOption($timetable) { - self::getReflectedPiwikOptionInstance()->setValue(new MockPiwikOption($timetable)); + self::getReflectedPiwikOptionInstance()->setValue(new PiwikOption($timetable)); } private static function resetPiwikOption() diff --git a/tests/PHPUnit/bootstrap.php b/tests/PHPUnit/bootstrap.php index 8335346c6b07540f3dcd554e85dfde7e28044e78..4ab7f06466005d7e66de5c46b40f0d62a3626fa6 100644 --- a/tests/PHPUnit/bootstrap.php +++ b/tests/PHPUnit/bootstrap.php @@ -27,26 +27,21 @@ if (!defined('PIWIK_INCLUDE_SEARCH_PATH')) { error_reporting(E_ALL | E_NOTICE); @date_default_timezone_set('UTC'); -require_once file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php') - ? PIWIK_INCLUDE_PATH . '/vendor/autoload.php' // Piwik is the main project - : PIWIK_INCLUDE_PATH . '/../../autoload.php'; // Piwik is installed as a dependency +require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; + +\Piwik\Loader::init(); +\Piwik\Loader::registerTestNamespace(); require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php'; require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php'; require_once PIWIK_INCLUDE_PATH . '/core/FrontController.php'; -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Impl/Fixture.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Fixture.php'; -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Impl/SystemTestCase.php'; -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Impl/IntegrationTestCase.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/ConsoleCommandTestCase.php'; +require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/BenchmarkTestCase.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/FakeAccess.php'; -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/MockPiwikOption.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/TestingEnvironment.php'; -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Impl/TestRequestCollection.php'; -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Impl/TestRequestResponse.php'; -require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Impl/ApiTestConfig.php'; if (getenv('PIWIK_USE_XHPROF') == 1) { \Piwik\Profiler::setupProfilerXHProf(); @@ -84,7 +79,7 @@ Try again. -> If you still get this message, you can work around it by specifying Host + Request_Uri at the top of this file tests/PHPUnit/bootstrap.php. <-"; exit(1); } - $baseUrl = \Piwik\Tests\Impl\Fixture::getRootUrl(); + $baseUrl = \Piwik\Tests\Framework\Fixture::getRootUrl(); \Piwik\SettingsPiwik::checkPiwikServerWorking($baseUrl, $acceptInvalidSSLCertificates = true); } diff --git a/tests/PHPUnit/proxy/includes.php b/tests/PHPUnit/proxy/includes.php index b813fd21ad0575de52b4dec5631bd4c3e99d4c1b..01a28db1632141de15ff471d28b1bae4b8be7c04 100644 --- a/tests/PHPUnit/proxy/includes.php +++ b/tests/PHPUnit/proxy/includes.php @@ -9,9 +9,8 @@ if (!defined('PIWIK_USER_PATH')) { define('PIWIK_USER_PATH', PIWIK_INCLUDE_PATH); } -require_once file_exists(PIWIK_INCLUDE_PATH . '/vendor/autoload.php') - ? PIWIK_INCLUDE_PATH . '/vendor/autoload.php' // Piwik is the main project - : PIWIK_INCLUDE_PATH . '/../../autoload.php'; // Piwik is installed as a dependency +require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; +\Piwik\Loader::init(); require_once PIWIK_INCLUDE_PATH . '/core/EventDispatcher.php'; require_once PIWIK_INCLUDE_PATH . '/core/Piwik.php'; diff --git a/tests/resources/staticFileServer.php b/tests/resources/staticFileServer.php index 6ad277863e3bca23b28c966d5be743eba8d3c994..7975b79348f6f7b983ae3663558092b2ef9967c6 100644 --- a/tests/resources/staticFileServer.php +++ b/tests/resources/staticFileServer.php @@ -39,7 +39,9 @@ require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php'; session_cache_limiter('nocache'); @date_default_timezone_set('UTC'); -require_once PIWIK_INCLUDE_PATH .'/vendor/autoload.php'; + +require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; +\Piwik\Loader::init(); // This is Piwik logo, the static file used in this test suit define("TEST_FILE_LOCATION", dirname(__FILE__) . "/lipsum.txt");