Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
TranslationTest.php
Go to the documentation of this file.
1 <?php
7 
14 
18 class TranslationTest extends \PHPUnit\Framework\TestCase
19 {
23  private $source;
24 
28  private $configType;
29 
30  public function setUp()
31  {
32  $this->source = $this->getMockBuilder(ConfigSourceInterface::class)
33  ->getMockForAbstractClass();
34  $this->configType = new Translation($this->source);
35  }
36 
37  public function testGet()
38  {
39  $path = 'en_US/default';
40  $data = [
41  'en_US' => [
42  'default' => [
43  'hello' => 'bonjour'
44  ]
45  ]
46  ];
47 
48  $this->source->expects($this->once())
49  ->method('get')
50  ->with()
51  ->willReturn($data);
52 
53  $this->assertEquals(['hello' => 'bonjour'], $this->configType->get($path));
54  }
55 }