Skip to content

Commit ba5e695

Browse files
committed
Add aljibe-config command test
This commit adds a new check_aljibe_config_command function that tests: - ddev aljibe-config default_site returns one line - ddev aljibe-config hooks -k returns 8 lines with all expected hook names - ddev aljibe-config hooks returns 8 lines including drush uli command The test is called after check_create_database_command in the install from directory test suite.
1 parent 620c29e commit ba5e695

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/test.bats

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,46 @@ check_create_database_command() {
242242

243243
}
244244

245+
check_aljibe_config_command() {
246+
247+
echo -n "Checking if aljibe-config default_site returns one line..."
248+
run ddev aljibe-config default_site
249+
assert_success
250+
# Check output is not empty and has exactly one line
251+
[ -n "$output" ]
252+
local line_count=$(echo "$output" | wc -l)
253+
[ "$line_count" -eq 1 ]
254+
echo " Ok."
255+
256+
echo -n "Checking if aljibe-config hooks -k returns 8 lines with expected hooks..."
257+
run ddev aljibe-config hooks -k
258+
assert_success
259+
# Check we have 8 lines
260+
local line_count=$(echo "$output" | wc -l)
261+
[ "$line_count" -eq 8 ]
262+
# Check for each expected hook name
263+
assert_output --partial "pre_setup"
264+
assert_output --partial "post_setup"
265+
assert_output --partial "pre_site_install"
266+
assert_output --partial "post_site_install"
267+
assert_output --partial "pre_site_install_config"
268+
assert_output --partial "post_site_install_config"
269+
assert_output --partial "pre_site_install_db"
270+
assert_output --partial "post_site_install_db"
271+
echo " Ok."
272+
273+
echo -n "Checking if aljibe-config hooks returns 8 lines with drush uli command..."
274+
run ddev aljibe-config hooks
275+
assert_success
276+
# Check we have 8 lines
277+
local line_count=$(echo "$output" | wc -l)
278+
[ "$line_count" -eq 8 ]
279+
# Check for the drush uli command
280+
assert_output --partial "drush @\${SITE_ALIAS} uli"
281+
echo " Ok."
282+
283+
}
284+
245285
@test "install from directory" {
246286
set -eu -o pipefail
247287
cd "$TESTDIR"
@@ -278,4 +318,7 @@ check_create_database_command() {
278318
# Check create-database command
279319
check_create_database_command
280320

321+
# Check aljibe-config command
322+
check_aljibe_config_command
323+
281324
}

0 commit comments

Comments
 (0)