wordpress-develop/tests/phpunit/tests/pomo/translationEntry.php
Andrew Nacin 8045afd81b Move PHPUnit tests into a tests/phpunit directory.
wp-tests-config.php can/should reside in the root of a develop checkout. `phpunit` should be run from the root.

see #25088.


git-svn-id: https://develop.svn.wordpress.org/trunk@25165 602fd350-edb4-49c9-b593-d223f7449a82
2013-08-29 18:39:34 +00:00

38 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
class Tests_POMO_TranslationEntry extends WP_UnitTestCase {
function test_create_entry() {
// no singular => empty object
$entry = new Translation_Entry();
$this->assertNull($entry->singular);
$this->assertNull($entry->plural);
$this->assertFalse($entry->is_plural);
// args -> members
$entry = new Translation_Entry(array(
'singular' => 'baba',
'plural' => 'babas',
'translations' => array('баба', 'баби'),
'references' => 'should be array here',
'flags' => 'baba',
));
$this->assertEquals('baba', $entry->singular);
$this->assertEquals('babas', $entry->plural);
$this->assertTrue($entry->is_plural);
$this->assertEquals(array('баба', 'баби'), $entry->translations);
$this->assertEquals(array(), $entry->references);
$this->assertEquals(array(), $entry->flags);
}
function test_key() {
$entry_baba = new Translation_Entry(array('singular' => 'baba',));
$entry_dyado = new Translation_Entry(array('singular' => 'dyado',));
$entry_baba_ctxt = new Translation_Entry(array('singular' => 'baba', 'context' => 'x'));
$entry_baba_plural = new Translation_Entry(array('singular' => 'baba', 'plural' => 'babas'));
$this->assertEquals($entry_baba->key(), $entry_baba_plural->key());
$this->assertNotEquals($entry_baba->key(), $entry_baba_ctxt->key());
$this->assertNotEquals($entry_baba_plural->key(), $entry_baba_ctxt->key());
$this->assertNotEquals($entry_baba->key(), $entry_dyado->key());
}
}