Passed
Push — master ( ba009d...b62909 )
by Aimeos
02:13
created

MemoryTest::testAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2022
6
 */
7
8
9
namespace Aimeos\Base\Translation\Decorator;
10
11
12
class MemoryTest extends \PHPUnit\Framework\TestCase
13
{
14
	private $object;
15
16
17
	protected function setUp() : void
18
	{
19
		$strings = array( 'domain' => array(
20
			'test singular' => array( 0 => 'translation singular' ),
21
			'test plural' => array(
22
				0 => 'plural translation singular',
23
				1 => 'plural translation plural',
24
				2 => 'plural translation plural (cs)',
25
			)
26
		) );
27
28
		$conf = new \Aimeos\Base\Translation\None( 'cs' );
29
		$this->object = new \Aimeos\Base\Translation\Decorator\Memory( $conf, $strings );
30
	}
31
32
33
	protected function tearDown() : void
34
	{
35
	}
36
37
38
	public function testAll()
39
	{
40
		$this->assertEquals( [], $this->object->all( 'domain' ) );
41
	}
42
43
44
	public function testDt()
45
	{
46
		$this->assertEquals( 'translation singular', $this->object->dt( 'domain', 'test singular' ) );
47
	}
48
49
50
	public function testDtNone()
51
	{
52
		$this->assertEquals( 'test none', $this->object->dt( 'domain', 'test none' ) );
53
	}
54
55
56
	public function testDn()
57
	{
58
		$translation = $this->object->dn( 'domain', 'test plural', 'test plural 2', 1 );
59
		$this->assertEquals( 'plural translation singular', $translation );
60
	}
61
62
63
	public function testDnNone()
64
	{
65
		$translation = $this->object->dn( 'domain', 'test none', 'test none plural', 0 );
66
		$this->assertEquals( 'test none plural', $translation );
67
	}
68
69
70
	public function testDnPlural()
71
	{
72
		$translation = $this->object->dn( 'domain', 'test plural', 'test plural 2', 2 );
73
		$this->assertEquals( 'plural translation plural', $translation );
74
	}
75
76
77
	public function testDnPluralCs()
78
	{
79
		$translation = $this->object->dn( 'domain', 'test plural', 'test plural 2', 5 );
80
		$this->assertEquals( 'plural translation plural (cs)', $translation );
81
	}
82
}
83