Esempio n. 1
0
 /**
  * Implementation details:
  *
  * To increase speed of tests, database setup is done once in setUpBeforeClass.
  * Afterwards, the content of the tables is stored in a static class variable,
  * self::$tableData. Before each individual test, the database tables are
  * truncated and the data in self::$tableData is restored.
  *
  * If your test modifies table columns, you will need to recreate the database
  * completely. This can be accomplished by:
  *
  *     public function setUp()
  *     {
  *         self::$fixture->performSetUp();
  *     }
  *
  *     public function tearDown()
  *     {
  *         parent::tearDown();
  *         self::$fixture->performTearDown();
  *     }
  */
 public static function setUpBeforeClass()
 {
     static::configureFixture(static::$fixture);
     parent::setUpBeforeClass();
     static::beforeTableDataCached();
     self::$tableData = self::getDbTablesWithData();
 }
Esempio n. 2
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $testingEnvironment = new \Piwik\Tests\Framework\TestingEnvironmentVariables();
     $testingEnvironment->configFileLocal = PIWIK_INCLUDE_PATH . '/plugins/Installation/tests/resources/config.ini.php';
     $testingEnvironment->save();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     self::_addLogData();
     self::_addReportData();
     self::$dbData = self::getDbTablesWithData();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // add duplicates for every action
     $table = Common::prefixTable('log_action');
     foreach (Db::fetchAll("SELECT * FROM {$table}") as $row) {
         $insertSql = "INSERT INTO {$table} (name, type, hash, url_prefix)\n                               VALUES (?, ?, CRC32(?), ?)";
         Db::query($insertSql, array($row['name'], $row['type'], $row['name'], $row['url_prefix']));
     }
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $extraSite = Fixture::createWebsite(self::$fixture->dateTime, $ecommerce = 1, "the site");
     Piwik::addAction("ArchiveProcessor.Parameters.getIdSites", function (&$sites, $period) use($extraSite) {
         if (reset($sites) == $extraSite) {
             $sites = array(1, 2, 3);
         }
     });
     Config::getInstance()->General['enable_processing_unique_visitors_multiple_sites'] = 1;
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     DbHelper::createAnonymousUser();
     // the api_internal_call.php uses idSite=7, so we create 7 sites
     for ($i = 0; $i != 7; ++$i) {
         Fixture::createWebsite("2011-01-01 00:00:00", $ecommerce = 1, $siteName = "Site #{$i}");
     }
     // the script uses anonymous token auth, so give the anonymous user access
     \Piwik\Plugins\UsersManager\API::getInstance()->setUserAccess('anonymous', 'view', array(7));
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // note: not sure why I have to manually install plugin
     \Piwik\Plugin\Manager::getInstance()->loadPlugin('CustomAlerts')->install();
     $result = Fixture::updateDatabase();
     if ($result === false) {
         throw new \Exception("Failed to update pre-2.0 database (nothing to update).");
     }
     // truncate log tables so old data won't be re-archived
     foreach (array('log_visit', 'log_link_visit_action', 'log_conversion', 'log_conversion_item') as $table) {
         Db::query("TRUNCATE TABLE " . Common::prefixTable($table));
     }
     self::trackTwoVisitsOnSameDay();
     // launch archiving
     VisitFrequencyApi::getInstance()->get(1, 'year', '2012-12-29');
 }
Esempio n. 8
0
 public function setUp()
 {
     parent::setUpBeforeClass();
 }
 public static function setUpBeforeClass()
 {
     self::setUpConfigOptions();
     parent::setUpBeforeClass();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     Config::getInstance()->General['pivot_by_filter_enable_fetch_by_segment'] = 1;
 }
 public static function setUpBeforeClass()
 {
     self::$fixture->dateTime = Date::factory('yesterday')->getDateTime();
     parent::setUpBeforeClass();
 }
 public static function setUpBeforeClass()
 {
     \Piwik\Log::debug('\\IntegrationTestCase is deprecated since 2.8.0 extend \\Piwik\\Tests\\Framework\\TestCase\\SystemTestCase instead');
     parent::setUpBeforeClass();
 }