Skip to content

Commit 30c8014

Browse files
committed
Enhancement: Run end-to-end test asserting HTTP response status code
1 parent 16ba11f commit 30c8014

File tree

8 files changed

+867
-6
lines changed

8 files changed

+867
-6
lines changed

.github/workflows/integrate.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
uses: "shivammathur/setup-php@v2"
2828
with:
2929
coverage: "none"
30-
extensions: "none, json, mbstring, tokenizer"
30+
extensions: "none, curl, json, mbstring, tokenizer"
3131
php-version: "${{ matrix.php-version }}"
3232

3333
- name: "Set up problem matchers for PHP"
@@ -64,6 +64,9 @@ jobs:
6464
php-version:
6565
- "8.2"
6666

67+
env:
68+
HTTP_HOST: "localhost:8080"
69+
6770
steps:
6871
- name: "Checkout"
6972
uses: "actions/checkout@v4"
@@ -72,11 +75,14 @@ jobs:
7275
uses: "shivammathur/setup-php@v2"
7376
with:
7477
coverage: "none"
75-
extensions: "none"
78+
extensions: "none, curl"
7679
php-version: "${{ matrix.php-version }}"
7780

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

84+
- name: "Start built-in web server for PHP"
85+
run: "php -S ${{ env.HTTP_HOST }} .router.php &"
86+
8187
- name: "Run tests"
8288
run: "php tests/run-tests.php -j3 -q --show-diff"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ backend/mirror.gif
44
backend/mirror.png
55
backend/mirror.jpg
66
backend/GeoIP.dat
7+
tests/server.log
8+
tests/server.pid
79
.php-cs-fixer.cache

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
.EXPORT_ALL_VARIABLES:
2+
3+
HTTP_HOST:=localhost:8080
4+
15
.PHONY: help
26
help: ## Displays this list of targets with descriptions
37
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
@@ -7,8 +11,8 @@ coding-standards: vendor ## Fixes code style issues with friendsofphp/php-cs-fix
711
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --verbose
812

913
.PHONY: tests
10-
tests: ## Runs tests
11-
php tests/run-tests.php -j3 -q
14+
tests: vendor ## Runs tests
15+
tests/server start; php tests/run-tests.php -j3 -q; tests/server stop
1216

1317
vendor: composer.json composer.lock
1418
composer validate --strict

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"php": "~8.2.0"
1212
},
1313
"require-dev": {
14+
"ext-curl": "*",
1415
"friendsofphp/php-cs-fixer": "^3.40.2"
1516
},
1617
"autoload": {

composer.lock

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)