8000 [11.x] Optimize `loadTranslationsFrom` function for simplicity and clarity by selcukcukur · Pull Request #54407 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

[11.x] Optimize loadTranslationsFrom function for simplicity and clarity #54407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jan 30, 2025
Prev Previous commit
Next Next commit
fix style
  • Loading branch information
selcukcukur authored Jan 29, 2025
commit ea06d3ac8980aec0ecae53c2b090c182b41625c2
8 changes: 4 additions & 4 deletions tests/Support/SupportServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,29 +165,29 @@ public function testPublishesMigrations()
public function testLoadTranslationsFromWithoutNamespace()
{
$translator = m::mock(Translator::class);
$translator->shouldReceive('addPath')->once()->with(__DIR__ . '/translations');
$translator->shouldReceive('addPath')->once()->with(__DIR__.'/translations');

$this->app->shouldReceive('afterResolving')->once()->with('translator', m::on(function ($callback) use ($translator) {
$callback($translator);
return true;
}));

$provider = new ServiceProviderForTestingOne($this->app);
$provider->loadTranslationsFrom(__DIR__ . '/translations');
$provider->loadTranslationsFrom(__DIR__.'/translations');
}

public function testLoadTranslationsFromWithNamespace()
{
$translator = m::mock(Translator::class);
$translator->shouldReceive('addNamespace')->once()->with('namespace', __DIR__ . '/translations');
$translator->shouldReceive('addNamespace')->once()->with('namespace', __DIR__.'/translations');

$this->app->shouldReceive('afterResolving')->once()->with('translator', m::on(function ($callback) use ($translator) {
$callback($translator);
return true;
}));

$provider = new ServiceProviderForTestingOne($this->app);
$provider->loadTranslationsFrom(__DIR__ . '/translations', 'namespace');
$provider->loadTranslationsFrom(__DIR__.'/translations', 'namespace');
}
}

Expand Down
0