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