19declare(strict_types=1);
28use PHPUnit\Framework\Attributes\DataProvider;
29use PHPUnit\Framework\TestCase;
40 protected const string MODULE =
'stest';
48 protected function setUp(): void
54 $this->ilias_root = (string) realpath(__DIR__ .
'/../../../../../');
56 $this->fixture_directory = __DIR__ .
'/tmp-sync-fixtures-' . bin2hex(random_bytes(4));
57 mkdir($this->fixture_directory, 0775,
true);
58 $this->client_data_dir = sys_get_temp_dir() .
'/ilias_mlfs_test_' . bin2hex(random_bytes(4));
59 mkdir($this->client_data_dir, 0775,
true);
63 'components/ILIAS/Language/tests/ComponentTranslation/' . basename($this->fixture_directory) .
'/'
80 protected function seedShipped(array $entries,
string $lang_key =
'de',
string $module = self::MODULE): void
88 protected function seedOverlay(array $entries,
string $lang_key =
'de'): void
93 protected function shippedPo(
string $lang_key =
'de',
string $module = self::MODULE): string
95 return $this->fixture_directory .
'/' .
$module .
'_' . $lang_key .
'.po';
98 protected function overlayBase(
string $lang_key =
'de'): string
113 MigratedLanguageFileSync::sync(
129 return array_map(
static fn($entry):
string => $entry->getId(), $this->overlayPo()->getEntries());
143 return MigratedLanguageFileSync::findUnwritableOverlayDirectories(
157 return [
'admin edit (refresh = false)' => [
false],
'reconciling write (refresh = true)' => [
true]];
trait RestoresProcessState
Whatever a test does to the process (locale, LANGUAGE/LC_*, LOCPATH, the static state of the runtime ...
An in-memory gettext catalog (header block plus messages) and the only place of the component that re...
Reads the shipped .po of a migrated module and maintains its per-installation overlay: the ....
Fixtures of the MigratedLanguageFileSync tests.
sync(array $entries, bool $refresh=false, ?string $client_data_dir='default')
seedOverlay(array $entries, string $lang_key='de')
seedShipped(array $entries, string $lang_key='de', string $module=self::MODULE)
string $fixture_directory
overlayBase(string $lang_key='de')
shippedPo(string $lang_key='de', string $module=self::MODULE)
findUnwritable(array $lang_keys=['de'], ?string $client_data_dir='default', ?LanguageFileDirectoryManager $manager=null)
LanguageFileDirectoryManager $manager
LanguageFileDirectory $directory
static writePair(string $base_path, TranslationCatalog $catalog)
Writes "<base>.po" and, like MigratedLanguageFileSync::sync(), its compiled revision named by current...
static directory(string $prefix, string $path, bool $local=false)
static catalog(string $module, array $entries)
static writePo(string $file, TranslationCatalog $catalog)
static removeDirectory(string $directory)
static readPo(string $file)
static overlayBase(string $client_data_dir, LanguageFileDirectory $directory, string $lang_key)
The overlay of $directory's module for $lang_key without the .po extension.
static resetRuntime(?string $artifact_directory=null)
Forgets the static state of the runtime read path and points build and runtime at $artifact_directory...
if(!isset($arguments[0])) if(count( $arguments) > 3) if(! $remove_from_lang &&isset($arguments[2]) &&!is_dir($arguments[2])) $module
A directory of language files with a path and a prefix for them.