@@ -17,7 +17,7 @@ public static function setUpBeforeClass(): void
1717 {
1818 $ numPage = 1 ;
1919 do {
20- $ data = file_get_contents ('https://api-nightly.prestashop-project.org/reports?filter_version=develop&filter_campaign=functional&limit=100&page= ' . $ numPage );
20+ $ data = self :: getContents ('https://api-nightly.prestashop-project.org/reports?filter_version=develop&filter_campaign=functional&limit=100&page= ' . $ numPage );
2121 $ data = json_decode ($ data , true );
2222 foreach ($ data ['reports ' ] as $ datum ) {
2323 if ($ datum ['date ' ] === self ::DATE_RESOURCE ) {
@@ -28,11 +28,27 @@ public static function setUpBeforeClass(): void
2828 ++$ numPage ;
2929 } while (self ::$ reportId == 0 );
3030
31- $ data = file_get_contents ('https://api-nightly.prestashop-project.org/reports/ ' . self ::$ reportId );
31+ $ data = self :: getContents ('https://api-nightly.prestashop-project.org/reports/ ' . self ::$ reportId );
3232 $ data = json_decode ($ data , true );
3333 self ::$ suiteId = min (array_keys ($ data ['suites_data ' ]));
3434 }
3535
36+ private static function getContents (string $ url ): string
37+ {
38+ $ hCurl = curl_init ();
39+
40+ curl_setopt ($ hCurl , CURLOPT_URL , $ url );
41+ curl_setopt ($ hCurl , CURLOPT_RETURNTRANSFER , true );
42+ curl_setopt ($ hCurl , CURLOPT_TIMEOUT , 120 );
43+ curl_setopt ($ hCurl , CURLOPT_CONNECTTIMEOUT , 120 );
44+
45+ $ result = curl_exec ($ hCurl );
46+
47+ curl_close ($ hCurl );
48+
49+ return $ result ;
50+ }
51+
3652 public function testCorsReports (): void
3753 {
3854 $ client = static ::createClient ();
0 commit comments