Skip to content

Commit

Permalink
test: add tests for xdebug
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Jun 1, 2024
1 parent cd47cb0 commit 05bb43d
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
- feature: php
filter: php83
- feature: ssh
- feature: xdebug
steps:
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
Expand Down
1 change: 1 addition & 0 deletions features/test/xdebug/alpine-base.sh
17 changes: 17 additions & 0 deletions features/test/xdebug/checks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

check "XDebug is available" sh -c 'php -m | grep -i xdebug'
check "xdebug-set-mode is executable" test -x /usr/local/bin/xdebug-set-mode
check "xdebug-disable is executable" test -x /usr/local/bin/xdebug-disable

sudo xdebug-set-mode develop
check "xdebug.mode is develop (cli)" sh -c 'php -i | grep -E "^xdebug\.mode => develop => develop"'
check "xdebug.mode is develop (fpm)" sh -c 'php-fpm -i | grep -E "^xdebug\.mode => develop => develop"'

sudo xdebug-set-mode trace,profile
check "xdebug.mode is trace,profile (cli)" sh -c 'php -i | grep -E "^xdebug\.mode => trace,profile => trace,profile"'
check "xdebug.mode is trace,profile (fpm)" sh -c 'php-fpm -i | grep -E "^xdebug\.mode => trace,profile => trace,profile"'

sudo xdebug-set-mode off
check "xdebug.mode is off (cli)" sh -c 'php -i | grep -E "^xdebug\.mode => off => off"'
check "xdebug.mode is off (fpm)" sh -c 'php-fpm -i | grep -E "^xdebug\.mode => off => off"'
26 changes: 26 additions & 0 deletions features/test/xdebug/scenarios.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"alpine-base": {
"image": "ghcr.io/automattic/vip-codespaces/alpine-base:latest",
"overrideCommand": false,
"features": {
"php": {},
"xdebug": {}
},
"overrideFeatureInstallOrder": [
"./php",
"./xdebug"
]
},
"ubuntu-base": {
"image": "ghcr.io/automattic/vip-codespaces/ubuntu-base:latest",
"overrideCommand": false,
"features": {
"php": {},
"xdebug": {}
},
"overrideFeatureInstallOrder": [
"./php",
"./xdebug"
]
}
}
8 changes: 8 additions & 0 deletions features/test/xdebug/ubuntu-base.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# shellcheck source=/dev/null
source dev-container-features-test-lib

source ./checks.sh

reportResults

0 comments on commit 05bb43d

Please sign in to comment.