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

ModifyCatalogTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 1
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testUpdateComments() 0 23 1
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