forked from GlotPress/GlotPress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_noop_translations.php
41 lines (34 loc) · 1.37 KB
/
test_noop_translations.php
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
30
31
32
33
34
35
36
37
38
39
40
41
<?php
class GP_Test_NOOP_Translations extends GP_UnitTestCase {
function setUp(): void {
parent::setUp();
$this->noop = new NOOP_Translations;
$this->entry = new Translation_Entry( array( 'singular' => 'baba' ) );
$this->plural_entry = new Translation_Entry(array('singular' => 'dyado', 'plural' => 'dyados', 'translations' => array('dyadox', 'dyadoy')));
}
function test_get_header() {
$this->assertEquals( false, $this->noop->get_header( 'Content-Type' ) );
}
function test_add_entry() {
$this->noop->add_entry( $this->entry );
$this->assertEquals( array(), $this->noop->entries );
}
function test_set_header() {
$this->noop->set_header( 'header', 'value' );
$this->assertEquals( array(), $this->noop->headers );
}
function test_translate_entry() {
$this->noop->add_entry( $this->entry );
$this->assertEquals( false, $this->noop->translate_entry( $this->entry ) );
}
function test_translate() {
$this->noop->add_entry( $this->entry );
$this->assertEquals( 'baba', $this->noop->translate( 'baba' ) );
}
function test_plural() {
$this->noop->add_entry( $this->plural_entry );
$this->assertEquals( 'dyado', $this->noop->translate_plural( 'dyado', 'dyados', 1 ) );
$this->assertEquals( 'dyados', $this->noop->translate_plural( 'dyado', 'dyados', 11 ) );
$this->assertEquals( 'dyados', $this->noop->translate_plural( 'dyado', 'dyados', 0 ) );
}
}