forked from tractorcow/silverstripe-spellcheck
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX Allow configurable default locale, or use the first defined locale
- Loading branch information
1 parent
c0bd59c
commit a3b586a
Showing
3 changed files
with
72 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace SilverStripe\Spellcheck\Tests\Handling; | ||
|
||
use SilverStripe\Core\Config\Config; | ||
use SilverStripe\Dev\SapphireTest; | ||
use SilverStripe\SpellCheck\Handling\SpellCheckMiddleware; | ||
use SilverStripe\SpellCheck\Handling\SpellController; | ||
|
||
class SpellCheckMiddlewareTest extends SapphireTest | ||
{ | ||
public function testGetDefaultLocale() | ||
{ | ||
$middleware = new SpellCheckMiddleware(); | ||
|
||
Config::modify()->set(SpellController::class, 'default_locale', 'foo'); | ||
$this->assertSame('foo', $middleware->getDefaultLocale(), 'Returns configured default'); | ||
|
||
Config::modify() | ||
->set(SpellController::class, 'default_locale', false) | ||
->set(SpellController::class, 'locales', ['foo_BAR', 'bar_BAZ']); | ||
$this->assertSame('foo_BAR', $middleware->getDefaultLocale(), 'Returns first in `locales`'); | ||
} | ||
} |