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.
Merge pull request #36 from creative-commoners/pulls/2.0/allow-errors…
…-as-ok FIX Allow errors to be returned as OK, and default language to the first locale
- Loading branch information
Showing
5 changed files
with
106 additions
and
24 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
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`'); | ||
} | ||
} |
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