1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, https://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2015-2025 |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
|
9
|
|
|
namespace Aimeos\MShop\Customer\Item\Address; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
class StandardTest extends \PHPUnit\Framework\TestCase |
13
|
|
|
{ |
14
|
|
|
private $object; |
15
|
|
|
private $values; |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
protected function setUp() : void |
19
|
|
|
{ |
20
|
|
|
$this->values = array( |
21
|
|
|
'customer.address.id' => 23, |
22
|
|
|
'customer.address.siteid' => 12, |
23
|
|
|
'customer.address.parentid' => 'referenceid', |
24
|
|
|
'customer.address.type' => 'test', |
25
|
|
|
'customer.address.company' => 'unitCompany', |
26
|
|
|
'customer.address.vatid' => 'DE999999999', |
27
|
|
|
'customer.address.salutation' => 'mr', |
28
|
|
|
'customer.address.title' => 'Herr', |
29
|
|
|
'customer.address.firstname' => 'firstunit', |
30
|
|
|
'customer.address.lastname' => 'lastunit', |
31
|
|
|
'customer.address.address1' => 'unit str.', |
32
|
|
|
'customer.address.address2' => '166', |
33
|
|
|
'customer.address.address3' => '4.OG', |
34
|
|
|
'customer.address.postal' => '22769', |
35
|
|
|
'customer.address.city' => 'Hamburg', |
36
|
|
|
'customer.address.state' => 'Hamburg', |
37
|
|
|
'customer.address.countryid' => 'DE', |
38
|
|
|
'customer.address.languageid' => 'de', |
39
|
|
|
'customer.address.telephone' => '05554433221', |
40
|
|
|
'customer.address.telefax' => '05554433222', |
41
|
|
|
'customer.address.mobile' => '05554433223', |
42
|
|
|
'customer.address.email' => '[email protected]', |
43
|
|
|
'customer.address.website' => 'www.example.com', |
44
|
|
|
'customer.address.longitude' => '10.0', |
45
|
|
|
'customer.address.latitude' => '50.0', |
46
|
|
|
'customer.address.position' => 1, |
47
|
|
|
'customer.address.birthday' => '2000-01-01', |
48
|
|
|
'customer.address.mtime' => '2011-01-01 00:00:02', |
49
|
|
|
'customer.address.ctime' => '2011-01-01 00:00:01', |
50
|
|
|
'customer.address.editor' => 'unitTestUser', |
51
|
|
|
); |
52
|
|
|
|
53
|
|
|
$this->object = new \Aimeos\MShop\Customer\Item\Address\Standard( 'customer.address.', $this->values ); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
|
57
|
|
|
protected function tearDown() : void |
58
|
|
|
{ |
59
|
|
|
$this->object = null; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
|
63
|
|
|
public function testGetId() |
64
|
|
|
{ |
65
|
|
|
$this->assertEquals( 23, $this->object->getId() ); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
|
69
|
|
|
public function testSetId() |
70
|
|
|
{ |
71
|
|
|
$return = $this->object->setId( null ); |
72
|
|
|
|
73
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
74
|
|
|
$this->assertTrue( $this->object->isModified() ); |
75
|
|
|
$this->assertNull( $this->object->getId() ); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
|
79
|
|
|
public function testGetParentId() |
80
|
|
|
{ |
81
|
|
|
$this->assertEquals( 'referenceid', $this->object->getParentId() ); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
|
85
|
|
|
public function testSetParentId() |
86
|
|
|
{ |
87
|
|
|
$return = $this->object->setParentId( 'unitreference' ); |
88
|
|
|
|
89
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
90
|
|
|
$this->assertEquals( 'unitreference', $this->object->getParentId() ); |
91
|
|
|
$this->assertTrue( $this->object->isModified() ); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
|
95
|
|
|
public function testGetType() |
96
|
|
|
{ |
97
|
|
|
$this->assertEquals( 'test', $this->object->getType() ); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
|
101
|
|
|
public function testSetType() |
102
|
|
|
{ |
103
|
|
|
$return = $this->object->setType( 'delivery' ); |
104
|
|
|
|
105
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
106
|
|
|
$this->assertEquals( 'delivery', $this->object->getType() ); |
107
|
|
|
$this->assertTrue( $this->object->isModified() ); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
|
111
|
|
|
public function testGetCompany() |
112
|
|
|
{ |
113
|
|
|
$this->assertEquals( 'unitCompany', $this->object->getCompany() ); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
|
117
|
|
|
public function testSetCompany() |
118
|
|
|
{ |
119
|
|
|
$return = $this->object->setCompany( 'company' ); |
120
|
|
|
|
121
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
122
|
|
|
$this->assertEquals( 'company', $this->object->getCompany() ); |
123
|
|
|
$this->assertTrue( $this->object->isModified() ); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
|
127
|
|
|
public function testGetVatID() |
128
|
|
|
{ |
129
|
|
|
$this->assertEquals( 'DE999999999', $this->object->getVatID() ); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
|
133
|
|
|
public function testSetVatID() |
134
|
|
|
{ |
135
|
|
|
$return = $this->object->setVatID( 'vatid' ); |
136
|
|
|
|
137
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
138
|
|
|
$this->assertEquals( 'vatid', $this->object->getVatID() ); |
139
|
|
|
$this->assertTrue( $this->object->isModified() ); |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
|
143
|
|
|
public function testGetSalutation() |
144
|
|
|
{ |
145
|
|
|
$this->assertEquals( 'mr', $this->object->getSalutation() ); |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
|
149
|
|
|
public function testSetSalutation() |
150
|
|
|
{ |
151
|
|
|
$return = $this->object->setSalutation( 'company' ); |
152
|
|
|
|
153
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
154
|
|
|
$this->assertEquals( 'company', $this->object->getSalutation() ); |
155
|
|
|
$this->assertTrue( $this->object->isModified() ); |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
|
159
|
|
|
public function testGetTitle() |
160
|
|
|
{ |
161
|
|
|
$this->assertEquals( 'Herr', $this->object->getTitle() ); |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
|
165
|
|
|
public function testSetTitle() |
166
|
|
|
{ |
167
|
|
|
$return = $this->object->setTitle( 'Dr.' ); |
168
|
|
|
|
169
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
170
|
|
|
$this->assertEquals( 'Dr.', $this->object->getTitle() ); |
171
|
|
|
$this->assertTrue( $this->object->isModified() ); |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
|
175
|
|
|
public function testGetFirstname() |
176
|
|
|
{ |
177
|
|
|
$this->assertEquals( 'firstunit', $this->object->getFirstname() ); |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
|
181
|
|
|
public function testSetFirstname() |
182
|
|
|
{ |
183
|
|
|
$return = $this->object->setFirstname( 'hans' ); |
184
|
|
|
|
185
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
186
|
|
|
$this->assertEquals( 'hans', $this->object->getFirstname() ); |
187
|
|
|
$this->assertTrue( $this->object->isModified() ); |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
|
191
|
|
|
public function testGetLastname() |
192
|
|
|
{ |
193
|
|
|
$this->assertEquals( 'lastunit', $this->object->getLastname() ); |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
|
197
|
|
|
public function testSetLastname() |
198
|
|
|
{ |
199
|
|
|
$return = $this->object->setLastname( 'im Glueck' ); |
200
|
|
|
|
201
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
202
|
|
|
$this->assertEquals( 'im Glueck', $this->object->getLastname() ); |
203
|
|
|
$this->assertTrue( $this->object->isModified() ); |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
|
207
|
|
|
public function testGetAddress1() |
208
|
|
|
{ |
209
|
|
|
$this->assertEquals( 'unit str.', $this->object->getAddress1() ); |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
|
213
|
|
|
public function testSetAddress1() |
214
|
|
|
{ |
215
|
|
|
$return = $this->object->setAddress1( 'unitallee' ); |
216
|
|
|
|
217
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
218
|
|
|
$this->assertEquals( 'unitallee', $this->object->getAddress1() ); |
219
|
|
|
$this->assertTrue( $this->object->isModified() ); |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
|
223
|
|
|
public function testGetAddress2() |
224
|
|
|
{ |
225
|
|
|
$this->assertEquals( '166', $this->object->getAddress2() ); |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
|
229
|
|
|
public function testSetAddress2() |
230
|
|
|
{ |
231
|
|
|
$return = $this->object->setAddress2( '12' ); |
232
|
|
|
|
233
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
234
|
|
|
$this->assertEquals( '12', $this->object->getAddress2() ); |
235
|
|
|
$this->assertTrue( $this->object->isModified() ); |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
|
239
|
|
|
public function testGetAddress3() |
240
|
|
|
{ |
241
|
|
|
$this->assertEquals( '4.OG', $this->object->getAddress3() ); |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
|
245
|
|
|
public function testSetAddress3() |
246
|
|
|
{ |
247
|
|
|
$return = $this->object->setAddress3( 'EG' ); |
248
|
|
|
|
249
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
250
|
|
|
$this->assertEquals( 'EG', $this->object->getAddress3() ); |
251
|
|
|
$this->assertTrue( $this->object->isModified() ); |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
|
255
|
|
|
public function testGetPostal() |
256
|
|
|
{ |
257
|
|
|
$this->assertEquals( '22769', $this->object->getPostal() ); |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
|
261
|
|
|
public function testSetPostal() |
262
|
|
|
{ |
263
|
|
|
$return = $this->object->setPostal( '11111' ); |
264
|
|
|
|
265
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
266
|
|
|
$this->assertEquals( '11111', $this->object->getPostal() ); |
267
|
|
|
$this->assertTrue( $this->object->isModified() ); |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
|
271
|
|
|
public function testGetCity() |
272
|
|
|
{ |
273
|
|
|
$this->assertEquals( 'Hamburg', $this->object->getCity() ); |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
|
277
|
|
|
public function testSetCity() |
278
|
|
|
{ |
279
|
|
|
$return = $this->object->setCity( 'unitCity' ); |
280
|
|
|
|
281
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
282
|
|
|
$this->assertEquals( 'unitCity', $this->object->getCity() ); |
283
|
|
|
$this->assertTrue( $this->object->isModified() ); |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
|
287
|
|
|
public function testGetState() |
288
|
|
|
{ |
289
|
|
|
$this->assertEquals( 'Hamburg', $this->object->getState() ); |
290
|
|
|
} |
291
|
|
|
|
292
|
|
|
|
293
|
|
|
public function testSetState() |
294
|
|
|
{ |
295
|
|
|
$return = $this->object->setState( 'unitState' ); |
296
|
|
|
|
297
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
298
|
|
|
$this->assertEquals( 'unitState', $this->object->getState() ); |
299
|
|
|
$this->assertTrue( $this->object->isModified() ); |
300
|
|
|
} |
301
|
|
|
|
302
|
|
|
|
303
|
|
|
public function testGetCountryId() |
304
|
|
|
{ |
305
|
|
|
$this->assertEquals( 'DE', $this->object->getCountryId() ); |
306
|
|
|
} |
307
|
|
|
|
308
|
|
|
|
309
|
|
|
public function testSetCountryId() |
310
|
|
|
{ |
311
|
|
|
$return = $this->object->setCountryId( 'uk' ); |
312
|
|
|
|
313
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
314
|
|
|
$this->assertEquals( 'UK', $this->object->getCountryId() ); |
315
|
|
|
$this->assertTrue( $this->object->isModified() ); |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
|
319
|
|
|
public function testGetLanguageId() |
320
|
|
|
{ |
321
|
|
|
$this->assertEquals( 'de', $this->object->getLanguageId() ); |
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
|
325
|
|
|
public function testSetLanguageId() |
326
|
|
|
{ |
327
|
|
|
$return = $this->object->setLanguageId( 'en' ); |
328
|
|
|
|
329
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
330
|
|
|
$this->assertEquals( 'en', $this->object->getLanguageId() ); |
331
|
|
|
$this->assertTrue( $this->object->isModified() ); |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
|
335
|
|
|
public function testGetTelephone() |
336
|
|
|
{ |
337
|
|
|
$this->assertEquals( '05554433221', $this->object->getTelephone() ); |
338
|
|
|
} |
339
|
|
|
|
340
|
|
|
|
341
|
|
|
public function testSetTelephone() |
342
|
|
|
{ |
343
|
|
|
$return = $this->object->setTelephone( '55512345' ); |
344
|
|
|
|
345
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
346
|
|
|
$this->assertEquals( '55512345', $this->object->getTelephone() ); |
347
|
|
|
$this->assertTrue( $this->object->isModified() ); |
348
|
|
|
} |
349
|
|
|
|
350
|
|
|
|
351
|
|
|
public function testGetTelefax() |
352
|
|
|
{ |
353
|
|
|
$this->assertEquals( '05554433222', $this->object->getTelefax() ); |
354
|
|
|
} |
355
|
|
|
|
356
|
|
|
|
357
|
|
|
public function testSetTelefax() |
358
|
|
|
{ |
359
|
|
|
$return = $this->object->setTelefax( '55512345' ); |
360
|
|
|
|
361
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
362
|
|
|
$this->assertEquals( '55512345', $this->object->getTelefax() ); |
363
|
|
|
$this->assertTrue( $this->object->isModified() ); |
364
|
|
|
} |
365
|
|
|
|
366
|
|
|
|
367
|
|
|
public function testGetMobile() |
368
|
|
|
{ |
369
|
|
|
$this->assertEquals( '05554433223', $this->object->getMobile() ); |
370
|
|
|
} |
371
|
|
|
|
372
|
|
|
|
373
|
|
|
public function testSetMobile() |
374
|
|
|
{ |
375
|
|
|
$return = $this->object->setMobile( '555123456' ); |
376
|
|
|
|
377
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Common\Item\Address\Iface::class, $return ); |
378
|
|
|
$this->assertEquals( '555123456', $this->object->getMobile() ); |
379
|
|
|
$this->assertTrue( $this->object->isModified() ); |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
|
383
|
|
|
public function testGetEmail() |
384
|
|
|
{ |
385
|
|
|
$this->assertEquals( '[email protected]', $this->object->getEmail() ); |
386
|
|
|
} |
387
|
|
|
|
388
|
|
|
|
389
|
|
|
public function testSetEmail() |
390
|
|
|
{ |
391
|
|
|
$return = $this->object->setEmail( '[email protected]' ); |
392
|
|
|
|
393
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
394
|
|
|
$this->assertEquals( '[email protected]', $this->object->getEmail() ); |
395
|
|
|
$this->assertTrue( $this->object->isModified() ); |
396
|
|
|
|
397
|
|
|
$this->expectException( \Aimeos\MShop\Exception::class ); |
398
|
|
|
$this->object->setEmail( 'unittest.de' ); |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
|
402
|
|
|
public function testGetWebsite() |
403
|
|
|
{ |
404
|
|
|
$this->assertEquals( 'www.example.com', $this->object->getWebsite() ); |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
|
408
|
|
|
public function testSetWebsite() |
409
|
|
|
{ |
410
|
|
|
$return = $this->object->setWebsite( 'www.test.de' ); |
411
|
|
|
|
412
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
413
|
|
|
$this->assertEquals( 'www.test.de', $this->object->getWebsite() ); |
414
|
|
|
$this->assertTrue( $this->object->isModified() ); |
415
|
|
|
|
416
|
|
|
$this->object->setWebsite( 'http://xn--ses-5ka8l.de' ); |
417
|
|
|
$this->object->setWebsite( 'http://www.test.de:443' ); |
418
|
|
|
$this->object->setWebsite( 'https://www.test.de:8080/abc?123' ); |
419
|
|
|
|
420
|
|
|
$this->expectException( \Aimeos\MShop\Exception::class ); |
421
|
|
|
$this->object->setWebsite( '_test:de' ); |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
|
425
|
|
|
public function testSetWebsiteHostException() |
426
|
|
|
{ |
427
|
|
|
$this->expectException( \Aimeos\MShop\Exception::class ); |
428
|
|
|
$this->object->setWebsite( 'localhost' ); |
429
|
|
|
} |
430
|
|
|
|
431
|
|
|
|
432
|
|
|
public function testGetLongitude() |
433
|
|
|
{ |
434
|
|
|
$this->assertEquals( '10.0', $this->object->getLongitude() ); |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
|
438
|
|
|
public function testSetLongitude() |
439
|
|
|
{ |
440
|
|
|
$return = $this->object->setLongitude( '10.5' ); |
441
|
|
|
|
442
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
443
|
|
|
$this->assertEquals( '10.5', $this->object->getLongitude() ); |
444
|
|
|
$this->assertTrue( $this->object->isModified() ); |
445
|
|
|
} |
446
|
|
|
|
447
|
|
|
|
448
|
|
|
public function testGetLatitude() |
449
|
|
|
{ |
450
|
|
|
$this->assertEquals( '50.0', $this->object->getLatitude() ); |
451
|
|
|
} |
452
|
|
|
|
453
|
|
|
|
454
|
|
|
public function testSetLatitude() |
455
|
|
|
{ |
456
|
|
|
$return = $this->object->setLatitude( '53.5' ); |
457
|
|
|
|
458
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
459
|
|
|
$this->assertEquals( '53.5', $this->object->getLatitude() ); |
460
|
|
|
$this->assertTrue( $this->object->isModified() ); |
461
|
|
|
} |
462
|
|
|
|
463
|
|
|
|
464
|
|
|
public function testGetPosition() |
465
|
|
|
{ |
466
|
|
|
$this->assertEquals( 1, $this->object->getPosition() ); |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
|
470
|
|
|
public function testSetPosition() |
471
|
|
|
{ |
472
|
|
|
$return = $this->object->setPosition( 555 ); |
473
|
|
|
|
474
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
475
|
|
|
$this->assertEquals( 555, $this->object->getPosition() ); |
476
|
|
|
$this->assertTrue( $this->object->isModified() ); |
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
|
480
|
|
|
public function testGetBirthday() |
481
|
|
|
{ |
482
|
|
|
$this->assertEquals( '2000-01-01', $this->object->getBirthday() ); |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
|
486
|
|
|
public function testSetBirthday() |
487
|
|
|
{ |
488
|
|
|
$return = $this->object->setBirthday( '1990-01-01' ); |
489
|
|
|
|
490
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
491
|
|
|
$this->assertEquals( '1990-01-01', $this->object->getBirthday() ); |
492
|
|
|
$this->assertTrue( $this->object->isModified() ); |
493
|
|
|
} |
494
|
|
|
|
495
|
|
|
|
496
|
|
|
public function testGetTimeModified() |
497
|
|
|
{ |
498
|
|
|
$this->assertEquals( '2011-01-01 00:00:02', $this->object->getTimeModified() ); |
499
|
|
|
} |
500
|
|
|
|
501
|
|
|
|
502
|
|
|
public function testGetTimeCreated() |
503
|
|
|
{ |
504
|
|
|
$this->assertEquals( '2011-01-01 00:00:01', $this->object->getTimeCreated() ); |
505
|
|
|
} |
506
|
|
|
|
507
|
|
|
|
508
|
|
|
public function testGetEditor() |
509
|
|
|
{ |
510
|
|
|
$this->assertEquals( 'unitTestUser', $this->object->editor() ); |
511
|
|
|
} |
512
|
|
|
|
513
|
|
|
|
514
|
|
|
public function testGetResourceType() |
515
|
|
|
{ |
516
|
|
|
$this->assertEquals( 'customer/address', $this->object->getResourceType() ); |
517
|
|
|
} |
518
|
|
|
|
519
|
|
|
|
520
|
|
|
public function testCopyFrom() |
521
|
|
|
{ |
522
|
|
|
$address = new \Aimeos\MShop\Order\Item\Address\Standard( 'order.address.', [] ); |
523
|
|
|
$return = $this->object->copyFrom( $address ); |
524
|
|
|
|
525
|
|
|
$this->assertInstanceOf( \Aimeos\MShop\Customer\Item\Address\Iface::class, $return ); |
526
|
|
|
} |
527
|
|
|
|
528
|
|
|
|
529
|
|
|
public function testFromArray() |
530
|
|
|
{ |
531
|
|
|
$list = $entries = array( |
532
|
|
|
'customer.address.id' => 1, |
533
|
|
|
'customer.address.parentid' => 2, |
534
|
|
|
'customer.address.type' => 'delivery', |
535
|
|
|
'customer.address.salutation' => 'mr', |
536
|
|
|
'customer.address.company' => 'mw', |
537
|
|
|
'customer.address.vatid' => 'vatnumber', |
538
|
|
|
'customer.address.title' => 'dr', |
539
|
|
|
'customer.address.firstname' => 'first', |
540
|
|
|
'customer.address.lastname' => 'last', |
541
|
|
|
'customer.address.address1' => 'street', |
542
|
|
|
'customer.address.address2' => 'no', |
543
|
|
|
'customer.address.address3' => 'flat', |
544
|
|
|
'customer.address.postal' => '12345', |
545
|
|
|
'customer.address.city' => 'city', |
546
|
|
|
'customer.address.state' => 'state', |
547
|
|
|
'customer.address.countryid' => 'DE', |
548
|
|
|
'customer.address.languageid' => 'de', |
549
|
|
|
'customer.address.telephone' => '01234', |
550
|
|
|
'customer.address.telefax' => '02345', |
551
|
|
|
'customer.address.mobile' => '03456', |
552
|
|
|
'customer.address.email' => '[email protected]', |
553
|
|
|
'customer.address.website' => 'example.com', |
554
|
|
|
'customer.address.birthday' => '1990-01-01', |
555
|
|
|
'customer.address.longitude' => '10.0', |
556
|
|
|
'customer.address.latitude' => '53.5', |
557
|
|
|
'customer.address.position' => 4, |
558
|
|
|
); |
559
|
|
|
|
560
|
|
|
$object = new \Aimeos\MShop\Customer\Item\Address\Standard( 'customer.address.' ); |
561
|
|
|
$object = $object->fromArray( $entries, true ); |
562
|
|
|
|
563
|
|
|
$this->assertEquals( [], $entries ); |
564
|
|
|
|
565
|
|
|
$this->assertEquals( $list['customer.address.id'], $object->getId() ); |
566
|
|
|
$this->assertEquals( $list['customer.address.parentid'], $object->getParentId() ); |
567
|
|
|
$this->assertEquals( $list['customer.address.type'], $object->getType() ); |
568
|
|
|
$this->assertEquals( $list['customer.address.salutation'], $object->getSalutation() ); |
569
|
|
|
$this->assertEquals( $list['customer.address.company'], $object->getCompany() ); |
570
|
|
|
$this->assertEquals( $list['customer.address.vatid'], $object->getVatID() ); |
571
|
|
|
$this->assertEquals( $list['customer.address.title'], $object->getTitle() ); |
572
|
|
|
$this->assertEquals( $list['customer.address.firstname'], $object->getFirstname() ); |
573
|
|
|
$this->assertEquals( $list['customer.address.lastname'], $object->getLastname() ); |
574
|
|
|
$this->assertEquals( $list['customer.address.address1'], $object->getAddress1() ); |
575
|
|
|
$this->assertEquals( $list['customer.address.address2'], $object->getAddress2() ); |
576
|
|
|
$this->assertEquals( $list['customer.address.address3'], $object->getAddress3() ); |
577
|
|
|
$this->assertEquals( $list['customer.address.postal'], $object->getPostal() ); |
578
|
|
|
$this->assertEquals( $list['customer.address.city'], $object->getCity() ); |
579
|
|
|
$this->assertEquals( $list['customer.address.state'], $object->getState() ); |
580
|
|
|
$this->assertEquals( $list['customer.address.countryid'], $object->getCountryId() ); |
581
|
|
|
$this->assertEquals( $list['customer.address.languageid'], $object->getLanguageId() ); |
582
|
|
|
$this->assertEquals( $list['customer.address.telephone'], $object->getTelephone() ); |
583
|
|
|
$this->assertEquals( $list['customer.address.telefax'], $object->getTelefax() ); |
584
|
|
|
$this->assertEquals( $list['customer.address.mobile'], $object->getMobile() ); |
585
|
|
|
$this->assertEquals( $list['customer.address.email'], $object->getEmail() ); |
586
|
|
|
$this->assertEquals( $list['customer.address.website'], $object->getWebsite() ); |
587
|
|
|
$this->assertEquals( $list['customer.address.longitude'], $object->getLongitude() ); |
588
|
|
|
$this->assertEquals( $list['customer.address.latitude'], $object->getLatitude() ); |
589
|
|
|
$this->assertEquals( $list['customer.address.position'], $object->getPosition() ); |
590
|
|
|
$this->assertEquals( $list['customer.address.birthday'], $object->getBirthday() ); |
591
|
|
|
} |
592
|
|
|
|
593
|
|
|
public function testToArray() |
594
|
|
|
{ |
595
|
|
|
$arrayObject = $this->object->toArray( true ); |
596
|
|
|
|
597
|
|
|
$this->assertEquals( count( $this->values ), count( $arrayObject ) ); |
598
|
|
|
|
599
|
|
|
$this->assertEquals( $this->object->getId(), $arrayObject['customer.address.id'] ); |
600
|
|
|
$this->assertEquals( $this->object->getSiteId(), $arrayObject['customer.address.siteid'] ); |
601
|
|
|
$this->assertEquals( $this->object->getParentId(), $arrayObject['customer.address.parentid'] ); |
602
|
|
|
$this->assertEquals( $this->object->getPosition(), $arrayObject['customer.address.position'] ); |
603
|
|
|
$this->assertEquals( $this->object->getType(), $arrayObject['customer.address.type'] ); |
604
|
|
|
$this->assertEquals( $this->object->getCompany(), $arrayObject['customer.address.company'] ); |
605
|
|
|
$this->assertEquals( $this->object->getVatID(), $arrayObject['customer.address.vatid'] ); |
606
|
|
|
$this->assertEquals( $this->object->getSalutation(), $arrayObject['customer.address.salutation'] ); |
607
|
|
|
$this->assertEquals( $this->object->getTitle(), $arrayObject['customer.address.title'] ); |
608
|
|
|
$this->assertEquals( $this->object->getFirstname(), $arrayObject['customer.address.firstname'] ); |
609
|
|
|
$this->assertEquals( $this->object->getLastname(), $arrayObject['customer.address.lastname'] ); |
610
|
|
|
$this->assertEquals( $this->object->getAddress1(), $arrayObject['customer.address.address1'] ); |
611
|
|
|
$this->assertEquals( $this->object->getAddress2(), $arrayObject['customer.address.address2'] ); |
612
|
|
|
$this->assertEquals( $this->object->getAddress3(), $arrayObject['customer.address.address3'] ); |
613
|
|
|
$this->assertEquals( $this->object->getPostal(), $arrayObject['customer.address.postal'] ); |
614
|
|
|
$this->assertEquals( $this->object->getCity(), $arrayObject['customer.address.city'] ); |
615
|
|
|
$this->assertEquals( $this->object->getState(), $arrayObject['customer.address.state'] ); |
616
|
|
|
$this->assertEquals( $this->object->getCountryId(), $arrayObject['customer.address.countryid'] ); |
617
|
|
|
$this->assertEquals( $this->object->getLanguageId(), $arrayObject['customer.address.languageid'] ); |
618
|
|
|
$this->assertEquals( $this->object->getTelephone(), $arrayObject['customer.address.telephone'] ); |
619
|
|
|
$this->assertEquals( $this->object->getMobile(), $arrayObject['customer.address.mobile'] ); |
620
|
|
|
$this->assertEquals( $this->object->getEmail(), $arrayObject['customer.address.email'] ); |
621
|
|
|
$this->assertEquals( $this->object->getTelefax(), $arrayObject['customer.address.telefax'] ); |
622
|
|
|
$this->assertEquals( $this->object->getWebsite(), $arrayObject['customer.address.website'] ); |
623
|
|
|
$this->assertEquals( $this->object->getLongitude(), $arrayObject['customer.address.longitude'] ); |
624
|
|
|
$this->assertEquals( $this->object->getLatitude(), $arrayObject['customer.address.latitude'] ); |
625
|
|
|
$this->assertEquals( $this->object->getBirthday(), $arrayObject['customer.address.birthday'] ); |
626
|
|
|
$this->assertEquals( $this->object->getTimeCreated(), $arrayObject['customer.address.ctime'] ); |
627
|
|
|
$this->assertEquals( $this->object->getTimeModified(), $arrayObject['customer.address.mtime'] ); |
628
|
|
|
$this->assertEquals( $this->object->editor(), $arrayObject['customer.address.editor'] ); |
629
|
|
|
} |
630
|
|
|
|
631
|
|
|
public function testIsModified() |
632
|
|
|
{ |
633
|
|
|
$this->assertFalse( $this->object->isModified() ); |
634
|
|
|
} |
635
|
|
|
} |
636
|
|
|
|