@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at upstream/main 38 lines 1.5 kB view raw
1<?php 2 3final class PhabricatorLocaleScopeGuardTestCase 4 extends PhabricatorTestCase { 5 6 public function testLocaleScopeGuard() { 7 $original = PhabricatorEnv::getLocaleCode(); 8 9 // Set a guard; it should change the locale, then revert it when destroyed. 10 $guard = PhabricatorEnv::beginScopedLocale('en_GB'); 11 $this->assertEqual('en_GB', PhabricatorEnv::getLocaleCode()); 12 unset($guard); 13 $this->assertEqual($original, PhabricatorEnv::getLocaleCode()); 14 15 // Nest guards, then destroy them out of order. 16 $guard1 = PhabricatorEnv::beginScopedLocale('en_GB'); 17 $this->assertEqual('en_GB', PhabricatorEnv::getLocaleCode()); 18 $guard2 = PhabricatorEnv::beginScopedLocale('en_A*'); 19 $this->assertEqual('en_A*', PhabricatorEnv::getLocaleCode()); 20 unset($guard1); 21 $this->assertEqual('en_A*', PhabricatorEnv::getLocaleCode()); 22 unset($guard2); 23 $this->assertEqual($original, PhabricatorEnv::getLocaleCode()); 24 25 // If you push `null`, that should mean "the default locale", not 26 // "the current locale". 27 $guard3 = PhabricatorEnv::beginScopedLocale('en_GB'); 28 $this->assertEqual('en_GB', PhabricatorEnv::getLocaleCode()); 29 $guard4 = PhabricatorEnv::beginScopedLocale(null); 30 $this->assertEqual($original, PhabricatorEnv::getLocaleCode()); 31 unset($guard4); 32 $this->assertEqual('en_GB', PhabricatorEnv::getLocaleCode()); 33 unset($guard3); 34 $this->assertEqual($original, PhabricatorEnv::getLocaleCode()); 35 36 } 37 38}