Ejemplo n.º 1
0
 public function setUp()
 {
     $this->_backup['catalogConfig'] = Catalog::config();
     Catalog::reset();
     $this->command = new Extract(array('request' => new Request(array('input' => fopen('php://temp', 'w+'))), 'classes' => array('response' => 'lithium\\tests\\mocks\\console\\MockResponse')));
     mkdir($this->command->source = "{$this->_path}/source");
     mkdir($this->command->destination = "{$this->_path}/destination");
 }
Ejemplo n.º 2
0
 public function testTranslateFail()
 {
     $result = Message::translate('catalog', array('locale' => 'de'));
     $this->assertNull($result);
     Catalog::reset();
     Catalog::config(array('runtime' => array('adapter' => new Memory())));
     $data = array('catalog' => 'Katalog');
     Catalog::write('message', 'de', $data, array('name' => 'runtime'));
     $result = Message::translate('catalog', array('locale' => 'de'));
     $this->assertNull($result);
     $data = 'not a valid pluralization function';
     Catalog::write('message.plural', 'root', $data, array('name' => 'runtime'));
     $result = Message::translate('catalog', array('locale' => 'de'));
     $this->assertNull($result);
 }
 public function tearDown()
 {
     Catalog::reset();
     Catalog::config($this->_backups['catalogConfig']);
 }
Ejemplo n.º 4
0
 /**
  * Tests reading from multiple configured stores with fallbacks.
  *
  * @return void
  */
 public function testWriteReadMergeConfigurations()
 {
     Catalog::reset();
     Catalog::config(array('runtime0' => array('adapter' => new Memory()), 'runtime1' => array('adapter' => new Memory())));
     $data = '/postalCode en0/';
     Catalog::write('validation.postalCode', 'en', $data, array('name' => 'runtime0'));
     $data = '/postalCode en_US1/';
     Catalog::write('validation.postalCode', 'en_US', $data, array('name' => 'runtime1'));
     $data = '/postalCode en1/';
     Catalog::write('validation.postalCode', 'en', $data, array('name' => 'runtime1'));
     $result = Catalog::read('validation.postalCode', 'en_US');
     $expected = '/postalCode en_US1/';
     $this->assertEqual($expected, $result);
     Catalog::reset();
     Catalog::config(array('runtime0' => array('adapter' => new Memory()), 'runtime1' => array('adapter' => new Memory())));
     $data = array('GRD' => 'de0 Griechische Drachme', 'DKK' => 'de0 Dänische Krone');
     Catalog::write('currency', 'de', $data, array('name' => 'runtime0'));
     $data = array('GRD' => 'de1 Griechische Drachme');
     Catalog::write('currency', 'de', $data, array('name' => 'runtime1'));
     $data = array('GRD' => 'de_CH1 Griechische Drachme');
     Catalog::write('currency', 'de_CH', $data, array('name' => 'runtime1'));
     $result = Catalog::read('currency', 'de_CH');
     $expected = array('GRD' => 'de_CH1 Griechische Drachme', 'DKK' => 'de0 Dänische Krone');
     $this->assertEqual($expected, $result);
 }
Ejemplo n.º 5
0
 public function testInvalidWrite()
 {
     Catalog::reset();
     $this->assertException("Configuration `runtime` has not been defined.", function () {
         $data = array('house' => array('id' => 'house'));
         Catalog::write('runtime', 'message', 'de', $data);
     });
 }
Ejemplo n.º 6
0
 public function testInvalidWrite()
 {
     Catalog::reset();
     $data = array('house' => array('id' => 'house'));
     $this->expectException("Configuration 'runtime' has not been defined.");
     $this->assertFalse(Catalog::write('runtime', 'message', 'de', $data));
 }