Esempio n. 1
0
 public function setUp()
 {
     parent::setUp();
     PiwikCache::flushAll();
     Translate::loadAllTranslations();
     $this->api = API::getInstance();
 }
 public function setUp()
 {
     parent::setUp();
     $self = $this;
     Piwik::addAction('API.Request.dispatch.end', function (&$return, $extra) use($self) {
         if ($extra['module'] !== 'Events') {
             return;
         }
         /** @var DataTable $return*/
         // we make sure processed result is the same at any time
         foreach ($return as &$value) {
             $value->setColumn('sum_event_value', '2');
             $value->setColumn('max_event_value', '2');
             $value->setColumn('min_event_value', '2');
             $value->setColumn('sum_daily_nb_uniq_visitors', '2');
             $value->setColumn('avg_event_value', '2');
             if ($value->isSubtableLoaded()) {
                 $subtable = $value->getSubtable();
                 foreach ($subtable->getRows() as $row) {
                     $row->setColumn('sum_event_value', '2');
                     $row->setColumn('max_event_value', '2');
                     $row->setColumn('min_event_value', '2');
                     $row->setColumn('sum_daily_nb_uniq_visitors', '2');
                     $row->setColumn('avg_event_value', '2');
                 }
             }
         }
     });
 }
Esempio n. 3
0
 public function setUp()
 {
     parent::setUp();
     $this->api = API::getInstance();
     $this->setSuperUser();
     $this->createSite();
 }
 public function setUp()
 {
     parent::setUp();
     if (!Fixture::siteCreated($this->idSite)) {
         Fixture::createWebsite('2014-01-01 00:00:00');
     }
 }
 public function setUp()
 {
     parent::setUp();
     LogDataPurger::$selectSegmentSize = 2;
     ReportsPurger::$selectSegmentSize = 2;
     Db::$lockPrivilegeGranted = null;
     self::restoreDbTables(self::$dbData);
     $dateTime = Date::factory(self::$dateTime);
     // purging depends upon today's date, so 'older_than' parts must be dependent upon today
     $today = Date::factory('today');
     $daysSinceToday = ($today->getTimestamp() - $dateTime->getTimestamp()) / (24 * 60 * 60);
     $monthsSinceToday = 0;
     for ($date = $today; $date->toString('Y-m') != $dateTime->toString('Y-m'); $date = $date->subMonth(1)) {
         ++$monthsSinceToday;
     }
     // set default config
     $settings = array();
     $settings['delete_logs_enable'] = 1;
     // purging log data from before 2012-01-24
     $settings['delete_logs_older_than'] = 35 + $daysSinceToday;
     $settings['delete_logs_schedule_lowest_interval'] = 7;
     $settings['delete_logs_max_rows_per_query'] = 100000;
     $settings['delete_reports_enable'] = 1;
     $settings['delete_reports_older_than'] = $monthsSinceToday;
     $settings['delete_reports_keep_basic_metrics'] = 0;
     $settings['delete_reports_keep_day_reports'] = 0;
     $settings['delete_reports_keep_week_reports'] = 0;
     $settings['delete_reports_keep_month_reports'] = 0;
     $settings['delete_reports_keep_year_reports'] = 0;
     $settings['delete_reports_keep_range_reports'] = 0;
     $settings['delete_reports_keep_segment_reports'] = 0;
     PrivacyManager::savePurgeDataSettings($settings);
     $this->settings = $settings;
     $this->instance = new PrivacyManager();
 }
Esempio n. 6
0
 public function setUp()
 {
     parent::setUp();
     $this->application = new TestConsole(self::$fixture->piwikEnvironment);
     $this->application->setAutoExit(false);
     $this->applicationTester = new ApplicationTester($this->application);
 }
Esempio n. 7
0
 public function setUp()
 {
     parent::setUp();
     $_GET = array();
     $_GET['idSite'] = self::$fixture->idSite;
     $_GET['period'] = 'year';
     $_GET['date'] = 'today';
 }
 /**
  * Setup the database and create the base tables for all tests
  */
 public function setUp()
 {
     parent::setUp();
     Config::getInstance()->setTestEnvironment();
     if (!empty(self::$tableData)) {
         self::restoreDbTables(self::$tableData);
     }
 }
 public function setUp()
 {
     parent::setUp();
     // From Piwik 1.5, we hide Goals.getConversions and other get* methods via @ignore, but we
     // ensure that they still work. This hack allows the API proxy to let us generate example
     // URLs for the ignored functions
     Proxy::getInstance()->setHideIgnoredFunctions(false);
 }
