diff --git a/.github/workflows/php70.yml b/.github/workflows/php70.yml index f74b7a3..11d23dc 100644 --- a/.github/workflows/php70.yml +++ b/.github/workflows/php70.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Clone Repo - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -39,4 +39,6 @@ jobs: run: phpunit - name: CodeCov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/php71.yml b/.github/workflows/php71.yml index 228ac35..68761fa 100644 --- a/.github/workflows/php71.yml +++ b/.github/workflows/php71.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Clone Repo - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -37,4 +37,6 @@ jobs: run: phpunit - name: CodeCov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/php72.yml b/.github/workflows/php72.yml index 0b963cc..9677225 100644 --- a/.github/workflows/php72.yml +++ b/.github/workflows/php72.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Clone Repo - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -36,6 +36,8 @@ jobs: run: phpunit - name: CodeCov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/php73.yml b/.github/workflows/php73.yml index 25b564f..c3928f9 100644 --- a/.github/workflows/php73.yml +++ b/.github/workflows/php73.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Clone Repo - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -36,7 +36,9 @@ jobs: run: phpunit - name: CodeCov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/php74.yml b/.github/workflows/php74.yml index b512a9a..cfdae1c 100644 --- a/.github/workflows/php74.yml +++ b/.github/workflows/php74.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Clone Repo - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -36,7 +36,9 @@ jobs: run: phpunit - name: CodeCov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/php80.yml b/.github/workflows/php80.yml index 678d936..8320ca3 100644 --- a/.github/workflows/php80.yml +++ b/.github/workflows/php80.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Clone Repo - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -38,4 +38,6 @@ jobs: run: phpunit - name: CodeCov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/php81.yml b/.github/workflows/php81.yml index 5a8b65d..282254f 100644 --- a/.github/workflows/php81.yml +++ b/.github/workflows/php81.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Clone Repo - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -37,7 +37,9 @@ jobs: run: phpunit - name: CodeCov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} - name: SonarCloud uses: SonarSource/sonarcloud-github-action@master diff --git a/.github/workflows/php82.yml b/.github/workflows/php82.yml index 65d2985..ec4b0e8 100644 --- a/.github/workflows/php82.yml +++ b/.github/workflows/php82.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Clone Repo - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -39,4 +39,6 @@ jobs: run: phpunit - name: CodeCov - uses: codecov/codecov-action@v1 \ No newline at end of file + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/php83.yml b/.github/workflows/php83.yml index ec0a5a7..feb86a9 100644 --- a/.github/workflows/php83.yml +++ b/.github/workflows/php83.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Clone Repo - uses: actions/checkout@v1 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -39,4 +39,6 @@ jobs: run: phpunit - name: CodeCov - uses: codecov/codecov-action@v1 \ No newline at end of file + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/webfiori/http/APITestCase.php b/webfiori/http/APITestCase.php index 3b4e098..9f1167d 100644 --- a/webfiori/http/APITestCase.php +++ b/webfiori/http/APITestCase.php @@ -75,13 +75,13 @@ public function callEndpoint(WebServicesManager $manager, string $requestMethod, if ($method == 'GET' || $method == 'DELETE') { foreach ($parameters as $key => $val) { - $_GET[$key] = $val; + $_GET[$key] = $this->parseVal($val); } $_GET['service'] = $apiEndpointName; $this->unset($_GET, $parameters, $manager); } else if ($method == 'POST' || $method == 'PUT') { foreach ($parameters as $key => $val) { - $_POST[$key] = $val; + $_POST[$key] = $this->parseVal($val); } $_POST['service'] = $apiEndpointName; $_SERVER['CONTENT_TYPE'] = 'multipart/form-data'; @@ -93,6 +93,26 @@ public function callEndpoint(WebServicesManager $manager, string $requestMethod, return $retVal; } + private function parseVal($val) { + $type = gettype($val); + + if ($type == 'array') { + $array = []; + + foreach ($val as $arrVal) { + if (gettype($val) == 'string') { + $array[] = "'".$arrVal."'"; + } else { + $array[] = $arrVal; + } + } + + return implode(',', $array); + } else if ($type == 'boolean') { + return $type === true ? 'y' : 'n'; + } + return $val; + } /** * Sends a DELETE request to specific endpoint. *