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

testContextsWithOtherParams() public method

    public function testContextsWithOtherParams()
    {
        $file = "{$this->_path}/source/a.html.php";
        $data = <<<EOD
<?=\$t('Ball', array('context' => 'Social gathering', 'foo' => 'bar')); ?>
<?=\$t('Ball', array('foo' => 123, 'bar' => baz(), 'context' => 'Spherical object')); ?>
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);
        $expected = '/.*Yielded 2 item.*/';
        $result = $this->command->response->output;
        $this->assertPattern($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 "Social gathering"';
        $expected .= "\n";
        $expected .= 'msgid "Ball"#';
        $this->assertPattern($expected, $result);
        $expected = '#/tmp/tests/source(/|\\\\)a.html.php:2';
        $expected .= "\n";
        $expected .= 'msgctxt "Spherical object"';
        $expected .= "\n";
        $expected .= 'msgid "Ball"#';
        $this->assertPattern($expected, $result);
        $result = $this->command->response->error;
        $this->assertEmpty($result);
    }