From de624dc8ce63ec819c61216d9d44f828841c293e Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Fri, 5 Sep 2025 16:57:34 -0400 Subject: Add new file in i18n (#7917) When manipulating I18N files, it is now possible to add a new file to all languages. This action is available both in the manipulation script and the makefile. --- tests/cli/i18n/I18nDataTest.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests') diff --git a/tests/cli/i18n/I18nDataTest.php b/tests/cli/i18n/I18nDataTest.php index 1f9e257fc..2336026eb 100644 --- a/tests/cli/i18n/I18nDataTest.php +++ b/tests/cli/i18n/I18nDataTest.php @@ -485,6 +485,30 @@ class I18nDataTest extends PHPUnit\Framework\TestCase { self::assertSame($frValue, $enValue); } + public function testAddFileWhenNotPhpFile(): void { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('The selected file name is not supported.'); + + $data = new I18nData($this->referenceData); + $data->addFile('file2'); + } + + public function testAddFileWhenAlreadyExists(): void { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('The selected file exists already.'); + + $data = new I18nData($this->referenceData); + self::assertTrue($data->exists('file2.php')); + $data->addFile('file2.php'); + } + + public function testAddFileWhenNotExists(): void { + $data = new I18nData($this->referenceData); + self::assertFalse($data->exists('newfile.php')); + $data->addFile('newfile.php'); + self::assertTrue($data->exists('newfile.php')); + } + public function testAddValueWhenLanguageDoesNotExist(): void { $this->expectException(\Exception::class); $this->expectExceptionMessage('The selected language does not exist.'); -- cgit v1.2.3