Contao\CoreBundle\Test\Config\Loader\XliffFileLoaderTest::testLoadIntoString PHP Method

testLoadIntoString() public method

Tests loading a file into a string.
public testLoadIntoString ( )
    public function testLoadIntoString()
    {
        $loader = new XliffFileLoader($this->getRootDir() . '/app', false);
        $source = <<<'TXT'

// vendor/contao/test-bundle/Resources/contao/languages/en/default.xlf
$GLOBALS['TL_LANG']['MSC']['first'] = 'This is the first source';
$GLOBALS['TL_LANG']['MSC']['second'][0] = 'This is the second source';
$GLOBALS['TL_LANG']['MSC']['third']['with'][1] = 'This is the third source';
$GLOBALS['TL_LANG']['tl_layout']['responsive.css'][1] = 'This is the fourth source';
$GLOBALS['TL_LANG']['MSC']['fifth'] = "This is the\nfifth source";

TXT;
        $target = <<<'TXT'

// vendor/contao/test-bundle/Resources/contao/languages/en/default.xlf
$GLOBALS['TL_LANG']['MSC']['first'] = 'This is the first target';
$GLOBALS['TL_LANG']['MSC']['second'][0] = 'This is the second target';
$GLOBALS['TL_LANG']['MSC']['third']['with'][1] = 'This is the third target';
$GLOBALS['TL_LANG']['tl_layout']['responsive.css'][1] = 'This is the fourth target';
$GLOBALS['TL_LANG']['MSC']['fifth'] = "This is the\nfifth target";

TXT;
        $this->assertEquals($source, $loader->load($this->getRootDir() . '/vendor/contao/test-bundle/Resources/contao/languages/en/default.xlf', 'en'));
        $this->assertEquals($target, $loader->load($this->getRootDir() . '/vendor/contao/test-bundle/Resources/contao/languages/en/default.xlf', 'de'));
    }