コード例 #1
0
ファイル: MeasurableTest.php プロジェクト: mgou-net/piwik
 public function testGetSettingValue_shouldReturnValue_IfSettingExistsAndIsReadable()
 {
     $setting = new MeasurableSettings($this->idSite, Measurable::getTypeFor($this->idSite));
     $setting->getSetting($this->settingName)->setValue('mytest');
     $value = $this->measurable->getSettingValue($this->settingName);
     $this->assertNull($value);
     $setting->save();
     // actually save value
     $value = $this->measurable->getSettingValue($this->settingName);
     $this->assertSame('mytest', $value);
 }
コード例 #2
0
ファイル: API.php プロジェクト: CaptainSharf/SSAD_Project
 private function updateMeasurableSettings($idSite, $settings)
 {
     $idType = Site::getTypeFor($idSite);
     $measurableSettings = new MeasurableSettings($idSite, $idType);
     foreach ($measurableSettings->getSettingsForCurrentUser() as $measurableSetting) {
         $name = $measurableSetting->getName();
         if (!empty($settings[$name])) {
             $measurableSetting->setValue($settings[$name]);
         }
         // we do not clear existing settings if the value is missing.
         // There can be so many settings added by random plugins one would always clear some settings.
     }
     $measurableSettings->save();
 }
コード例 #3
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage checkUserHasAdminAccess
  */
 public function test_save_shouldCheckAdminPermissionsForThatSite()
 {
     FakeAccess::clearAccess();
     $this->settings->save();
 }