Framework: Fixed issues breaking tests

For #4903
This commit is contained in:
Dan Brown 2024-03-16 15:26:34 +00:00
parent 794671ef32
commit d6b7717985
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
2 changed files with 10 additions and 4 deletions

View File

@ -8,16 +8,22 @@ class FileLoader extends BaseLoader
{ {
/** /**
* Load the messages for the given locale. * Load the messages for the given locale.
*
* Extends Laravel's translation FileLoader to look in multiple directories * Extends Laravel's translation FileLoader to look in multiple directories
* so that we can load in translation overrides from the theme file if wanted. * so that we can load in translation overrides from the theme file if wanted.
* *
* Note: As of using Laravel 10, this may now be redundant since Laravel's
* file loader supports multiple paths. This needs further testing though
* to confirm if Laravel works how we expect, since we specifically need
* the theme folder to be able to partially override core lang files.
*
* @param string $locale * @param string $locale
* @param string $group * @param string $group
* @param string|null $namespace * @param string|null $namespace
* *
* @return array * @return array
*/ */
public function load($locale, $group, $namespace = null) public function load($locale, $group, $namespace = null): array
{ {
if ($group === '*' && $namespace === '*') { if ($group === '*' && $namespace === '*') {
return $this->loadJsonPaths($locale); return $this->loadJsonPaths($locale);
@ -25,8 +31,8 @@ class FileLoader extends BaseLoader
if (is_null($namespace) || $namespace === '*') { if (is_null($namespace) || $namespace === '*') {
$themePath = theme_path('lang'); $themePath = theme_path('lang');
$themeTranslations = $themePath ? $this->loadPath($themePath, $locale, $group) : []; $themeTranslations = $themePath ? $this->loadPaths([$themePath], $locale, $group) : [];
$originalTranslations = $this->loadPath($this->path, $locale, $group); $originalTranslations = $this->loadPaths($this->paths, $locale, $group);
return array_merge($originalTranslations, $themeTranslations); return array_merge($originalTranslations, $themeTranslations);
} }

View File

@ -95,7 +95,7 @@ class ResetPasswordTest extends TestCase
$resp = $this->followingRedirects()->post('/password/email', [ $resp = $this->followingRedirects()->post('/password/email', [
'email' => $editor->email, 'email' => $editor->email,
]); ]);
Notification::assertTimesSent(1, ResetPasswordNotification::class); Notification::assertSentTimes(ResetPasswordNotification::class, 1);
$resp->assertSee('A password reset link will be sent to ' . $editor->email . ' if that email address is found in the system.'); $resp->assertSee('A password reset link will be sent to ' . $editor->email . ' if that email address is found in the system.');
} }
} }