Completed
Push — master ( 94e5a3...90d1e4 )
by Aimeos
06:12
created

Typo3Test::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 1
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2016
6
 */
7
8
9
namespace Aimeos\MShop\Customer\Item;
10
11
12
class Typo3Test extends \PHPUnit_Framework_TestCase
13
{
14
	private $object;
15
16
17
	protected function setUp()
18
	{
19
		$addressValues = array(
20
			'customer.address.parentid' => 'referenceid',
21
			'customer.address.position' => 1,
22
		);
23
24
		$address = new \Aimeos\MShop\Common\Item\Address\Standard( 'common.address.', $addressValues );
25
26
		$values = array(
27
			'customer.id' => 541,
28
			'customer.siteid' => 123,
29
			'customer.label' => 'unitObject',
30
			'customer.code' => '12345ABCDEF',
31
			'customer.birthday' => '2010-01-01',
32
			'customer.status' => 1,
33
			'customer.password' => '',
34
			'customer.vdate' => null,
35
			'customer.company' => 'unitCompany',
36
			'customer.vatid' => 'DE999999999',
37
			'customer.salutation' => \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR,
38
			'customer.title' => 'Dr.',
39
			'customer.firstname' => 'firstunit',
40
			'customer.lastname' => 'lastunit',
41
			'customer.address1' => 'unit str.',
42
			'customer.address2' => ' 166',
43
			'customer.address3' => '4.OG',
44
			'customer.postal' => '22769',
45
			'customer.city' => 'Hamburg',
46
			'customer.state' => 'Hamburg',
47
			'customer.countryid' => 'de',
48
			'customer.languageid' => 'de',
49
			'customer.telephone' => '05554433221',
50
			'customer.email' => '[email protected]',
51
			'customer.telefax' => '05554433222',
52
			'customer.website' => 'www.example.com',
53
			'customer.mtime'=> '2010-01-05 00:00:05',
54
			'customer.ctime'=> '2010-01-01 00:00:00',
55
			'customer.editor' => 'unitTestUser',
56
			'typo3.pageid' => 99,
57
		);
58
59
		$this->object = new \Aimeos\MShop\Customer\Item\Typo3( $address, $values );
60
	}
61
62
63
	protected function tearDown()
64
	{
65
		unset( $this->object );
66
	}
67
68
69
	public function testGetPageId()
70
	{
71
		$this->assertEquals( 99, $this->object->getPageId() );
72
	}
73
74
75
	public function testSetPageId()
76
	{
77
		$this->object->setPageId( 321 );
78
		$this->assertTrue( $this->object->isModified() );
79
		$this->assertEquals( 321, $this->object->getPageId() );
80
	}
81
82
83
	public function testFromArray()
84
	{
85
		$address = new \Aimeos\MShop\Common\Item\Address\Standard( 'common.address.' );
86
		$item = new \Aimeos\MShop\Customer\Item\Typo3( $address );
87
88
		$list = array(
89
			'typo3.pageid' => 99,
90
		);
91
92
		$unknown = $item->fromArray( $list );
93
94
		$this->assertEquals( array(), $unknown );
95
		$this->assertEquals( $list['typo3.pageid'], $item->getPageId() );
96
	}
97
98
99
	public function testToArray()
100
	{
101
		$arrayObject = $this->object->toArray();
102
103
		$this->assertEquals( $this->object->getPageId(), $arrayObject['typo3.pageid'] );
104
	}
105
}
106