lithium\tests\cases\g11n\catalog\adapter\PhpTest::testReadWithAnonymousFunction PHP Method

testReadWithAnonymousFunction() public method

    public function testReadWithAnonymousFunction()
    {
        mkdir("{$this->_path}/fr/message", 0755, true);
        $data = <<<EOD
<?php
return array(
\t'plural' => function() { return 123; },
\t'politics' => 'politique',
);
?>
EOD;
        file_put_contents("{$this->_path}/fr/message/default.php", $data);
        $result = $this->adapter->read('message', 'fr', null);
        $expected = array('id' => 'politics', 'ids' => array(), 'translated' => 'politique', 'flags' => array(), 'comments' => array(), 'occurrences' => array());
        $this->assertEqual($expected, $result['politics']);
        $this->assertInternalType('callable', $result['plural']['translated']);
        $expected = 123;
        $result = $result['plural']['translated']();
        $this->assertEqual($expected, $result);
    }