mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-30 11:20:28 +00:00
Note: This will be enforced by WPCS 3.0.0. Props jrf. See #56791. git-svn-id: https://develop.svn.wordpress.org/trunk@54891 602fd350-edb4-49c9-b593-d223f7449a82
73 lines
1.7 KiB
PHP
73 lines
1.7 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @group pomo
|
|
*/
|
|
class Tests_POMO_NOOPTranslations extends WP_UnitTestCase {
|
|
|
|
/**
|
|
* NOOP translations object.
|
|
*
|
|
* @var NOOP_Translations
|
|
*/
|
|
private $noop;
|
|
|
|
/**
|
|
* Single translation entry object.
|
|
*
|
|
* @var Translation_Entry
|
|
*/
|
|
private $entry;
|
|
|
|
/**
|
|
* Multi translation entries object.
|
|
*
|
|
* @var Translation_Entry
|
|
*/
|
|
private $plural_entry;
|
|
|
|
public function set_up() {
|
|
parent::set_up();
|
|
$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' ),
|
|
)
|
|
);
|
|
}
|
|
|
|
public function test_get_header() {
|
|
$this->assertFalse( $this->noop->get_header( 'Content-Type' ) );
|
|
}
|
|
|
|
public function test_add_entry() {
|
|
$this->noop->add_entry( $this->entry );
|
|
$this->assertSame( array(), $this->noop->entries );
|
|
}
|
|
|
|
public function test_set_header() {
|
|
$this->noop->set_header( 'header', 'value' );
|
|
$this->assertSame( array(), $this->noop->headers );
|
|
}
|
|
|
|
public function test_translate_entry() {
|
|
$this->noop->add_entry( $this->entry );
|
|
$this->assertFalse( $this->noop->translate_entry( $this->entry ) );
|
|
}
|
|
|
|
public function test_translate() {
|
|
$this->noop->add_entry( $this->entry );
|
|
$this->assertSame( 'baba', $this->noop->translate( 'baba' ) );
|
|
}
|
|
|
|
public function test_plural() {
|
|
$this->noop->add_entry( $this->plural_entry );
|
|
$this->assertSame( 'dyado', $this->noop->translate_plural( 'dyado', 'dyados', 1 ) );
|
|
$this->assertSame( 'dyados', $this->noop->translate_plural( 'dyado', 'dyados', 11 ) );
|
|
$this->assertSame( 'dyados', $this->noop->translate_plural( 'dyado', 'dyados', 0 ) );
|
|
}
|
|
}
|