From 5adbfc145d61c84621b2aa849bce7554aff8c991 Mon Sep 17 00:00:00 2001 From: Ibrahim Date: Mon, 23 Dec 2024 13:26:47 +0300 Subject: [PATCH 1/4] Update php83.yml --- .github/workflows/php83.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/php83.yml b/.github/workflows/php83.yml index 8003948..e8c2ecd 100644 --- a/.github/workflows/php83.yml +++ b/.github/workflows/php83.yml @@ -49,7 +49,7 @@ jobs: if: github.ref == 'refs/heads/master' steps: - uses: actions/checkout@v4 - - uses: google-github-actions/release-please-action@v3 + - uses: google-github-actions/release-please-action@v4 with: release-type: php config-file: release-please-config.json From 621e9ed07364e94b7a4ce102397ffd27ac7879a6 Mon Sep 17 00:00:00 2001 From: Ibrahim BinAlshikh Date: Tue, 24 Dec 2024 22:50:04 +0300 Subject: [PATCH 2/4] feat: Added Format Method to API Test Case --- webfiori/http/APITestCase.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/webfiori/http/APITestCase.php b/webfiori/http/APITestCase.php index d9de0c5..70b376f 100644 --- a/webfiori/http/APITestCase.php +++ b/webfiori/http/APITestCase.php @@ -139,6 +139,28 @@ public function callEndpoint(WebServicesManager $manager, string $requestMethod, } } + /** + * Creates a formatted string from calling an API. + * + * This helper method can be used to format JSON output of calling an API + * and use it in assertions. The goal of the method is to initially format + * the out put, display it as string and the developer copies the output + * and modify it as needed. + * + * @param string $output + */ + public function format(string $output) { + $expl = explode(self::NL, $output); + $nl = '.self::NL\n'; + $count = count($expl); + + for ($x = 0 ; $x < count($expl) ; $x++) { + if ($x + 1 == $count) { + $nl = ''; + } + echo ". '$expl[$x]]'".$nl; + } + } private function parseVal($val) { $type = gettype($val); From d2e2072b7c6385b34614451eef883a5ae2013f8f Mon Sep 17 00:00:00 2001 From: Ibrahim BinAlshikh Date: Tue, 24 Dec 2024 22:51:15 +0300 Subject: [PATCH 3/4] fix: Fix to Output File Path --- webfiori/http/APITestCase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webfiori/http/APITestCase.php b/webfiori/http/APITestCase.php index 70b376f..5e5f2f4 100644 --- a/webfiori/http/APITestCase.php +++ b/webfiori/http/APITestCase.php @@ -101,7 +101,7 @@ public function addFile(string $fileIdx, string $filePath, bool $reset = false) * @return string The method will return the output of the endpoint. */ public function callEndpoint(WebServicesManager $manager, string $requestMethod, string $apiEndpointName, array $parameters = [], array $httpHeaders = []) : string { - $manager->setOutputStream(fopen(self::DEFAULT_OUTPUT_STREAM,'w')); + $manager->setOutputStream(fopen($this->getOutputFile(),'w')); $method = strtoupper($requestMethod); putenv('REQUEST_METHOD='.$method); @@ -128,7 +128,7 @@ public function callEndpoint(WebServicesManager $manager, string $requestMethod, } $retVal = $manager->readOutputStream(); - unlink(self::DEFAULT_OUTPUT_STREAM); + unlink($this->getOutputFile()); try { $json = Json::decode($retVal); From 594c61781ab9413965bf210070fe2b78f84168b2 Mon Sep 17 00:00:00 2001 From: Ibrahim BinAlshikh Date: Tue, 24 Dec 2024 23:00:11 +0300 Subject: [PATCH 4/4] chore: Updated .gitattributes --- .gitattributes | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 5242788..c8456b6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,8 +1,20 @@ + #perform LF normalization +* text eol=crlf +*.php text eol=crlf +*.html text eol=crlf # Files and folders here will be not included when creating package /tests export-ignore /examples export-ignore /.github export-ignore /.gitignore export-ignore /.travis.yml export-ignore -/phpunit.xml export-ignore -/sonar-project.properties export-ignore \ No newline at end of file +/phpunit.xml export-ignore +/ecs.php export-ignore +/php_cs.php.dist export-ignore +/phpbench.json export-ignore +/sonar-project.properties export-ignore +/ecs.php export-ignore +/CHANGELOG.md export-ignore +/release-commit.php export-ignore +/release-please-manifest.json export-ignore +/release-please-config.json export-ignore \ No newline at end of file