Skip to content

Commit

Permalink
add test for translator fallback (#23325)
Browse files Browse the repository at this point in the history
  • Loading branch information
armandsar authored and taylorotwell committed Feb 28, 2018
1 parent 806420d commit 5b2923e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/Translation/TranslationTranslatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ public function testGetMethodProperlyLoadsAndRetrievesItemWithLongestReplacement
$this->assertEquals('foo', $t->get('foo::bar.foo'));
}

public function testGetMethodProperlyLoadsAndRetrievesItemForFallback()
{
$t = new \Illuminate\Translation\Translator($this->getLoader(), 'en');
$t->setFallback('lv');
$t->getLoader()->shouldReceive('load')->once()->with('en', 'bar', 'foo')->andReturn([]);
$t->getLoader()->shouldReceive('load')->once()->with('lv', 'bar', 'foo')->andReturn(['foo' => 'foo', 'baz' => 'breeze :foo']);
$this->assertEquals('breeze bar', $t->get('foo::bar.baz', ['foo' => 'bar'], 'en'));
$this->assertEquals('foo', $t->get('foo::bar.foo'));
}

public function testGetMethodProperlyLoadsAndRetrievesItemForGlobalNamespace()
{
$t = new \Illuminate\Translation\Translator($this->getLoader(), 'en');
Expand Down

0 comments on commit 5b2923e

Please sign in to comment.