Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup MySQL
uses: mirromutth/mysql-action@v1.1
uses: shogo82148/actions-setup-mysql@v1
with:
mysql version: '8.0'
mysql database: 'qanightlyresults'
mysql root password: 'root'
mysql-version: '8.0'
root-password: 'root'

- name: Create database
run: mysql -h127.0.0.1 -uroot -proot -e "create schema qanightlyresults;"

- uses: actions/checkout@v3

Expand All @@ -96,9 +98,6 @@ jobs:
- name: Composer Install
run: composer install --ansi --prefer-dist --no-interaction --no-progress

- name: Change MySQL authentication method
run: sleep 15 && mysql -h127.0.0.1 -uroot -proot -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root'; FLUSH PRIVILEGES;"

- name: Setup database
run: php bin/console doctrine:schema:update --dump-sql --force --env=test

Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 18 additions & 2 deletions tests/Controller/ReportControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static function setUpBeforeClass(): void
{
$numPage = 1;
do {
$data = file_get_contents('https://api-nightly.prestashop-project.org/reports?filter_version=develop&filter_campaign=functional&limit=100&page=' . $numPage);
$data = self::getContents('https://api-nightly.prestashop-project.org/reports?filter_version=develop&filter_campaign=functional&limit=100&page=' . $numPage);
$data = json_decode($data, true);
foreach ($data['reports'] as $datum) {
if ($datum['date'] === self::DATE_RESOURCE) {
Expand All @@ -28,11 +28,27 @@ public static function setUpBeforeClass(): void
++$numPage;
} while (self::$reportId == 0);

$data = file_get_contents('https://api-nightly.prestashop-project.org/reports/' . self::$reportId);
$data = self::getContents('https://api-nightly.prestashop-project.org/reports/' . self::$reportId);
$data = json_decode($data, true);
self::$suiteId = min(array_keys($data['suites_data']));
}

private static function getContents(string $url): string
{
$hCurl = curl_init();

curl_setopt($hCurl, CURLOPT_URL, $url);
curl_setopt($hCurl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($hCurl, CURLOPT_TIMEOUT, 120);
curl_setopt($hCurl, CURLOPT_CONNECTTIMEOUT, 120);

$result = curl_exec($hCurl);

curl_close($hCurl);

return $result;
}

public function testCorsReports(): void
{
$client = static::createClient();
Expand Down