Completed
Push — 2016.10 ( 83b84d...c5e9d5 )
by Aimeos
09:36
created

T3SalutationTest::testTranslateFemale2()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Metaways Infosystems GmbH, 2013
6
 * @copyright Aimeos (aimeos.org), 2014
7
 */
8
9
10
namespace Aimeos\MW\Criteria\Plugin;
11
12
13
/**
14
 * Test class for \Aimeos\MW\Criteria\Plugin\T3Salutation
15
 */
16
class T3SalutationTest extends \PHPUnit_Framework_TestCase
17
{
18
	private $object;
19
20
21
	/**
22
	 * Sets up the fixture. This method is called before a test is executed.
23
	 */
24
	protected function setUp()
25
	{
26
		$this->object = new \Aimeos\MW\Criteria\Plugin\T3Salutation();
27
	}
28
29
30
	/**
31
	 * Tears down the fixture. This method is called after a test is executed.
32
	 */
33
	protected function tearDown()
34
	{
35
		unset($this->object);
36
	}
37
38
39
	public function testTranslate()
40
	{
41
		$this->assertEquals( 99, $this->object->translate( \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN ) );
42
	}
43
44
45
	public function testTranslateMale()
46
	{
47
		$this->assertEquals( 0, $this->object->translate( \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR ) );
48
	}
49
50
51
	public function testTranslateFemale()
52
	{
53
		$this->assertEquals( 1, $this->object->translate( \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MRS ) );
54
	}
55
56
57
	public function testTranslateFemale2()
58
	{
59
		$this->assertEquals( 2, $this->object->translate( \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MISS ) );
60
	}
61
62
63
	public function testTranslateCompany()
64
	{
65
		$this->assertEquals( 10, $this->object->translate( \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_COMPANY ) );
66
	}
67
68
69
	public function testReverse()
70
	{
71
		$this->assertEquals( \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_UNKNOWN, $this->object->reverse( 99 ) );
72
	}
73
74
75
	public function testReverseMale()
76
	{
77
		$this->assertEquals( \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR, $this->object->reverse( 0 ) );
78
	}
79
80
81
	public function testReverseFemale()
82
	{
83
		$this->assertEquals( \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MRS, $this->object->reverse( 1 ) );
84
	}
85
86
87
	public function testReverseFemale2()
88
	{
89
		$this->assertEquals( \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MISS, $this->object->reverse( 2 ) );
90
	}
91
92
93
	public function testReverseCompany()
94
	{
95
		$this->assertEquals( \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_COMPANY, $this->object->reverse( 10 ) );
96
	}
97
}
98