Completed
Push — feature/high_five ( cf7883...85675c )
by Raúl
05:22
created

ModifyCatalogTest::testUpdateComments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 9.0856
c 0
b 0
f 0
cc 1
eloc 16
nc 1
nop 0
1
<?php
2
3
namespace Sepia\Test;
4
5
use Sepia\FileHandler;
6
use Sepia\PoParser;
7
8
class ModifyCatalogTest extends AbstractFixtureTest
9
{
10
    /**
11
     * Test update comments
12
     */
13
    public function testUpdateComments()
14
    {
15
        $fileHandler = new FileHandler($this->resourcesPath.'context.po');
16
        $parser = new PoParser($fileHandler);
17
        $entries = $parser->parse();
18
        $options = $parser->getOptions();
19
        $ctxtGlue = $options['context-glue'];
20
21
        $msgid = 'Background Attachment'.$ctxtGlue.'Attachment';
22
        $entry = $entries[$msgid];
23
24
        $entry['ccomment'] = array('Test write ccomment');
25
        $entry['tcomment'] = array('Test write tcomment');
26
27
        $parser->setEntry($msgid, $entry);
28
        $parser->writeFile($this->resourcesPath.'temp.po');
29
30
        $parser = PoParser::parseFile($this->resourcesPath.'temp.po');
31
        $entries = $parser->getEntries();
32
33
        $this->assertEquals($entries[$msgid]['tcomment'][0], $entry['tcomment'][0]);
34
        $this->assertEquals($entries[$msgid]['ccomment'][0], $entry['ccomment'][0]);
35
    }
36
}
37