@@ -11,50 +11,29 @@ class UserProfilePhotosTypeTest extends TypeTestCase
11
11
{
12
12
public function testEncode ()
13
13
{
14
- $ result = [
15
- 'total_count ' => 1 ,
16
- 'photos ' => [
17
- [
18
- [
19
- 'file_id ' => 'AgADBQADyKcxG5hmrglZIi4CcakAAf4_7r0yAAQ735Gp9Icu6KADAQABAg ' ,
20
- 'file_uniqueId ' => 'fileUniqueId ' ,
21
- 'file_size ' => 91518 ,
22
- 'width ' => 640 ,
23
- 'height ' => 640 ,
24
- ],
25
- [
26
- 'file_id ' => 'AgADBQADyKcxG5hmrglZIi4CcakAAf4_7r0yAASzMopVG_fq_qEDAQABAg ' ,
27
- 'file_uniqueId ' => 'fileUniqueId ' ,
28
- 'file_size ' => 219720 ,
29
- 'width ' => 1050 ,
30
- 'height ' => 1050 ,
31
- ],
32
- ],
33
- ],
34
- ];
14
+ $ result = $ this ->getResource ('user-profile-photos ' );
35
15
36
16
$ type = $ this ->getType ($ result );
37
17
18
+ $ result = \json_decode ($ result , true )['result ' ];
19
+
38
20
$ this ->assertEquals ($ type ->totalCount , $ result ['total_count ' ]);
39
21
$ this ->assertEquals (\count ($ type ->photos ), 1 );
40
- $ this ->assertEquals (\count ($ type ->photos [0 ]), 2 );
41
- $ this ->assertInstanceOf (PhotoSizeType::class, $ type ->photos [0 ][0 ]);
42
- $ this ->assertInstanceOf (PhotoSizeType::class, $ type ->photos [0 ][1 ]);
43
- $ this ->assertEquals ($ type ->photos [0 ][0 ]->fileId , $ result ['photos ' ][0 ][0 ]['file_id ' ]);
44
- $ this ->assertEquals ($ type ->photos [0 ][0 ]->fileUniqueId , $ result ['photos ' ][0 ][0 ]['file_uniqueId ' ]);
45
- $ this ->assertEquals ($ type ->photos [0 ][0 ]->fileSize , $ result ['photos ' ][0 ][0 ]['file_size ' ]);
46
- $ this ->assertEquals ($ type ->photos [0 ][0 ]->width , $ result ['photos ' ][0 ][0 ]['width ' ]);
47
- $ this ->assertEquals ($ type ->photos [0 ][0 ]->height , $ result ['photos ' ][0 ][0 ]['height ' ]);
48
- $ this ->assertEquals ($ type ->photos [0 ][1 ]->fileId , $ result ['photos ' ][0 ][1 ]['file_id ' ]);
49
- $ this ->assertEquals ($ type ->photos [0 ][1 ]->fileUniqueId , $ result ['photos ' ][0 ][0 ]['file_uniqueId ' ]);
50
- $ this ->assertEquals ($ type ->photos [0 ][1 ]->fileSize , $ result ['photos ' ][0 ][1 ]['file_size ' ]);
51
- $ this ->assertEquals ($ type ->photos [0 ][1 ]->width , $ result ['photos ' ][0 ][1 ]['width ' ]);
52
- $ this ->assertEquals ($ type ->photos [0 ][1 ]->height , $ result ['photos ' ][0 ][1 ]['height ' ]);
22
+ $ this ->assertEquals (\count ($ type ->photos [0 ]), 3 );
23
+
24
+ foreach ($ result ['photos ' ][0 ] as $ index => $ size ) {
25
+ $ this ->assertInstanceOf (PhotoSizeType::class, $ type ->photos [0 ][$ index ]);
26
+ $ this ->assertEquals ($ type ->photos [0 ][$ index ]->fileId , $ size ['file_id ' ]);
27
+ $ this ->assertEquals ($ type ->photos [0 ][$ index ]->fileUniqueId , $ size ['file_unique_id ' ]);
28
+ $ this ->assertEquals ($ type ->photos [0 ][$ index ]->fileSize , $ size ['file_size ' ]);
29
+ $ this ->assertEquals ($ type ->photos [0 ][$ index ]->width , $ size ['width ' ]);
30
+ $ this ->assertEquals ($ type ->photos [0 ][$ index ]->height , $ size ['height ' ]);
31
+ }
53
32
}
54
33
55
34
public function getType ($ result ): UserProfilePhotosType
56
35
{
57
- $ botApi = $ this ->getBot ($ result );
36
+ $ botApi = $ this ->getBotFromJson ($ result );
58
37
59
38
return $ botApi ->call ($ this ->getMethod (), UserProfilePhotosType::class);
60
39
}
0 commit comments