Пример #1
0
 public function setUp()
 {
     parent::setUp();
     PiwikCache::flushAll();
     Translate::loadAllTranslations();
     $this->api = API::getInstance();
 }
Пример #2
0
 /**
  * Called on Core install, update, plugin enable/disable
  * Will clear all cache that could be affected by the change in configuration being made
  */
 public static function deleteAllCacheOnUpdate($pluginName = false)
 {
     AssetManager::getInstance()->removeMergedAssets($pluginName);
     View::clearCompiledTemplates();
     TrackerCache::deleteTrackerCache();
     PiwikCache::flushAll();
     self::clearPhpCaches();
 }
 public function setUp()
 {
     parent::setUp();
     // make sure templates will be found
     Plugin\Manager::getInstance()->loadPlugin('CustomAlerts');
     Plugin\Manager::getInstance()->loadPlugin('Morpheus');
     if (class_exists('\\Piwik\\Cache\\PluginAwareStaticCache')) {
         \Piwik\Cache\PluginAwareStaticCache::clearAll();
         // TODO remove this one
     } else {
         PiwikCache::flushAll();
     }
     Translate::loadAllTranslations();
     $this->controller = new CustomController();
 }
Пример #4
0
 public function test_flushAll_shouldActuallyFlushAllCaches()
 {
     $cache1 = Cache::getTransientCache();
     $cache2 = Cache::getLazyCache();
     $cache3 = Cache::getEagerCache();
     $cache1->save('test1', 'content');
     $cache2->save('test2', 'content');
     $cache3->save('test3', 'content');
     $this->assertTrue($cache1->contains('test1'));
     $this->assertTrue($cache2->contains('test2'));
     $this->assertTrue($cache3->contains('test3'));
     Cache::flushAll();
     $this->assertFalse($cache1->contains('test1'));
     $this->assertFalse($cache2->contains('test2'));
     $this->assertFalse($cache3->contains('test3'));
 }
 public function tearDown()
 {
     parent::tearDown();
     Cache::flushAll();
 }
Пример #6
0
 /**
  * check all english translations do not contain more than one
  *
  * @group Plugins
  * @group numbered
  */
 function testTranslationsUseNumberedPlaceholders()
 {
     Cache::flushAll();
     $translator = StaticContainer::get('Piwik\\Translation\\Translator');
     $translator->reset();
     Translate::loadAllTranslations();
     $translations = $translator->getAllTranslations();
     foreach ($translations as $plugin => $pluginTranslations) {
         foreach ($pluginTranslations as $key => $pluginTranslation) {
             $this->assertLessThanOrEqual(1, substr_count($pluginTranslation, '%s'), sprintf('%s.%s must use numbered placeholders instead of multiple %%s', $plugin, $key));
         }
     }
 }