4 class SettingsStackTest
extends \CiviUnitTestCase
{
6 protected function setUp() {
8 $this->useTransaction(TRUE);
11 public function tearDown() {
16 * Temporarily modify -- then restore -- settings.
18 public function testStack() {
19 $origVal = \Civi
::settings()->get('show_events');
21 $settingsStack = new \Civi\Core\
SettingsStack();
23 $settingsStack->push('show_events', 9);
24 $this->assertEquals(9, \Civi
::settings()->get('show_events'));
26 $settingsStack->push('show_events', 8);
27 $this->assertEquals(8, \Civi
::settings()->get('show_events'));
29 $settingsStack->popAll();
30 $this->assertEquals($origVal, \Civi
::settings()->get('show_events'));