@@ -632,6 +632,30 @@ public function testReadForOneLocaleAndOneDomain(string $locale, string $domain,
632
632
],
633
633
]));
634
634
},
635
+ 'listLanguages ' => function (string $ method , string $ url , array $ options = []): ResponseInterface {
636
+ $ this ->assertSame ('GET ' , $ method );
637
+ $ this ->assertSame ('https://api.crowdin.com/api/v2/languages?limit=500 ' , $ url );
638
+ $ this ->assertSame ('Authorization: Bearer API_TOKEN ' , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
639
+
640
+ return new MockResponse (json_encode ([
641
+ 'data ' => [
642
+ [
643
+ 'data ' => [
644
+ 'id ' => 'en-GB ' ,
645
+ 'osxLocale ' => 'en_GB ' ,
646
+ 'locale ' => 'en-GB ' ,
647
+ ],
648
+ ],
649
+ [
650
+ 'data ' => [
651
+ 'id ' => 'fr ' ,
652
+ 'osxLocale ' => 'fr_FR ' ,
653
+ 'locale ' => 'fr-FR ' ,
654
+ ],
655
+ ],
656
+ ],
657
+ ]));
658
+ },
635
659
'exportProjectTranslations ' => function (string $ method , string $ url , array $ options = []) use ($ expectedTargetLanguageId ): ResponseInterface {
636
660
$ this ->assertSame ('POST ' , $ method );
637
661
$ this ->assertSame ('https://api.crowdin.com/api/v2/projects/1/translations/exports ' , $ url );
@@ -746,12 +770,37 @@ public function testReadForDefaultLocaleAndOneDomain(string $locale, string $dom
746
770
],
747
771
]));
748
772
},
773
+ 'listLanguages ' => function (string $ method , string $ url , array $ options = []): ResponseInterface {
774
+ $ this ->assertSame ('GET ' , $ method );
775
+ $ this ->assertSame ('https://api.crowdin.com/api/v2/languages?limit=500 ' , $ url );
776
+ $ this ->assertSame ('Authorization: Bearer API_TOKEN ' , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
777
+
778
+ return new MockResponse (json_encode ([
779
+ 'data ' => [
780
+ [
781
+ 'data ' => [
782
+ 'id ' => 'en ' ,
783
+ 'osxLocale ' => 'en_GB ' ,
784
+ 'locale ' => 'en-GB ' ,
785
+ ],
786
+ ],
787
+ [
788
+ 'data ' => [
789
+ 'id ' => 'fr ' ,
790
+ 'osxLocale ' => 'fr_FR ' ,
791
+ 'locale ' => 'fr-FR ' ,
792
+ ],
793
+ ],
794
+ ],
795
+ ]));
796
+ },
749
797
'downloadSource ' => function (string $ method , string $ url ): ResponseInterface {
750
798
$ this ->assertSame ('GET ' , $ method );
751
799
$ this ->assertSame ('https://api.crowdin.com/api/v2/projects/1/files/12/download ' , $ url );
752
800
753
801
return new MockResponse (json_encode (['data ' => ['url ' => 'https://file.url ' ]]));
754
802
},
803
+
755
804
'downloadFile ' => function (string $ method , string $ url ) use ($ responseContent ): ResponseInterface {
756
805
$ this ->assertSame ('GET ' , $ method );
757
806
$ this ->assertSame ('https://file.url/ ' , $ url );
@@ -826,6 +875,30 @@ public function testReadServerException()
826
875
],
827
876
]));
828
877
},
878
+ 'listLanguages ' => function (string $ method , string $ url , array $ options = []): ResponseInterface {
879
+ $ this ->assertSame ('GET ' , $ method );
880
+ $ this ->assertSame ('https://api.crowdin.com/api/v2/languages?limit=500 ' , $ url );
881
+ $ this ->assertSame ('Authorization: Bearer API_TOKEN ' , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
882
+
883
+ return new MockResponse (json_encode ([
884
+ 'data ' => [
885
+ [
886
+ 'data ' => [
887
+ 'id ' => 'en ' ,
888
+ 'osxLocale ' => 'en_GB ' ,
889
+ 'locale ' => 'en-GB ' ,
890
+ ],
891
+ ],
892
+ [
893
+ 'data ' => [
894
+ 'id ' => 'fr ' ,
895
+ 'osxLocale ' => 'fr_FR ' ,
896
+ 'locale ' => 'fr-FR ' ,
897
+ ],
898
+ ],
899
+ ],
900
+ ]));
901
+ },
829
902
'exportProjectTranslations ' => function (string $ method , string $ url , array $ options = []): ResponseInterface {
830
903
$ this ->assertSame ('POST ' , $ method );
831
904
$ this ->assertSame ('https://api.crowdin.com/api/v2/projects/1/translations/exports ' , $ url );
@@ -861,6 +934,30 @@ public function testReadDownloadServerException()
861
934
],
862
935
]));
863
936
},
937
+ 'listLanguages ' => function (string $ method , string $ url , array $ options = []): ResponseInterface {
938
+ $ this ->assertSame ('GET ' , $ method );
939
+ $ this ->assertSame ('https://api.crowdin.com/api/v2/languages?limit=500 ' , $ url );
940
+ $ this ->assertSame ('Authorization: Bearer API_TOKEN ' , $ options ['normalized_headers ' ]['authorization ' ][0 ]);
941
+
942
+ return new MockResponse (json_encode ([
943
+ 'data ' => [
944
+ [
945
+ 'data ' => [
946
+ 'id ' => 'en ' ,
947
+ 'osxLocale ' => 'en_GB ' ,
948
+ 'locale ' => 'en-GB ' ,
949
+ ],
950
+ ],
951
+ [
952
+ 'data ' => [
953
+ 'id ' => 'fr ' ,
954
+ 'osxLocale ' => 'fr_FR ' ,
955
+ 'locale ' => 'fr-FR ' ,
956
+ ],
957
+ ],
958
+ ],
959
+ ]));
960
+ },
864
961
'exportProjectTranslations ' => function (string $ method , string $ url , array $ options = []): ResponseInterface {
865
962
$ this ->assertSame ('POST ' , $ method );
866
963
$ this ->assertSame ('https://api.crowdin.com/api/v2/projects/1/translations/exports ' , $ url );
0 commit comments