lithium\tests\cases\console\command\g11n\ExtractTest::testContextsWithAmbiguousContextTokens PHP Method

testContextsWithAmbiguousContextTokens() public method

    public function testContextsWithAmbiguousContextTokens()
    {
        $file = "{$this->_path}/source/a.html.php";
        $data = <<<EOD
<?=\$t('Ball', array('context', 'foo' => 'context', 'context' => 'Spherical object')); ?>
<?=\$t('Ball', array('foo' => \$t('context'), 'context' => 'Social gathering')); ?>
EOD;
        file_put_contents($file, $data);
        $configs = Catalog::config();
        $configKey1 = key($configs);
        next($configs);
        $configKey2 = key($configs);
        $this->_writeInput(array($configKey1, $configKey2, '', 'y'));
        $result = $this->command->run();
        $expected = 0;
        $this->assertIdentical($expected, $result);
        $file = "{$this->_path}/destination/message_default.pot";
        $this->assertFileExists($file);
        $result = file_get_contents($file);
        $expected = '#/tmp/tests/source(/|\\\\)a.html.php:1';
        $expected .= "\n";
        $expected .= 'msgctxt "Spherical object"';
        $expected .= "\n";
        $expected .= 'msgid "Ball"#';
        $this->assertPattern($expected, $result);
        $expected = '#/tmp/tests/source(/|\\\\)a.html.php:2';
        $expected .= "\n";
        $expected .= 'msgctxt "Social gathering"';
        $expected .= "\n";
        $expected .= 'msgid "Ball"#';
        $this->assertPattern($expected, $result);
        $result = $this->command->response->error;
        $this->assertEmpty($result);
    }