1 | <?php |
||
8 | class ReadPoTest extends AbstractFixtureTest |
||
9 | { |
||
10 | public function testFlags() |
||
11 | { |
||
12 | $catalog = $this->parseFile('multiflags.po'); |
||
13 | |||
14 | $this->assertCount(1, $catalog->getEntries()); |
||
15 | $entry = $catalog->getEntry('Attachment', 'Background Attachment'); |
||
16 | |||
17 | $this->assertNotNull($entry); |
||
18 | $this->assertCount(2, $entry->getFlags()); |
||
19 | $this->assertEquals(array('php-format', 'fuzzy'), $entry->getFlags()); |
||
20 | } |
||
21 | |||
22 | public function testTranslatorComment() |
||
23 | { |
||
24 | $this->markTestSkipped(); |
||
25 | } |
||
26 | |||
27 | public function testDeveloperComment() |
||
28 | { |
||
29 | $this->markTestSkipped(); |
||
30 | } |
||
31 | |||
32 | public function testEntriesWithContext() |
||
33 | { |
||
34 | $catalog = $this->parseFile('context.po'); |
||
35 | |||
36 | $withContext = $catalog->getEntry('1', 'start of week'); |
||
37 | $withoutContext = $catalog->getEntry('1'); |
||
38 | |||
39 | $this->assertNotNull($withContext); |
||
40 | $this->assertNotNull($withoutContext); |
||
41 | $this->assertNotEquals($withContext, $withoutContext); |
||
42 | } |
||
43 | |||
44 | public function testPreviousUntranslated() |
||
45 | { |
||
46 | $catalog = $this->parseFile('previous_unstranslated.po'); |
||
47 | |||
48 | $this->assertCount(1, $catalog->getEntries()); |
||
49 | |||
50 | $entry = new Entry('this is a string', 'this is a translation'); |
||
51 | $entry->setPreviousEntry(new Entry('this is a previous string', 'this is a previous translation string')); |
||
52 | $this->assertEquals( |
||
53 | $entry, |
||
54 | $catalog->getEntry('this is a string') |
||
55 | ); |
||
56 | } |
||
57 | |||
58 | public function testPreviousUntranslatedMultiline() |
||
59 | { |
||
60 | $this->markTestIncomplete('TODO'); |
||
61 | $catalog = $this->parseFile('previous_unstranslated.po'); |
||
|
|||
62 | } |
||
63 | |||
64 | public function testPlurals() |
||
65 | { |
||
66 | $catalog = $this->parseFile('plurals.po'); |
||
67 | |||
68 | $entry = $catalog->getEntry('%s post not updated, somebody is editing it.'); |
||
69 | $this->assertNotNull($entry); |
||
70 | $this->assertNotEmpty($entry->getMsgStrPlurals()); |
||
71 | $this->assertEquals( |
||
72 | array( |
||
73 | '%s entrada no actualizada, alguien la está editando.', |
||
74 | '%s entradas no actualizadas, alguien las está editando.', |
||
75 | ), |
||
76 | $entry->getMsgStrPlurals() |
||
77 | ); |
||
78 | } |
||
79 | |||
80 | public function testPluralsMultiline() |
||
81 | { |
||
82 | $catalog = $this->parseFile('pluralsMultiline.po'); |
||
83 | $entry = $catalog->getEntry('%s post not updated,somebody is editing it.'); |
||
84 | |||
85 | $this->assertNotNull($entry); |
||
86 | $this->assertNotEmpty($entry->getMsgStrPlurals()); |
||
87 | $this->assertEquals( |
||
88 | array( |
||
89 | '%s entrada no actualizada,alguien la está editando.', |
||
90 | '%s entradas no actualizadas,alguien las está editando.', |
||
91 | ), |
||
92 | $entry->getMsgStrPlurals() |
||
93 | ); |
||
94 | } |
||
95 | |||
96 | public function test_multiline_entries() |
||
114 | |||
115 | public function test_no_header() |
||
121 | |||
122 | public function test_no_blank_lines_separating_entries() |
||
128 | } |
||
129 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.