11
11
use Tests \Integration \DTO \BasketDTO ;
12
12
use Tests \Integration \DTO \ProductDTO ;
13
13
use Tests \Integration \DTO \PurchaseDTO ;
14
+ use Tests \Integration \DTO \Full \PurchaseDTO as FullPurchaseDto ;
14
15
use Tests \Integration \DTO \EmptyClassDto ;
15
16
use Tests \Integration \DTO \ArrayScalarDTO ;
16
17
use Tests \Integration \DTO \UserEmptyTypeDTO ;
@@ -204,10 +205,7 @@ public function testTripleRecursiveArray(): void
204
205
}
205
206
}
206
207
}
207
-
208
- /**
209
- * @throws ReflectionException|ClassNotFoundException
210
- */
208
+
211
209
public function testEmptyTypeObject (): void
212
210
{
213
211
$ data = $ this ->getBaseArrayData ();
@@ -219,4 +217,159 @@ public function testEmptyTypeObject(): void
219
217
self ::assertEquals ($ data ['email ' ], $ userDTO ->email );
220
218
self ::assertEquals ($ data ['balance ' ], $ userDTO ->balance );
221
219
}
220
+
221
+ public function testFull (): void
222
+ {
223
+ $ data = $ this ->getPurcheseObject ();
224
+ $ object = (new Hydrator )->create (FullPurchaseDto::class, $ data );
225
+ $ this ->assertEquals ($ data ['user ' ]['id ' ], $ object ->user ->id );
226
+ }
227
+
228
+ public function getPurcheseObject (): array
229
+ {
230
+ return [
231
+ 'products ' => [
232
+ [
233
+ 'id ' => 1 ,
234
+ 'name ' => 'phone ' ,
235
+ 'price ' => 43.03 ,
236
+ 'description ' => 'test description for phone ' ,
237
+ 'count ' => 123
238
+ ],
239
+ [
240
+ 'id ' => 2 ,
241
+ 'name ' => 'bread ' ,
242
+ 'price ' => 10.56 ,
243
+ 'description ' => 'test description for bread ' ,
244
+ 'count ' => 321
245
+ ],
246
+ [
247
+ 'id ' => 3 ,
248
+ 'name ' => 'book ' ,
249
+ 'price ' => 5.5 ,
250
+ 'description ' => 'test description for book ' ,
251
+ 'count ' => 333
252
+ ],
253
+ [
254
+ 'id ' => 4 ,
255
+ 'name ' => 'PC ' ,
256
+ 'price ' => 100 ,
257
+ 'description ' => 'test description for PC ' ,
258
+ 'count ' => 7
259
+ ]
260
+ ],
261
+ 'user ' => [
262
+ 'id ' => 1 ,
263
+ 'contact ' => 'fake@mail.com ' ,
264
+ 'balance ' => 10012.23 ,
265
+ 'type ' => 'admin ' ,
266
+ 'realAddress ' => 'test address ' ,
267
+ 'createdAt ' => '2023-04-10 ' ,
268
+ ],
269
+ 'createdAt ' => '2023-04-10 ' ,
270
+ 'address ' => $ this ->getAddress ()
271
+ ];
272
+ }
273
+
274
+ private function getAddress ()
275
+ {
276
+ return [
277
+ "source " => "мск сухонска 11/-89 " ,
278
+ "result " => "г Москва, ул Сухонская, д 11, кв 89 " ,
279
+ "postal_code " => "127642 " ,
280
+ "country " => "Россия " ,
281
+ "country_iso_code " => "RU " ,
282
+ "federal_district " => "Центральный " ,
283
+ "region_fias_id " => "0c5b2444-70a0-4932-980c-b4dc0d3f02b5 " ,
284
+ "region_kladr_id " => "7700000000000 " ,
285
+ "region_iso_code " => "RU-MOW " ,
286
+ "region_with_type " => "г Москва " ,
287
+ "region_type " => "г " ,
288
+ "region_type_full " => "город " ,
289
+ "region " => "Москва " ,
290
+ "area_fias_id " => null ,
291
+ "area_kladr_id " => null ,
292
+ "area_with_type " => null ,
293
+ "area_type " => null ,
294
+ "area_type_full " => null ,
295
+ "area " => null ,
296
+ "city_fias_id " => null ,
297
+ "city_kladr_id " => null ,
298
+ "city_with_type " => null ,
299
+ "city_type " => null ,
300
+ "city_type_full " => null ,
301
+ "city " => null ,
302
+ "city_area " => "Северо-восточный " ,
303
+ "city_district_fias_id " => null ,
304
+ "city_district_kladr_id " => null ,
305
+ "city_district_with_type " => "р-н Северное Медведково " ,
306
+ "city_district_type " => "р-н " ,
307
+ "city_district_type_full " => "район " ,
308
+ "city_district " => "Северное Медведково " ,
309
+ "settlement_fias_id " => null ,
310
+ "settlement_kladr_id " => null ,
311
+ "settlement_with_type " => null ,
312
+ "settlement_type " => null ,
313
+ "settlement_type_full " => null ,
314
+ "settlement " => null ,
315
+ "street_fias_id " => "95dbf7fb-0dd4-4a04-8100-4f6c847564b5 " ,
316
+ "street_kladr_id " => "77000000000283600 " ,
317
+ "street_with_type " => "ул Сухонская " ,
318
+ "street_type " => "ул " ,
319
+ "street_type_full " => "улица " ,
320
+ "street " => "Сухонская " ,
321
+ "house_fias_id " => "5ee84ac0-eb9a-4b42-b814-2f5f7c27c255 " ,
322
+ "house_kladr_id " => "7700000000028360004 " ,
323
+ "house_type " => "д " ,
324
+ "house_type_full " => "дом " ,
325
+ "house " => "11 " ,
326
+ "block_type " => null ,
327
+ "block_type_full " => null ,
328
+ "block " => null ,
329
+ "flat_fias_id " => "f26b876b-6857-4951-b060-ec6559f04a9a " ,
330
+ "flat_type " => "кв " ,
331
+ "flat_type_full " => "квартира " ,
332
+ "flat " => "89 " ,
333
+ "flat_area " => "34.6 " ,
334
+ "square_meter_price " => "239953 " ,
335
+ "flat_price " => "8302374 " ,
336
+ "postal_box " => null ,
337
+ "fias_id " => "f26b876b-6857-4951-b060-ec6559f04a9a " ,
338
+ "fias_code " => "77000000000000028360004 " ,
339
+ "fias_level " => "9 " ,
340
+ "kladr_id " => "7700000000028360004 " ,
341
+ "capital_marker " => "0 " ,
342
+ "okato " => "45280583000 " ,
343
+ "oktmo " => "45362000 " ,
344
+ "tax_office " => "7715 " ,
345
+ "tax_office_legal " => "7715 " ,
346
+ "timezone " => "UTC+3 " ,
347
+ "geo_lat " => "55.8782557 " ,
348
+ "geo_lon " => "37.65372 " ,
349
+ "beltway_hit " => "IN_MKAD " ,
350
+ "beltway_distance " => null ,
351
+ "qc_geo " => 0 ,
352
+ "qc_complete " => 0 ,
353
+ "qc_house " => 2 ,
354
+ "qc " => 0 ,
355
+ "unparsed_parts " => null ,
356
+ "metro " => [
357
+ [
358
+ "distance " => 1.1 ,
359
+ "line " => "Калужско-Рижская " ,
360
+ "name " => "Бабушкинская "
361
+ ],
362
+ [
363
+ "distance " => 1.2 ,
364
+ "line " => "Калужско-Рижская " ,
365
+ "name " => "Медведково "
366
+ ],
367
+ [
368
+ "distance " => 2.5 ,
369
+ "line " => "Калужско-Рижская " ,
370
+ "name " => "Свиблово "
371
+ ]
372
+ ]
373
+ ];
374
+ }
222
375
}
0 commit comments