Esempio n. 1
0
 public function testOptions()
 {
     $adapter = new Adapter\ArrayAdapter(dirname(__FILE__) . '/_files/translation_en.php', 'en');
     $adapter->setOptions(array('testoption' => 'testkey'));
     $this->assertEquals(array('testoption' => 'testkey', 'clear' => false, 'scan' => null, 'locale' => 'en', 'ignore' => '.', 'disableNotices' => false, 'log' => false, 'logMessage' => 'Untranslated message within \'%locale%\': %message%', 'logUntranslated' => false, 'reload' => false), $adapter->getOptions());
     $this->assertEquals('testkey', $adapter->getOptions('testoption'));
     $this->assertTrue(is_null($adapter->getOptions('nooption')));
 }
Esempio n. 2
0
    public function testOptions()
    {
        $adapter = new Adapter\ArrayAdapter(__DIR__ . '/_files/translation_en.php', 'en');
        $adapter->setOptions(array('testoption' => 'testkey'));
        $expected = array(
            'testoption'      => 'testkey',
            'clear'           => false,
            'content'         => __DIR__ . '/_files/translation_en.php',
            'scan'            => null,
            'locale'          => 'en',
            'ignore'          => '.',
            'disableNotices'  => false,
            'log'             => false,
            'logMessage'      => 'Untranslated message within \'%locale%\': %message%',
            'logUntranslated' => false,
            'reload'          => false,
        );

        $options = $adapter->getOptions();

        foreach ($expected as $key => $value) {
            $this->assertArrayHasKey($key, $options);
            $this->assertEquals($value, $options[$key]);
        }

        $this->assertEquals('testkey', $adapter->getOptions('testoption'));
        $this->assertTrue(is_null($adapter->getOptions('nooption')));
    }