Skip to content

Commit 37ece4e

Browse files
committed
fix: Add makeLocaleDirectory()
1 parent 168c5af commit 37ece4e

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

‎tests/system/Commands/Translation/LocalizationFinderTest.php‎

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,58 +45,70 @@ protected function tearDown(): void
4545

4646
public function testUpdateDefaultLocale(): void
4747
{
48-
@mkdir(self::$languageTestPath . self::$locale, 0777, true);
48+
$this->makeLocaleDirectory();
49+
4950
Services::commands()->run('lang:find', [
5051
'dir' => 'Translation',
5152
]);
53+
5254
$this->realizeAssertion();
5355
}
5456

5557
public function testUpdateWithLocaleOption(): void
5658
{
5759
self::$locale = config(App::class)->supportedLocales[0];
58-
@mkdir(self::$languageTestPath . self::$locale, 0777, true);
60+
$this->makeLocaleDirectory();
61+
5962
Services::commands()->run('lang:find', [
6063
'dir' => 'Translation',
6164
'locale' => self::$locale,
6265
]);
66+
6367
$this->realizeAssertion();
6468
}
6569

6670
public function testUpdateWithIncorrectLocaleOption(): void
6771
{
6872
self::$locale = 'test_locale_incorrect';
69-
@mkdir(self::$languageTestPath . self::$locale, 0777, true);
73+
$this->makeLocaleDirectory();
74+
7075
$status = Services::commands()->run('lang:find', [
7176
'dir' => 'Translation',
7277
'locale' => self::$locale,
7378
]);
79+
7480
$this->assertSame($status, -1);
7581
}
7682

7783
public function testUpdateWithEmptyDirOption(): void
7884
{
79-
@mkdir(self::$languageTestPath . self::$locale, 0777, true);
85+
$this->makeLocaleDirectory();
86+
8087
Services::commands()->run('lang:find', []);
88+
8189
$this->realizeAssertion();
8290
}
8391

8492
public function testUpdateWithIncorrectDirOption(): void
8593
{
86-
@mkdir(self::$languageTestPath . self::$locale, 0777, true);
94+
$this->makeLocaleDirectory();
95+
8796
$status = Services::commands()->run('lang:find', [
8897
'dir' => 'Translation/NotExistFolder',
8998
]);
99+
90100
$this->assertSame($status, -1);
91101
}
92102

93103
public function testShowNewTranslation(): void
94104
{
95-
@mkdir(self::$languageTestPath . self::$locale, 0777, true);
105+
$this->makeLocaleDirectory();
106+
96107
Services::commands()->run('lang:find', [
97108
'dir' => 'Translation',
98109
'show-new' => null,
99110
]);
111+
100112
$this->assertStringContainsString($this->getActualTableWithNewKeys(), $this->getStreamFilterBuffer());
101113
}
102114

@@ -205,6 +217,11 @@ private function realizeAssertion(): void
205217
$this->assertSame($translationFourKeys, $this->getActualTranslationFourKeys());
206218
}
207219

220+
private function makeLocaleDirectory(): void
221+
{
222+
@mkdir(self::$languageTestPath . self::$locale, 0777, true);
223+
}
224+
208225
private function clearGeneratedFiles(): void
209226
{
210227
if (is_file(self::$languageTestPath . self::$locale . '/TranslationOne.php')) {

0 commit comments

Comments
 (0)