Esempio n. 10
0
 public function setUp()
 {
     parent::setUp();
     if (!Fixture::siteCreated($this->idSite)) {
         Fixture::createWebsite('2010-00-00 00:00:00');
     }
     $this->dao = new RawLogDao();
 }
Esempio n. 11
0
 public function setUp()
 {
     parent::setUp();
     StaticCache::clearAll();
     PluginAwareStaticCache::clearAll();
     Translate::reloadLanguage('en');
     $this->api = API::getInstance();
 }
 public function setUp()
 {
     parent::setUp();
     $application = new Console();
     $application->setAutoExit(false);
     $this->applicationTester = new ApplicationTester($application);
     Config::unsetInstance();
 }
Esempio n. 13
0
 public function setUp()
 {
     parent::setUp();
     $this->cliMulti = new CliMulti();
     $this->authToken = Fixture::getTokenAuth();
     $this->urls = array('getAnswerToLife' => $this->completeUrl('?module=API&method=ExampleAPI.getAnswerToLife&format=JSON'), 'getPiwikVersion' => $this->completeUrl('?module=API&method=API.getPiwikVersion&format=JSON'));
     $this->responses = array('getAnswerToLife' => '{"value":42}', 'getPiwikVersion' => '{"value":"' . Version::VERSION . '"}');
     \Piwik\Common::$isCliMode = true;
 }
 public function setUp()
 {
     parent::setUp();
     $testingEnvironment = new \Piwik\Tests\Framework\TestingEnvironmentVariables();
     $testingEnvironment->configFileGlobal = null;
     $testingEnvironment->configFileLocal = null;
     $testingEnvironment->configFileCommon = null;
     $testingEnvironment->loadRealTranslations = true;
     $testingEnvironment->save();
 }
Esempio n. 15
0
 public function setUp()
 {
     parent::setUp();
     $idSite = 1;
     $dateTime = '2014-01-01 00:00:01';
     if (!Fixture::siteCreated($idSite)) {
         Fixture::createWebsite($dateTime);
     }
     $this->tracker = Fixture::getTracker($idSite, $dateTime, $defaultInit = true);
 }
Esempio n. 16
0
 /**
  * Setup the database and create the base tables for all tests
  */
 public function setUp()
 {
     parent::setUp();
     static::$fixture->extraDefinitions = array_merge(static::provideContainerConfigBeforeClass(), $this->provideContainerConfig());
     static::$fixture->createEnvironmentInstance();
     Db::createDatabaseObject();
     Fixture::loadAllPlugins(new TestingEnvironmentVariables(), get_class($this), self::$fixture->extraPluginsToLoad);
     Access::getInstance()->setSuperUserAccess(true);
     if (!empty(self::$tableData)) {
         self::restoreDbTables(self::$tableData);
     }
     PiwikCache::getEagerCache()->flushAll();
     PiwikCache::getTransientCache()->flushAll();
     MenuAbstract::clearMenus();
 }
 public function setUp()
 {
     parent::setUp();
     if (!IntegrationTestCase::isRedisAvailable()) {
         $this->markTestSkipped('Redis extension is not installed, skipping test');
     }
     if (self::isTravisCI() && self::isPhpVersion53()) {
         $this->markTestSkipped('Redis seems to be not enabled in nginx on Travis + PHP 5.3.3');
     }
     self::$fixture->performSetup();
     $idSite = 1;
     $dateTime = '2014-01-01 00:00:01';
     if (!Fixture::siteCreated($idSite)) {
         Fixture::createWebsite($dateTime);
     }
     $queuedTracking = new QueuedTracking();
     $this->tracker = Fixture::getTracker($idSite, $dateTime, $defaultInit = true);
     $this->enableQueue();
 }
Esempio n. 18
0
 public function setUp()
 {
     parent::setUp();
     $this->resetTestingEnvironmentChanges();
 }
Esempio n. 19
0
 public function setUp()
 {
     Cache::getTransientCache()->flushAll();
     parent::setUp();
 }
Esempio n. 20
0
 public function setUp()
 {
     parent::setUp();
     $this->model = new Model();
 }