Skip to content

Commit db1567e

Browse files
committed
tests: Compliance with the project rules
1 parent 1026314 commit db1567e

1 file changed

Lines changed: 11 additions & 19 deletions

File tree

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

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function setUp(): void
3333
{
3434
parent::setUp();
3535
self::$locale = Locale::getDefault();
36-
self::$languageTestPath = SUPPORTPATH . 'Language/';
36+
self::$languageTestPath = SUPPORTPATH . 'Language' . DIRECTORY_SEPARATOR;
3737
}
3838

3939
protected function tearDown(): void
@@ -46,24 +46,19 @@ public function testUpdateDefaultLocale(): void
4646
{
4747
$this->makeLocaleDirectory();
4848

49-
Services::commands()->run('lang:find', [
50-
'dir' => 'Translation',
51-
]);
49+
command('lang:find --dir Translation');
5250

53-
$this->realizeAssertion();
51+
$this->assertTranslationsExistAndHaveTranslatedKeys();
5452
}
5553

5654
public function testUpdateWithLocaleOption(): void
5755
{
5856
self::$locale = config(App::class)->supportedLocales[0];
5957
$this->makeLocaleDirectory();
6058

61-
Services::commands()->run('lang:find', [
62-
'dir' => 'Translation',
63-
'locale' => self::$locale,
64-
]);
59+
command('lang:find --dir Translation --locale ' . self::$locale);
6560

66-
$this->realizeAssertion();
61+
$this->assertTranslationsExistAndHaveTranslatedKeys();
6762
}
6863

6964
public function testUpdateWithIncorrectLocaleOption(): void
@@ -76,16 +71,16 @@ public function testUpdateWithIncorrectLocaleOption(): void
7671
'locale' => self::$locale,
7772
]);
7873

79-
$this->assertSame($status, EXIT_USER_INPUT);
74+
$this->assertSame(EXIT_USER_INPUT, $status);
8075
}
8176

8277
public function testUpdateWithEmptyDirOption(): void
8378
{
8479
$this->makeLocaleDirectory();
8580

86-
Services::commands()->run('lang:find', []);
81+
command('lang:find');
8782

88-
$this->realizeAssertion();
83+
$this->assertTranslationsExistAndHaveTranslatedKeys();
8984
}
9085

9186
public function testUpdateWithIncorrectDirOption(): void
@@ -96,17 +91,14 @@ public function testUpdateWithIncorrectDirOption(): void
9691
'dir' => 'Translation/NotExistFolder',
9792
]);
9893

99-
$this->assertSame($status, EXIT_USER_INPUT);
94+
$this->assertSame(EXIT_USER_INPUT, $status);
10095
}
10196

10297
public function testShowNewTranslation(): void
10398
{
10499
$this->makeLocaleDirectory();
105100

106-
Services::commands()->run('lang:find', [
107-
'dir' => 'Translation',
108-
'show-new' => null,
109-
]);
101+
command('lang:find --dir Translation --show-new');
110102

111103
$this->assertStringContainsString($this->getActualTableWithNewKeys(), $this->getStreamFilterBuffer());
112104
}
@@ -201,7 +193,7 @@ private function getActualTableWithNewKeys(): string
201193
TEXT_WRAP;
202194
}
203195

204-
private function realizeAssertion(): void
196+
private function assertTranslationsExistAndHaveTranslatedKeys(): void
205197
{
206198
$this->assertFileExists(self::$languageTestPath . self::$locale . '/TranslationOne.php');
207199
$this->assertFileExists(self::$languageTestPath . self::$locale . '/TranslationThree.php');

0 commit comments

Comments
 (0)