Example #1
0
 public function testDumpWithCustomEncoding()
 {
     $catalogue = new MessageCatalogue('en');
     $catalogue->add(array('foo' => '"bar"'));
     $dumper = new JsonFileDumper();
     $this->assertStringEqualsFile(__DIR__ . '/../fixtures/resources.dump.json', $dumper->formatCatalogue($catalogue, 'messages', array('json_encoding' => JSON_HEX_QUOT)));
 }
 public function testDumpWithCustomEncoding()
 {
     $catalogue = new MessageCatalogue('en');
     $catalogue->add(array('foo' => '"bar"'));
     $dumper = new JsonFileDumper();
     $dumper->dump($catalogue, array('path' => $this->tempDir, 'json_encoding' => JSON_HEX_QUOT));
     $this->assertEquals(file_get_contents(__DIR__ . '/../fixtures/resources.dump.json'), file_get_contents($this->tempDir . '/messages.en.json'));
 }
Example #3
0
 public function testDump()
 {
     $catalogue = new MessageCatalogue('en');
     $catalogue->add(array('foo' => 'bar'));
     $tempDir = sys_get_temp_dir();
     $dumper = new JsonFileDumper();
     $dumper->dump($catalogue, array('path' => $tempDir));
     $this->assertEquals(file_get_contents(__DIR__ . '/../fixtures/resources.json'), file_get_contents($tempDir . '/messages.en.json'));
     unlink($tempDir . '/messages.en.json');
 }
Example #4
0
 public function testDump()
 {
     if (PHP_VERSION_ID < 50400) {
         $this->markTestIncomplete('PHP below 5.4 doesn\'t support JSON pretty printing');
     }
     $catalogue = new MessageCatalogue('en');
     $catalogue->add(array('foo' => 'bar'));
     $tempDir = sys_get_temp_dir();
     $dumper = new JsonFileDumper();
     $dumper->dump($catalogue, array('path' => $tempDir));
     $this->assertEquals(file_get_contents(__DIR__ . '/../fixtures/resources.json'), file_get_contents($tempDir . '/messages.en.json'));
     unlink($tempDir . '/messages.en.json');
 }