22set -euo pipefail
33
44repo_root=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd)
5+ ncdd=(bash " $repo_root /bin/ncdd" )
56tmp=$( mktemp -d)
67trap ' rm -rf "$tmp"' EXIT
78mkdir -p " $tmp /project" " $tmp /bin"
@@ -38,37 +39,37 @@ chmod +x "$tmp/bin/docker"
3839export PATH=" $tmp /bin:$PATH "
3940export NCDD_TEST_LOG=" $tmp /docker.log"
4041
41- out=$( cd " $tmp /project" && " $repo_root /bin/ ncdd" env)
42+ out=$( cd " $tmp /project" && " ${ ncdd[@]} " env)
4243grep -q ' ^NCDD_NEXTCLOUD_REF=stable35$' <<< " $out"
4344grep -q ' ^NCDD_NEXTCLOUD_MAJOR=35$' <<< " $out"
4445grep -q ' ^NCDD_APP_ID=demo$' <<< " $out"
4546grep -q ' ^NCDD_HTTP_PORT=8888$' <<< " $out"
4647
47- json=$( cd " $tmp /project" && " $repo_root /bin/ ncdd" doctor --json)
48+ json=$( cd " $tmp /project" && " ${ ncdd[@]} " doctor --json)
4849grep -q ' "ready":true' <<< " $json"
4950grep -q ' "ref":"stable35"' <<< " $json"
5051
51- (cd " $tmp /project" && " $repo_root /bin/ ncdd" exec --as runtime -- php -v)
52+ (cd " $tmp /project" && " ${ ncdd[@]} " exec --as runtime -- php -v)
5253grep -q -- ' --user www-data dev-worker php -v' " $tmp /docker.log"
5354
54- help=$( " $repo_root /bin/ ncdd" help ai)
55+ help=$( " ${ ncdd[@]} " help ai)
5556grep -q ' Do not call docker compose directly' <<< " $help"
5657
57- list=$( cd " $tmp /project" && " $repo_root /bin/ ncdd" test --list)
58- grep -q ' ^phpunit <<<"$list"
59- grep -q ' ^full <<< " $list"
58+ list=$( cd " $tmp /project" && " ${ ncdd[@]} " test --list)
59+ grep -q ' ^phpunit$ ' <<< " $list"
60+ grep -q ' ^full$ ' <<< " $list"
6061
61- (cd " $tmp /project" && " $repo_root /bin/ ncdd" test phpunit tests/php/Unit/FooTest.php)
62+ (cd " $tmp /project" && " ${ ncdd[@]} " test phpunit tests/php/Unit/FooTest.php)
6263grep -q ' dev-worker sh -lc' " $tmp /docker.log"
6364grep -q ' vendor/bin/phpunit' " $tmp /docker.log"
6465
65- (cd " $tmp /project" && " $repo_root /bin/ ncdd" test frontend lint)
66+ (cd " $tmp /project" && " ${ ncdd[@]} " test frontend lint)
6667grep -q ' node-worker sh -lc' " $tmp /docker.log"
6768
68- json_test=$( cd " $tmp /project" && " $repo_root /bin/ ncdd" test --json phpunit tests/php/Unit/FooTest.php 2> /dev/null)
69+ json_test=$( cd " $tmp /project" && " ${ ncdd[@]} " test --json phpunit tests/php/Unit/FooTest.php 2> /dev/null)
6970grep -q ' "suite":"phpunit"' <<< " $json_test"
7071grep -q ' "status":0' <<< " $json_test"
7172
7273bash -n " $repo_root /bin/ncdd"
7374bash -n " $repo_root /lib/ncdd-tests.sh"
74- echo ' ncdd CLI tests passed'
75+ echo ' ncdd CLI tests passed'
0 commit comments