Пример #1
0
    public function testFormatCatalogue()
    {
        $catalogue = new MessageCatalogue('en');
        $catalogue->add(array('foo' => 'bar', 'bar' => 'foo
foo', 'foo;foo' => 'bar'));
        $dumper = new CsvFileDumper();
        $this->assertStringEqualsFile(__DIR__ . '/../fixtures/valid.csv', $dumper->formatCatalogue($catalogue, 'messages'));
    }
    public function testDump()
    {
        $catalogue = new MessageCatalogue('en');
        $catalogue->add(array('foo' => 'bar', 'bar' => 'foo
foo', 'foo;foo' => 'bar'));
        $tempDir = sys_get_temp_dir();
        $dumper = new CsvFileDumper();
        $dumper->dump($catalogue, array('path' => $tempDir));
        $this->assertEquals(file_get_contents(__DIR__ . '/../fixtures/valid.csv'), file_get_contents($tempDir . '/messages.en.csv'));
        unlink($tempDir . '/messages.en.csv');
    }