Skip to content

Commit

Permalink
Enhancement: Run end-to-end test asserting HTTP response status code
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Dec 15, 2023
1 parent e1c6168 commit 5daaceb
Show file tree
Hide file tree
Showing 7 changed files with 858 additions and 7 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "none, json, mbstring, tokenizer"
extensions: "none, curl, json, mbstring, tokenizer"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
Expand Down Expand Up @@ -64,6 +64,9 @@ jobs:
php-version:
- "8.2"

env:
HTTP_HOST: "localhost:8080"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"
Expand All @@ -72,11 +75,14 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "none"
extensions: "none, curl"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for PHP"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""

- name: "Start built-in web server for PHP"
run: "php -S ${{ env.HTTP_HOST }} .router.php &"

- name: "Run tests"
run: "php tests/run-tests.php -j3 -q --show-diff"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ backend/mirror.gif
backend/mirror.png
backend/mirror.jpg
backend/GeoIP.dat
.php-cs-fixer.cache
tests/server.log
tests/server.pid
\.php-cs-fixer.cache
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.EXPORT_ALL_VARIABLES:

HTTP_HOST:=localhost:8080

.PHONY: help
help: ## Displays this list of targets with descriptions
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
Expand All @@ -7,8 +11,8 @@ coding-standards: vendor ## Fixes code style issues with friendsofphp/php-cs-fix
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --verbose

.PHONY: tests
tests: ## Runs tests
php tests/run-tests.php -j3 -q
tests: vendor ## Runs tests
tests/server start; php tests/run-tests.php -j3 -q; tests/server stop

vendor: composer.json composer.lock
composer validate --strict
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"php": "~8.2.0"
},
"require-dev": {
"ext-curl": "*",
"friendsofphp/php-cs-fixer": "^3.40.2"
},
"autoload": {
Expand Down
6 changes: 4 additions & 2 deletions composer.lock

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

Loading

0 comments on commit 5daaceb

Please sign in to comment.