<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Tests][1106] trunk: Add pomo tests from GlotPress</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://unit-tests.trac.wordpress.org/changeset/1106">1106</a></dd>
<dt>Author</dt> <dd>nbachiyski</dd>
<dt>Date</dt> <dd>2012-10-31 23:28:48 +0000 (Wed, 31 Oct 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add pomo tests from GlotPress</pre>

<h3>Added Paths</h3>
<ul>
<li>trunk/data/pomo/</li>
<li><a href="#trunkdatapomobad_npluralsmo">trunk/data/pomo/bad_nplurals.mo</a></li>
<li><a href="#trunkdatapomobad_npluralspo">trunk/data/pomo/bad_nplurals.po</a></li>
<li><a href="#trunkdatapomocontextmo">trunk/data/pomo/context.mo</a></li>
<li><a href="#trunkdatapomode_DE28mo">trunk/data/pomo/de_DE-2.8.mo</a></li>
<li><a href="#trunkdatapomoemptypo">trunk/data/pomo/empty.po</a></li>
<li><a href="#trunkdatapomomopot">trunk/data/pomo/mo.pot</a></li>
<li><a href="#trunkdatapomooverloadmo">trunk/data/pomo/overload.mo</a></li>
<li><a href="#trunkdatapomopluralmo">trunk/data/pomo/plural.mo</a></li>
<li><a href="#trunkdatapomosimplemo">trunk/data/pomo/simple.mo</a></li>
<li><a href="#trunkdatapomosimplepo">trunk/data/pomo/simple.po</a></li>
<li><a href="#trunkdatapomowindowslineendingspo">trunk/data/pomo/windows-line-endings.po</a></li>
<li>trunk/tests/pomo/</li>
<li><a href="#trunktestspomotest_mophp">trunk/tests/pomo/test_mo.php</a></li>
<li><a href="#trunktestspomotest_noop_translationsphp">trunk/tests/pomo/test_noop_translations.php</a></li>
<li><a href="#trunktestspomotest_pophp">trunk/tests/pomo/test_po.php</a></li>
<li><a href="#trunktestspomotest_translation_entryphp">trunk/tests/pomo/test_translation_entry.php</a></li>
<li><a href="#trunktestspomotest_translationsphp">trunk/tests/pomo/test_translations.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdatapomobad_npluralsmo"></a>
<div class="binary"><h4>Added: trunk/data/pomo/bad_nplurals.mo</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/data/pomo/bad_nplurals.mo
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkdatapomobad_npluralspo"></a>
<div class="addfile"><h4>Added: trunk/data/pomo/bad_nplurals.po (0 => 1106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/data/pomo/bad_nplurals.po                                (rev 0)
+++ trunk/data/pomo/bad_nplurals.po        2012-10-31 23:28:48 UTC (rev 1106)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+msgid &quot;&quot;
+msgstr &quot;&quot;
+&quot;Project-Id-Version: bbPress 1.0.4 alpha\n&quot;
+&quot;POT-Creation-Date: \n&quot;
+&quot;PO-Revision-Date: 2008-12-26 17:07+0100\n&quot;
+&quot;Last-Translator: Fernando Tellado &lt;fernando.tellado@gmail.com&gt;\n&quot;
+&quot;Language-Team: ayudawordpress.com &lt;admin@ayudawordpress.com&gt;\n&quot;
+&quot;MIME-Version: 1.0\n&quot;
+&quot;Content-Type: text/plain; charset=utf-8\n&quot;
+&quot;Content-Transfer-Encoding: 8bit\n&quot;
+&quot;X-Poedit-Language: spanish\n&quot;
+&quot;X-Poedit-Country: spain\n&quot;
+&quot;Plural-Forms: nplurals=2; plural=n !=1;\\n\n&quot;
+
+msgid &quot;%d forum&quot;
+msgid_plural &quot;%d forums&quot;
+msgstr[0] &quot;%d foro&quot;
+msgstr[1] &quot;%d foros&quot;
</ins></span></pre></div>
<a id="trunkdatapomocontextmo"></a>
<div class="binary"><h4>Added: trunk/data/pomo/context.mo</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/data/pomo/context.mo
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkdatapomode_DE28mo"></a>
<div class="binary"><h4>Added: trunk/data/pomo/de_DE-2.8.mo</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/data/pomo/de_DE-2.8.mo
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkdatapomomopot"></a>
<div class="addfile"><h4>Added: trunk/data/pomo/mo.pot (0 => 1106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/data/pomo/mo.pot                                (rev 0)
+++ trunk/data/pomo/mo.pot        2012-10-31 23:28:48 UTC (rev 1106)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR WordPress
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR &lt;EMAIL@ADDRESS&gt;, YEAR.
+#
+#, fuzzy
+msgid &quot;&quot;
+msgstr &quot;&quot;
+&quot;Project-Id-Version: PACKAGE VERSION\n&quot;
+&quot;Report-Msgid-Bugs-To: wp-polyglots@lists.automattic.com\n&quot;
+&quot;POT-Creation-Date: 2009-06-28 11:07+0000\n&quot;
+&quot;PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n&quot;
+&quot;Last-Translator: FULL NAME &lt;EMAIL@ADDRESS&gt;\n&quot;
+&quot;Language-Team: LANGUAGE &lt;LL@li.org&gt;\n&quot;
+&quot;MIME-Version: 1.0\n&quot;
+&quot;Content-Type: text/plain; charset=CHARSET\n&quot;
+&quot;Content-Transfer-Encoding: 8bit\n&quot;
+
+#: wp-admin/includes/continents-cities.php:7
+msgid &quot;Africa&quot;
+msgstr &quot;&quot;
+
+#: wp-admin/includes/continents-cities.php:8
+msgid &quot;Abidjan&quot;
+msgstr &quot;&quot;
</ins></span></pre></div>
<a id="trunkdatapomooverloadmo"></a>
<div class="binary"><h4>Added: trunk/data/pomo/overload.mo</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/data/pomo/overload.mo
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkdatapomopluralmo"></a>
<div class="binary"><h4>Added: trunk/data/pomo/plural.mo</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/data/pomo/plural.mo
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkdatapomosimplemo"></a>
<div class="binary"><h4>Added: trunk/data/pomo/simple.mo</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/data/pomo/simple.mo
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkdatapomosimplepo"></a>
<div class="addfile"><h4>Added: trunk/data/pomo/simple.po (0 => 1106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/data/pomo/simple.po                                (rev 0)
+++ trunk/data/pomo/simple.po        2012-10-31 23:28:48 UTC (rev 1106)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+msgid &quot;&quot;
+msgstr &quot;&quot;
+&quot;Project-Id-Version: WordPress 2.6-bleeding\n&quot;
+&quot;Plural-Forms: nplurals=2; plural=n != 1;\n&quot;
+
+msgid &quot;moon&quot;
+msgstr &quot;&quot;
+
+msgctxt &quot;brum&quot;
+msgid &quot;strut&quot;
+msgid_plural &quot;struts&quot;
+msgstr[0] &quot;ztrut0&quot;
+msgstr[1] &quot;ztrut1&quot;
+msgstr[2] &quot;ztrut2&quot;
+
+msgid &quot;&quot;
+&quot;The first thing you need to do is tell Blogger to let WordPress access your &quot;
+&quot;account. You will be sent back here after providing authorization.&quot;
+msgstr &quot;baba\n&quot;
+&quot;dyado&quot;
+&quot;gugu&quot;
+
+msgctxt &quot;&quot;
+&quot;con&quot;
+&quot;text&quot;
+msgid &quot;&quot;
+&quot;sing&quot;
+&quot;ular&quot;
+msgid_plural &quot;&quot;
+&quot;plu&quot;
+&quot;ral&quot;
+msgstr[0] &quot;&quot;
+&quot;trans&quot;
+&quot;lation0&quot;
+msgstr[1] &quot;&quot;
+&quot;trans&quot;
+&quot;lation1&quot;
+msgstr[2] &quot;&quot;
+&quot;translation2&quot;
+
+
+
+# baba
+#: wp-admin/x.php:111 baba:333
+#. translators: buuu
+#       brubru
+#, fuzzy
+#: baba
+msgid &quot;a&quot;
+msgstr &quot;&quot;
+
+msgid &quot;a\&quot;&quot;
+msgstr &quot;&quot;
+
</ins></span></pre></div>
<a id="trunkdatapomowindowslineendingspo"></a>
<div class="addfile"><h4>Added: trunk/data/pomo/windows-line-endings.po (0 => 1106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/data/pomo/windows-line-endings.po                                (rev 0)
+++ trunk/data/pomo/windows-line-endings.po        2012-10-31 23:28:48 UTC (rev 1106)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+msgid &quot;&quot;
+msgstr &quot;&quot;
+&quot;Project-Id-Version: Windows 3.11\n&quot;
+&quot;Plural-Forms: nplurals=2; plural=n != 1;\n&quot;
+
+msgid &quot;moon&quot;
+msgstr &quot;yuhu&quot;
</ins></span></pre></div>
<a id="trunktestspomotest_mophp"></a>
<div class="addfile"><h4>Added: trunk/tests/pomo/test_mo.php (0 => 1106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/pomo/test_mo.php                                (rev 0)
+++ trunk/tests/pomo/test_mo.php        2012-10-31 23:28:48 UTC (rev 1106)
</span><span class="lines">@@ -0,0 +1,143 @@
</span><ins>+&lt;?php
+
+class WP_Test_MO extends WP_UnitTestCase {
+
+        function test_mo_simple() {
+                $mo = new MO();
+                $mo-&gt;import_from_file('data/pomo/simple.mo');
+                $this-&gt;assertEquals(array('Project-Id-Version' =&gt; 'WordPress 2.6-bleeding', 'Report-Msgid-Bugs-To' =&gt; 'wp-polyglots@lists.automattic.com'), $mo-&gt;headers);
+                $this-&gt;assertEquals(2, count($mo-&gt;entries));
+                $this-&gt;assertEquals(array('dyado'), $mo-&gt;entries['baba']-&gt;translations);
+                $this-&gt;assertEquals(array('yes'), $mo-&gt;entries[&quot;kuku\nruku&quot;]-&gt;translations);
+        }
+
+        function test_mo_plural() {
+                $mo = new MO();
+                $mo-&gt;import_from_file('data/pomo/plural.mo');
+                $this-&gt;assertEquals(1, count($mo-&gt;entries));
+                $this-&gt;assertEquals(array(&quot;oney dragoney&quot;, &quot;twoey dragoney&quot;, &quot;manyey dragoney&quot;, &quot;manyeyey dragoney&quot;, &quot;manyeyeyey dragoney&quot;), $mo-&gt;entries[&quot;one dragon&quot;]-&gt;translations);
+
+                $this-&gt;assertEquals('oney dragoney', $mo-&gt;translate_plural('one dragon', '%d dragons', 1));
+                $this-&gt;assertEquals('twoey dragoney', $mo-&gt;translate_plural('one dragon', '%d dragons', 2));
+                $this-&gt;assertEquals('twoey dragoney', $mo-&gt;translate_plural('one dragon', '%d dragons', -8));
+
+
+                $mo-&gt;set_header('Plural-Forms', 'nplurals=5; plural=0');
+                $this-&gt;assertEquals('oney dragoney', $mo-&gt;translate_plural('one dragon', '%d dragons', 1));
+                $this-&gt;assertEquals('oney dragoney', $mo-&gt;translate_plural('one dragon', '%d dragons', 2));
+                $this-&gt;assertEquals('oney dragoney', $mo-&gt;translate_plural('one dragon', '%d dragons', -8));
+
+                $mo-&gt;set_header('Plural-Forms', 'nplurals=5; plural=n%10==1 &amp;&amp; n%100!=11 ? 0 : n%10&gt;=2 &amp;&amp; n%10&lt;=4 &amp;&amp; (n%100&lt;10 || n%100&gt;=20) ? 1 : 2;');
+                $this-&gt;assertEquals('oney dragoney', $mo-&gt;translate_plural('one dragon', '%d dragons', 1));
+                $this-&gt;assertEquals('manyey dragoney', $mo-&gt;translate_plural('one dragon', '%d dragons', 11));
+                $this-&gt;assertEquals('twoey dragoney', $mo-&gt;translate_plural('one dragon', '%d dragons', 3));
+
+                $mo-&gt;set_header('Plural-Forms', 'nplurals=2; plural=n !=1;');
+                $this-&gt;assertEquals('oney dragoney', $mo-&gt;translate_plural('one dragon', '%d dragons', 1));
+                $this-&gt;assertEquals('twoey dragoney', $mo-&gt;translate_plural('one dragon', '%d dragons', 2));
+                $this-&gt;assertEquals('twoey dragoney', $mo-&gt;translate_plural('one dragon', '%d dragons', -8));
+        }
+
+        function test_mo_context() {
+                $mo = new MO();
+                $mo-&gt;import_from_file('data/pomo/context.mo');
+                $this-&gt;assertEquals(2, count($mo-&gt;entries));
+                $plural_entry = new Translation_Entry(array('singular' =&gt; 'one dragon', 'plural' =&gt; '%d dragons', 'translations' =&gt; array(&quot;oney dragoney&quot;, &quot;twoey dragoney&quot;,&quot;manyey dragoney&quot;), 'context' =&gt; 'dragonland'));
+                $this-&gt;assertEquals($plural_entry, $mo-&gt;entries[$plural_entry-&gt;key()]);
+                $this-&gt;assertEquals(&quot;dragonland&quot;, $mo-&gt;entries[$plural_entry-&gt;key()]-&gt;context);
+
+                $single_entry = new Translation_Entry(array('singular' =&gt; 'one dragon', 'translations' =&gt; array(&quot;oney dragoney&quot;), 'context' =&gt; 'not so dragon'));
+                $this-&gt;assertEquals($single_entry, $mo-&gt;entries[$single_entry-&gt;key()]);
+                $this-&gt;assertEquals(&quot;not so dragon&quot;, $mo-&gt;entries[$single_entry-&gt;key()]-&gt;context);
+
+        }
+
+        function test_translations_merge() {
+                $host = new Translations();
+                $host-&gt;add_entry(new Translation_Entry(array('singular' =&gt; 'pink',)));
+                $host-&gt;add_entry(new Translation_Entry(array('singular' =&gt; 'green',)));
+                $guest = new Translations();
+                $guest-&gt;add_entry(new Translation_Entry(array('singular' =&gt; 'green',)));
+                $guest-&gt;add_entry(new Translation_Entry(array('singular' =&gt; 'red',)));
+                $host-&gt;merge_with($guest);
+                $this-&gt;assertEquals(3, count($host-&gt;entries));
+                $this-&gt;assertEquals(array(), array_diff(array('pink', 'green', 'red'), array_keys($host-&gt;entries)));
+        }
+
+        function test_export_mo_file() {
+                $entries = array();
+                $entries[] = new Translation_Entry(array('singular' =&gt; 'pink',
+                        'translations' =&gt; array('розов')));
+                $no_translation_entry = new Translation_Entry(array('singular' =&gt; 'grey'));
+                $entries[] = new Translation_Entry(array('singular' =&gt; 'green', 'plural' =&gt; 'greens',
+                        'translations' =&gt; array('зелен', 'зелени')));
+                $entries[] = new Translation_Entry(array('singular' =&gt; 'red', 'context' =&gt; 'color',
+                        'translations' =&gt; array('червен')));
+                $entries[] = new Translation_Entry(array('singular' =&gt; 'red', 'context' =&gt; 'bull',
+                        'translations' =&gt; array('бик')));
+                $entries[] = new Translation_Entry(array('singular' =&gt; 'maroon', 'plural' =&gt; 'maroons', 'context' =&gt; 'context',
+                        'translations' =&gt; array('пурпурен', 'пурпурни')));
+
+                $mo = new MO();
+                $mo-&gt;set_header('Project-Id-Version', 'Baba Project 1.0');
+                foreach($entries as $entry) {
+                        $mo-&gt;add_entry($entry);
+                }
+                $mo-&gt;add_entry($no_translation_entry);
+
+                $temp_fn = $this-&gt;temp_filename();
+                $mo-&gt;export_to_file($temp_fn);
+
+                $again = new MO();
+                $again-&gt;import_from_file($temp_fn);
+
+                $this-&gt;assertEquals(count($entries), count($again-&gt;entries));
+                foreach($entries as $entry) {
+                        $this-&gt;assertEquals($entry, $again-&gt;entries[$entry-&gt;key()]);
+                }
+        }
+
+        function test_export_should_not_include_empty_translations() {
+                $entries = array(  );
+                $mo = new MO;
+                $mo-&gt;add_entry( array( 'singular' =&gt; 'baba', 'translations' =&gt; array( '', '' ) ) );
+
+                $temp_fn = $this-&gt;temp_filename();
+                $mo-&gt;export_to_file( $temp_fn );
+
+                $again = new MO();
+                $again-&gt;import_from_file($temp_fn);
+
+                $this-&gt;assertEquals( 0, count( $again-&gt;entries ) );
+        }
+
+        function test_nplurals_with_backslashn() {
+                $mo = new MO();
+                $mo-&gt;import_from_file('data/pomo/bad_nplurals.mo');
+                $this-&gt;assertEquals('%d foro', $mo-&gt;translate_plural('%d forum', '%d forums', 1));
+                $this-&gt;assertEquals('%d foros', $mo-&gt;translate_plural('%d forum', '%d forums', 2));
+                $this-&gt;assertEquals('%d foros', $mo-&gt;translate_plural('%d forum', '%d forums', -1));
+        }
+
+        function disabled_test_performance() {
+                $start = microtime(true);
+                $mo = new MO();
+                $mo-&gt;import_from_file('data/pomo/de_DE-2.8.mo');
+                // echo &quot;\nPerformance: &quot;.(microtime(true) - $start).&quot;\n&quot;;
+        }
+
+        function test_overloaded_mb_functions() {
+                // skipIf() method skips the whole test case, not only this method
+                // that's why we are skipping it the stupid way
+                if ((ini_get(&quot;mbstring.func_overload&quot;) &amp; 2) != 0) {
+                        $mo = new MO();
+                        $mo-&gt;import_from_file('data/pomo/overload.mo');
+                        $this-&gt;assertEquals(array('Табло'), $mo-&gt;entries['Dashboard']-&gt;translations);
+                }
+        }
+
+        function test_load_pot_file() {
+                $mo = new MO();
+                $this-&gt;assertEquals( false, $mo-&gt;import_from_file('data/pomo/mo.pot') );
+        }
+}
</ins></span></pre></div>
<a id="trunktestspomotest_noop_translationsphp"></a>
<div class="addfile"><h4>Added: trunk/tests/pomo/test_noop_translations.php (0 => 1106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/pomo/test_noop_translations.php                                (rev 0)
+++ trunk/tests/pomo/test_noop_translations.php        2012-10-31 23:28:48 UTC (rev 1106)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+&lt;?php
+
+class WP_Test_NOOP_Translations extends WP_UnitTestCase {
+        function setUp() {
+                parent::setUp();
+                $this-&gt;noop = new NOOP_Translations;
+                $this-&gt;entry = new Translation_Entry( array( 'singular' =&gt; 'baba' ) );
+                $this-&gt;plural_entry = new Translation_Entry(array('singular' =&gt; 'dyado', 'plural' =&gt; 'dyados', 'translations' =&gt; array('dyadox', 'dyadoy')));
+        }
+
+        function test_get_header() {
+                $this-&gt;assertEquals( false, $this-&gt;noop-&gt;get_header( 'Content-Type' ) );
+        }
+
+        function test_add_entry() {
+                $this-&gt;noop-&gt;add_entry( $this-&gt;entry );
+                $this-&gt;assertEquals( array(), $this-&gt;noop-&gt;entries );
+        }
+
+        function test_set_header() {
+                $this-&gt;noop-&gt;set_header( 'header', 'value' );
+                $this-&gt;assertEquals( array(), $this-&gt;noop-&gt;headers );
+        }
+
+        function test_translate_entry() {
+                $this-&gt;noop-&gt;add_entry( $this-&gt;entry );
+                $this-&gt;assertEquals( false, $this-&gt;noop-&gt;translate_entry( $this-&gt;entry ) );
+        }
+
+        function test_translate() {
+                $this-&gt;noop-&gt;add_entry( $this-&gt;entry );
+                $this-&gt;assertEquals( 'baba', $this-&gt;noop-&gt;translate( 'baba' ) );
+        }
+
+        function test_plural() {
+                $this-&gt;noop-&gt;add_entry( $this-&gt;plural_entry );
+                $this-&gt;assertEquals( 'dyado', $this-&gt;noop-&gt;translate_plural( 'dyado', 'dyados', 1 ) );
+                $this-&gt;assertEquals( 'dyados', $this-&gt;noop-&gt;translate_plural( 'dyado', 'dyados', 11 ) );
+                $this-&gt;assertEquals( 'dyados', $this-&gt;noop-&gt;translate_plural( 'dyado', 'dyados', 0 ) );
+        }
+}
</ins></span></pre></div>
<a id="trunktestspomotest_pophp"></a>
<div class="addfile"><h4>Added: trunk/tests/pomo/test_po.php (0 => 1106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/pomo/test_po.php                                (rev 0)
+++ trunk/tests/pomo/test_po.php        2012-10-31 23:28:48 UTC (rev 1106)
</span><span class="lines">@@ -0,0 +1,218 @@
</span><ins>+&lt;?php
+
+class WP_Test_PO extends WP_UnitTestCase {
+        function setUp() {
+                require_once ABSPATH . '/wp-includes/pomo/po.php';
+                // not so random wordpress.pot string -- multiple lines
+                $this-&gt;mail = &quot;Your new WordPress blog has been successfully set up at:
+
+%1\$s
+
+You can log in to the administrator account with the following information:
+
+Username: %2\$s
+Password: %3\$s
+
+We hope you enjoy your new blog. Thanks!
+
+--The WordPress Team
+http://wordpress.org/
+&quot;;
+        $this-&gt;po_mail = '&quot;&quot;
+&quot;Your new WordPress blog has been successfully set up at:\n&quot;
+&quot;\n&quot;
+&quot;%1$s\n&quot;
+&quot;\n&quot;
+&quot;You can log in to the administrator account with the following information:\n&quot;
+&quot;\n&quot;
+&quot;Username: %2$s\n&quot;
+&quot;Password: %3$s\n&quot;
+&quot;\n&quot;
+&quot;We hope you enjoy your new blog. Thanks!\n&quot;
+&quot;\n&quot;
+&quot;--The WordPress Team\n&quot;
+&quot;http://wordpress.org/\n&quot;';
+                $this-&gt;a90 = str_repeat(&quot;a&quot;, 90);
+                $this-&gt;po_a90 = &quot;\&quot;$this-&gt;a90\&quot;&quot;;
+    }
+
+        function test_prepend_each_line() {
+                $this-&gt;assertEquals('baba_', PO::prepend_each_line('', 'baba_'));
+                $this-&gt;assertEquals('baba_dyado', PO::prepend_each_line('dyado', 'baba_'));
+                $this-&gt;assertEquals(&quot;# baba\n# dyado\n# \n&quot;, PO::prepend_each_line(&quot;baba\ndyado\n\n&quot;, '# '));
+        }
+
+        function test_poify() {
+                //simple
+                $this-&gt;assertEquals('&quot;baba&quot;', PO::poify('baba'));
+                //long word
+                $this-&gt;assertEquals($this-&gt;po_a90, PO::poify($this-&gt;a90));
+                // tab
+                $this-&gt;assertEquals('&quot;ba\tba&quot;', PO::poify(&quot;ba\tba&quot;));
+                // do not add leading empty string of one-line string ending on a newline
+                $this-&gt;assertEquals('&quot;\\\\a\\\\n\\n&quot;', PO::poify(&quot;\a\\n\n&quot;));
+                // backslash
+                $this-&gt;assertEquals('&quot;ba\\\\ba&quot;', PO::poify('ba\\ba'));
+                // random wordpress.pot string
+                $src = 'Categories can be selectively converted to tags using the &lt;a href=&quot;%s&quot;&gt;category to tag converter&lt;/a&gt;.';
+                $this-&gt;assertEquals(&quot;\&quot;Categories can be selectively converted to tags using the &lt;a href=\\\&quot;%s\\\&quot;&gt;category to tag converter&lt;/a&gt;.\&quot;&quot;, PO::poify($src));
+
+                $this-&gt;assertEquals($this-&gt;po_mail, PO::poify($this-&gt;mail));
+        }
+
+        function test_unpoify() {
+                $this-&gt;assertEquals('baba', PO::unpoify('&quot;baba&quot;'));
+                $this-&gt;assertEquals(&quot;baba\ngugu&quot;, PO::unpoify('&quot;baba\n&quot;'.&quot;\t\t\t\n&quot;.'&quot;gugu&quot;'));
+                $this-&gt;assertEquals($this-&gt;a90, PO::unpoify($this-&gt;po_a90));
+                $this-&gt;assertEquals('\\t\\n', PO::unpoify('&quot;\\\\t\\\\n&quot;'));
+                // wordwrapped
+                $this-&gt;assertEquals('babadyado', PO::unpoify(&quot;\&quot;\&quot;\n\&quot;baba\&quot;\n\&quot;dyado\&quot;&quot;));
+                $this-&gt;assertEquals($this-&gt;mail, PO::unpoify($this-&gt;po_mail));
+        }
+
+        function test_export_entry() {
+                $entry = new Translation_Entry(array('singular' =&gt; 'baba'));
+                $this-&gt;assertEquals(&quot;msgid \&quot;baba\&quot;\nmsgstr \&quot;\&quot;&quot;, PO::export_entry($entry));
+                // plural
+                $entry = new Translation_Entry(array('singular' =&gt; 'baba', 'plural' =&gt; 'babas'));
+                $this-&gt;assertEquals('msgid &quot;baba&quot;
+msgid_plural &quot;babas&quot;
+msgstr[0] &quot;&quot;
+msgstr[1] &quot;&quot;', PO::export_entry($entry));
+                $entry = new Translation_Entry(array('singular' =&gt; 'baba', 'translator_comments' =&gt; &quot;baba\ndyado&quot;));
+                $this-&gt;assertEquals('#  baba
+#  dyado
+msgid &quot;baba&quot;
+msgstr &quot;&quot;', PO::export_entry($entry));
+                $entry = new Translation_Entry(array('singular' =&gt; 'baba', 'extracted_comments' =&gt; &quot;baba&quot;));
+                $this-&gt;assertEquals('#. baba
+msgid &quot;baba&quot;
+msgstr &quot;&quot;', PO::export_entry($entry));
+                $entry = new Translation_Entry(array(
+                        'singular' =&gt; 'baba',
+                        'extracted_comments' =&gt; &quot;baba&quot;,
+                        'references' =&gt; range(1, 29)));
+                $this-&gt;assertEquals('#. baba
+#: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
+#: 29
+msgid &quot;baba&quot;
+msgstr &quot;&quot;', PO::export_entry($entry));
+                $entry = new Translation_Entry(array('singular' =&gt; 'baba', 'translations' =&gt; array()));
+                $this-&gt;assertEquals(&quot;msgid \&quot;baba\&quot;\nmsgstr \&quot;\&quot;&quot;, PO::export_entry($entry));
+
+                $entry = new Translation_Entry(array('singular' =&gt; 'baba', 'translations' =&gt; array('куку', 'буку')));
+                $this-&gt;assertEquals(&quot;msgid \&quot;baba\&quot;\nmsgstr \&quot;куку\&quot;&quot;, PO::export_entry($entry));
+
+                $entry = new Translation_Entry(array('singular' =&gt; 'baba', 'plural' =&gt; 'babas', 'translations' =&gt; array('кукубуку')));
+                $this-&gt;assertEquals('msgid &quot;baba&quot;
+msgid_plural &quot;babas&quot;
+msgstr[0] &quot;кукубуку&quot;', PO::export_entry($entry));
+
+                $entry = new Translation_Entry(array('singular' =&gt; 'baba', 'plural' =&gt; 'babas', 'translations' =&gt; array('кукубуку', 'кукуруку', 'бабаяга')));
+                $this-&gt;assertEquals('msgid &quot;baba&quot;
+msgid_plural &quot;babas&quot;
+msgstr[0] &quot;кукубуку&quot;
+msgstr[1] &quot;кукуруку&quot;
+msgstr[2] &quot;бабаяга&quot;', PO::export_entry($entry));
+                // context
+                $entry = new Translation_Entry(array('context' =&gt; 'ctxt', 'singular' =&gt; 'baba', 'plural' =&gt; 'babas', 'translations' =&gt; array('кукубуку', 'кукуруку', 'бабаяга'), 'flags' =&gt; array('fuzzy', 'php-format')));
+                $this-&gt;assertEquals('#, fuzzy, php-format
+msgctxt &quot;ctxt&quot;
+msgid &quot;baba&quot;
+msgid_plural &quot;babas&quot;
+msgstr[0] &quot;кукубуку&quot;
+msgstr[1] &quot;кукуруку&quot;
+msgstr[2] &quot;бабаяга&quot;', PO::export_entry($entry));
+    }
+
+        function test_export_entries() {
+                $entry = new Translation_Entry(array('singular' =&gt; 'baba',));
+                $entry2 = new Translation_Entry(array('singular' =&gt; 'dyado',));
+                $po = new PO();
+                $po-&gt;add_entry($entry);
+                $po-&gt;add_entry($entry2);
+                $this-&gt;assertEquals(&quot;msgid \&quot;baba\&quot;\nmsgstr \&quot;\&quot;\n\nmsgid \&quot;dyado\&quot;\nmsgstr \&quot;\&quot;&quot;, $po-&gt;export_entries());
+        }
+
+        function test_export_headers() {
+                $po = new PO();
+                $po-&gt;set_header('Project-Id-Version', 'WordPress 2.6-bleeding');
+                $po-&gt;set_header('POT-Creation-Date', '2008-04-08 18:00+0000');
+                $this-&gt;assertEquals(&quot;msgid \&quot;\&quot;\nmsgstr \&quot;\&quot;\n\&quot;Project-Id-Version: WordPress 2.6-bleeding\\n\&quot;\n\&quot;POT-Creation-Date: 2008-04-08 18:00+0000\\n\&quot;&quot;, $po-&gt;export_headers());
+        }
+
+        function test_export() {
+                $po = new PO();
+                $entry = new Translation_Entry(array('singular' =&gt; 'baba',));
+                $entry2 = new Translation_Entry(array('singular' =&gt; 'dyado',));
+                $po-&gt;set_header('Project-Id-Version', 'WordPress 2.6-bleeding');
+                $po-&gt;set_header('POT-Creation-Date', '2008-04-08 18:00+0000');
+                $po-&gt;add_entry($entry);
+                $po-&gt;add_entry($entry2);
+                $this-&gt;assertEquals(&quot;msgid \&quot;baba\&quot;\nmsgstr \&quot;\&quot;\n\nmsgid \&quot;dyado\&quot;\nmsgstr \&quot;\&quot;&quot;, $po-&gt;export(false));
+                $this-&gt;assertEquals(&quot;msgid \&quot;\&quot;\nmsgstr \&quot;\&quot;\n\&quot;Project-Id-Version: WordPress 2.6-bleeding\\n\&quot;\n\&quot;POT-Creation-Date: 2008-04-08 18:00+0000\\n\&quot;\n\nmsgid \&quot;baba\&quot;\nmsgstr \&quot;\&quot;\n\nmsgid \&quot;dyado\&quot;\nmsgstr \&quot;\&quot;&quot;, $po-&gt;export());
+        }
+
+
+        function test_export_to_file() {
+                $po = new PO();
+                $entry = new Translation_Entry(array('singular' =&gt; 'baba',));
+                $entry2 = new Translation_Entry(array('singular' =&gt; 'dyado',));
+                $po-&gt;set_header('Project-Id-Version', 'WordPress 2.6-bleeding');
+                $po-&gt;set_header('POT-Creation-Date', '2008-04-08 18:00+0000');
+                $po-&gt;add_entry($entry);
+                $po-&gt;add_entry($entry2);
+
+                $temp_fn = $this-&gt;temp_filename();
+                $po-&gt;export_to_file($temp_fn, false);
+                $this-&gt;assertEquals($po-&gt;export(false), file_get_contents($temp_fn));
+
+                $temp_fn2 = $this-&gt;temp_filename();
+                $po-&gt;export_to_file($temp_fn2);
+                $this-&gt;assertEquals($po-&gt;export(), file_get_contents($temp_fn2));
+        }
+
+        function test_import_from_file() {
+                $po = new PO();
+                $res = $po-&gt;import_from_file('data/pomo/simple.po');
+                $this-&gt;assertEquals(true, $res);
+
+                $this-&gt;assertEquals(array('Project-Id-Version' =&gt; 'WordPress 2.6-bleeding', 'Plural-Forms' =&gt; 'nplurals=2; plural=n != 1;'), $po-&gt;headers);
+
+                $simple_entry = new Translation_Entry(array('singular' =&gt; 'moon',));
+                $this-&gt;assertEquals($simple_entry, $po-&gt;entries[$simple_entry-&gt;key()]);
+
+                $all_types_entry = new Translation_Entry(array('singular' =&gt; 'strut', 'plural' =&gt; 'struts', 'context' =&gt; 'brum',
+                        'translations' =&gt; array('ztrut0', 'ztrut1', 'ztrut2')));
+                $this-&gt;assertEquals($all_types_entry, $po-&gt;entries[$all_types_entry-&gt;key()]);
+
+                $multiple_line_entry = new Translation_Entry(array('singular' =&gt; 'The first thing you need to do is tell Blogger to let WordPress access your account. You will be sent back here after providing authorization.', 'translations' =&gt; array(&quot;baba\ndyadogugu&quot;)));
+                $this-&gt;assertEquals($multiple_line_entry, $po-&gt;entries[$multiple_line_entry-&gt;key()]);
+
+                $multiple_line_all_types_entry = new Translation_Entry(array('context' =&gt; 'context', 'singular' =&gt; 'singular',
+                        'plural' =&gt; 'plural', 'translations' =&gt; array('translation0', 'translation1', 'translation2')));
+                $this-&gt;assertEquals($multiple_line_all_types_entry, $po-&gt;entries[$multiple_line_all_types_entry-&gt;key()]);
+
+                $comments_entry = new Translation_Entry(array('singular' =&gt; 'a', 'translator_comments' =&gt; &quot;baba\nbrubru&quot;,
+                        'references' =&gt; array('wp-admin/x.php:111', 'baba:333', 'baba'), 'extracted_comments' =&gt; &quot;translators: buuu&quot;,
+                        'flags' =&gt; array('fuzzy')));
+                $this-&gt;assertEquals($comments_entry, $po-&gt;entries[$comments_entry-&gt;key()]);
+
+                $end_quote_entry = new Translation_Entry(array('singular' =&gt; 'a&quot;'));
+                $this-&gt;assertEquals($end_quote_entry, $po-&gt;entries[$end_quote_entry-&gt;key()]);
+        }
+
+        function test_import_from_entry_file_should_give_false() {
+                $po = new PO();
+                $this-&gt;assertFalse( $po-&gt;import_from_file( 'data/pomo/empty.po' ) );
+        }
+
+        function test_import_from_file_with_windows_line_endings_should_work_as_with_unix_line_endings() {
+                $po = new PO();
+                $this-&gt;assertTrue( $po-&gt;import_from_file( 'data/pomo/windows-line-endings.po' ) );
+                $this-&gt;assertEquals( 1, count( $po-&gt;entries ) );
+        }
+
+        //TODO: add tests for bad files
+}
+?&gt;
</ins></span></pre></div>
<a id="trunktestspomotest_translation_entryphp"></a>
<div class="addfile"><h4>Added: trunk/tests/pomo/test_translation_entry.php (0 => 1106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/pomo/test_translation_entry.php                                (rev 0)
+++ trunk/tests/pomo/test_translation_entry.php        2012-10-31 23:28:48 UTC (rev 1106)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;?php
+
+class WP_Test_Translation_Entry extends WP_UnitTestCase {
+
+    function test_create_entry() {
+                // no singular =&gt; empty object
+                $entry = new Translation_Entry();
+                $this-&gt;assertNull($entry-&gt;singular);
+                $this-&gt;assertNull($entry-&gt;plural);
+                $this-&gt;assertFalse($entry-&gt;is_plural);
+                // args -&gt; members
+                $entry = new Translation_Entry(array(
+                        'singular' =&gt; 'baba',
+                        'plural' =&gt; 'babas',
+                        'translations' =&gt; array('баба', 'баби'),
+                        'references' =&gt; 'should be array here',
+                        'flags' =&gt; 'baba',
+                ));
+                $this-&gt;assertEquals('baba', $entry-&gt;singular);
+                $this-&gt;assertEquals('babas', $entry-&gt;plural);
+                $this-&gt;assertTrue($entry-&gt;is_plural);
+                $this-&gt;assertEquals(array('баба', 'баби'), $entry-&gt;translations);
+                $this-&gt;assertEquals(array(), $entry-&gt;references);
+                $this-&gt;assertEquals(array(), $entry-&gt;flags);
+        }
+
+        function test_key() {
+                $entry_baba = new Translation_Entry(array('singular' =&gt; 'baba',));
+                $entry_dyado = new Translation_Entry(array('singular' =&gt; 'dyado',));
+                $entry_baba_ctxt = new Translation_Entry(array('singular' =&gt; 'baba', 'context' =&gt; 'x'));
+                $entry_baba_plural = new Translation_Entry(array('singular' =&gt; 'baba', 'plural' =&gt; 'babas'));
+                $this-&gt;assertEquals($entry_baba-&gt;key(), $entry_baba_plural-&gt;key());
+                $this-&gt;assertNotEquals($entry_baba-&gt;key(), $entry_baba_ctxt-&gt;key());
+                $this-&gt;assertNotEquals($entry_baba_plural-&gt;key(), $entry_baba_ctxt-&gt;key());
+                $this-&gt;assertNotEquals($entry_baba-&gt;key(), $entry_dyado-&gt;key());
+        }
+}
</ins></span></pre></div>
<a id="trunktestspomotest_translationsphp"></a>
<div class="addfile"><h4>Added: trunk/tests/pomo/test_translations.php (0 => 1106)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/tests/pomo/test_translations.php                                (rev 0)
+++ trunk/tests/pomo/test_translations.php        2012-10-31 23:28:48 UTC (rev 1106)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+&lt;?php
+class WP_Test_Translations extends WP_UnitTestCase {
+
+        function test_add_entry() {
+                $entry = new Translation_Entry(array('singular' =&gt; 'baba',));
+                $entry2 = new Translation_Entry(array('singular' =&gt; 'dyado',));
+                $empty = new Translation_Entry();
+                $po = new Translations();
+                $po-&gt;add_entry($entry);
+                $this-&gt;assertEquals(array($entry-&gt;key() =&gt; $entry), $po-&gt;entries);
+                // add the same entry more than once
+                // we do not need to test proper key generation here, see test_key()
+                $po-&gt;add_entry($entry);
+                $po-&gt;add_entry($entry);
+                $this-&gt;assertEquals(array($entry-&gt;key() =&gt; $entry), $po-&gt;entries);
+                $po-&gt;add_entry($entry2);
+                $this-&gt;assertEquals(array($entry-&gt;key() =&gt; $entry, $entry2-&gt;key() =&gt; $entry2), $po-&gt;entries);
+                // add empty entry
+                $this-&gt;assertEquals(false, $po-&gt;add_entry($empty));
+                $this-&gt;assertEquals(array($entry-&gt;key() =&gt; $entry, $entry2-&gt;key() =&gt; $entry2), $po-&gt;entries);
+
+                // give add_entry() the arguments and let it create the entry itself
+                $po = new Translations();
+                $po-&gt;add_entry(array('singular' =&gt; 'baba',));
+                $entries= array_values($po-&gt;entries);
+                $this-&gt;assertEquals($entry-&gt;key(), $entries[0]-&gt;key());
+        }
+
+        function test_translate() {
+                $entry1 = new Translation_Entry(array('singular' =&gt; 'baba', 'translations' =&gt; array('babax')));
+                $entry2 = new Translation_Entry(array('singular' =&gt; 'baba', 'translations' =&gt; array('babay'), 'context' =&gt; 'x'));
+                $domain = new Translations();
+                $domain-&gt;add_entry($entry1);
+                $domain-&gt;add_entry($entry2);
+                $this-&gt;assertEquals('babax', $domain-&gt;translate('baba'));
+                $this-&gt;assertEquals('babay', $domain-&gt;translate('baba', 'x'));
+                $this-&gt;assertEquals('baba', $domain-&gt;translate('baba', 'y'));
+                $this-&gt;assertEquals('babaz', $domain-&gt;translate('babaz'));
+        }
+
+        function test_translate_plural() {
+                $entry_incomplete = new Translation_Entry(array('singular' =&gt; 'baba', 'plural' =&gt; 'babas', 'translations' =&gt; array('babax')));
+                $entry_toomany = new Translation_Entry(array('singular' =&gt; 'wink', 'plural' =&gt; 'winks', 'translations' =&gt; array('winki', 'winka', 'winko')));
+                $entry_2 = new Translation_Entry(array('singular' =&gt; 'dyado', 'plural' =&gt; 'dyados', 'translations' =&gt; array('dyadox', 'dyadoy')));
+                $domain = new Translations();
+                $domain-&gt;add_entry($entry_incomplete);
+                $domain-&gt;add_entry($entry_toomany);
+                $domain-&gt;add_entry($entry_2);
+                $this-&gt;assertEquals('other', $domain-&gt;translate_plural('other', 'others', 1));
+                $this-&gt;assertEquals('others', $domain-&gt;translate_plural('other', 'others', 111));
+                // too few translations + cont logic
+                $this-&gt;assertEquals('babas', $domain-&gt;translate_plural('baba', 'babas', 2));
+                $this-&gt;assertEquals('babas', $domain-&gt;translate_plural('baba', 'babas', 0));
+                $this-&gt;assertEquals('babas', $domain-&gt;translate_plural('baba', 'babas', -1));
+                $this-&gt;assertEquals('babas', $domain-&gt;translate_plural('baba', 'babas', 999));
+                // proper
+                $this-&gt;assertEquals('dyadox', $domain-&gt;translate_plural('dyado', 'dyados', 1));
+                $this-&gt;assertEquals('dyadoy', $domain-&gt;translate_plural('dyado', 'dyados', 0));
+                $this-&gt;assertEquals('dyadoy', $domain-&gt;translate_plural('dyado', 'dyados', 18881));
+                $this-&gt;assertEquals('dyadoy', $domain-&gt;translate_plural('dyado', 'dyados', -18881));
+        }
+
+        function test_digit_and_merge() {
+                $entry_digit_1 = new Translation_Entry(array('singular' =&gt; 1, 'translations' =&gt; array('1')));
+                $entry_digit_2 = new Translation_Entry(array('singular' =&gt; 2, 'translations' =&gt; array('2')));
+                $domain = new Translations();
+                $domain-&gt;add_entry($entry_digit_1);
+                $domain-&gt;add_entry($entry_digit_2);
+                $dummy_translation = new Translations;
+                $this-&gt;assertEquals( '1', $domain-&gt;translate( '1' ) );
+                $domain-&gt;merge_with( $dummy_translation );
+                $this-&gt;assertEquals( '1', $domain-&gt;translate( '1' ) );
+        }
+
+}
</ins></span></pre>
</div>
</div>

</body>
</html>