[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/tests/phpunit/testcases/ -> test_translation_entry.php (source)

   1  <?php
   2  
   3  class GP_Test_Translation_Entry extends GP_UnitTestCase {
   4  
   5      function test_create_entry() {
   6          // no singular => empty object
   7          $entry = new Translation_Entry();
   8          $this->assertNull($entry->singular);
   9          $this->assertNull($entry->plural);
  10          $this->assertFalse($entry->is_plural);
  11          // args -> members
  12          $entry = new Translation_Entry(array(
  13              'singular' => 'baba',
  14              'plural' => 'babas',
  15              'translations' => array('баба', 'баби'),
  16              'references' => 'should be array here',
  17              'flags' => 'baba',
  18          ));
  19          $this->assertEquals('baba', $entry->singular);
  20          $this->assertEquals('babas', $entry->plural);
  21          $this->assertTrue($entry->is_plural);
  22          $this->assertEquals(array('баба', 'баби'), $entry->translations);
  23          $this->assertEquals(array(), $entry->references);
  24          $this->assertEquals(array(), $entry->flags);
  25      }
  26  
  27  	function test_key() {
  28          $entry_baba = new Translation_Entry(array('singular' => 'baba',));
  29          $entry_dyado = new Translation_Entry(array('singular' => 'dyado',));
  30          $entry_baba_ctxt = new Translation_Entry(array('singular' => 'baba', 'context' => 'x'));
  31          $entry_baba_plural = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas'));
  32          $this->assertEquals($entry_baba->key(), $entry_baba_plural->key());
  33          $this->assertNotEquals($entry_baba->key(), $entry_baba_ctxt->key());
  34          $this->assertNotEquals($entry_baba_plural->key(), $entry_baba_ctxt->key());
  35          $this->assertNotEquals($entry_baba->key(), $entry_dyado->key());
  36      }
  37  
  38  
  39  }


Generated: Sun Dec 22 01:01:04 2024 Cross-referenced by PHPXref 0.7.1