createSetting(); $setting->setValue('test'); $value = $setting->getValue(); $this->assertSame('test', $value); } public function testSetValueShouldThrowExceptionIfOnlyViewPermission() { $this->expectException(\Exception::class); $this->expectExceptionMessage('CoreAdminHome_PluginSettingChangeNotAllowed'); FakeAccess::clearAccess(); FakeAccess::setIdSitesView(array(1, 2, 3)); $this->createSetting()->setValue('test'); } public function testSetValueShouldThrowExceptionIfNoPermissionAtAll() { $this->expectException(\Exception::class); $this->expectExceptionMessage('CoreAdminHome_PluginSettingChangeNotAllowed'); FakeAccess::clearAccess(); $this->createSetting()->setValue('test'); } public function provideContainerConfig() { return array( 'Piwik\Access' => new FakeAccess(), ); } }