Skip to content

Commit 2133808

Browse files
committed
test
1 parent b4fe494 commit 2133808

File tree

5 files changed

+13
-20
lines changed

5 files changed

+13
-20
lines changed

.devtools/provision.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fi
5454
db_file="/tmp/site_${extension}.sqlite"
5555

5656
info "Installing Drupal into SQLite database ${db_file}."
57-
drush sql:drop -y || true > /dev/null
57+
drush sql:drop -y || true >/dev/null
5858
drush site-install "${DRUPAL_PROFILE}" -y --db-url="sqlite://localhost/${db_file}" --account-name=admin install_configure_form.enable_update_status_module=NULL install_configure_form.enable_update_status_emails=NULL
5959

6060
pass "Drupal installed."

.scaffold/tests/bats/_helper.bash

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ setup() {
3232
export ROOT_DIR="${CUR_DIR}"
3333

3434
# Directory where the shell command script will be running in.
35+
# Note that because BATS_TEST_TMPDIR is based on TMPDIR, in some OSes it
36+
# may resolve to a long path that may not be supported by Drupal, so BATS
37+
# tests would need to run with TMPDIR=.logs or similar.
3538
export BUILD_DIR="${BUILD_DIR:-"${BATS_TEST_TMPDIR//\/\//\/}/scaffold-$(date +%s)"}"
3639
fixture_prepare_dir "${BUILD_DIR}"
3740

.scaffold/tests/bats/ahoy.bats

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,7 @@ export BATS_FIXTURE_EXPORT_CODEBASE_ENABLED=1
8080

8181
ahoy test
8282
assert_success
83-
84-
ahoy test-unit
85-
assert_success
86-
87-
ahoy test-kernel
88-
assert_success
89-
90-
ahoy test-functional
91-
assert_success
83+
assert_dir_exists "${BUILD_DIR}/build/web/sites/simpletest/browser_output"
9284
}
9385

9486
@test "ahoy lint, lint-fix" {
@@ -126,10 +118,13 @@ export BATS_FIXTURE_EXPORT_CODEBASE_ENABLED=1
126118

127119
run ahoy test-functional
128120
assert_success
121+
assert_dir_exists "${BUILD_DIR}/build/web/sites/simpletest/browser_output"
122+
rm -Rf "${BUILD_DIR}/build/web/sites/simpletest/browser_output" || true
129123

130124
sed -i -e "s/responseContains/responseNotContains/g" "${BUILD_DIR}/tests/src/Functional/YourExtensionFunctionalTest.php"
131125
run ahoy test-functional
132126
assert_failure
127+
assert_dir_not_exists "${BUILD_DIR}/build/web/sites/simpletest/browser_output"
133128
}
134129

135130
@test "ahoy test kernel failure" {

.scaffold/tests/bats/make.bats

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,7 @@ export BATS_FIXTURE_EXPORT_CODEBASE_ENABLED=1
8686

8787
make test
8888
assert_success
89-
90-
make test-unit
91-
assert_success
92-
93-
make test-kernel
94-
assert_success
95-
96-
make test-functional
97-
assert_success
89+
assert_dir_exists "${BUILD_DIR}/build/web/sites/simpletest/browser_output"
9890
}
9991

10092
@test "make lint, lint-fix" {
@@ -132,10 +124,13 @@ export BATS_FIXTURE_EXPORT_CODEBASE_ENABLED=1
132124

133125
run make test-functional
134126
assert_success
127+
assert_dir_exists "${BUILD_DIR}/build/web/sites/simpletest/browser_output"
128+
rm -Rf "${BUILD_DIR}/build/web/sites/simpletest/browser_output" || true
135129

136130
sed -i -e "s/responseContains/responseNotContains/g" "${BUILD_DIR}/tests/src/Functional/YourExtensionFunctionalTest.php"
137131
run make test-functional
138132
assert_failure
133+
assert_dir_not_exists "${BUILD_DIR}/build/web/sites/simpletest/browser_output"
139134
}
140135

141136
@test "make test kernel failure" {

README.dist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ vendor/bin/twig-cs-fixer
6969

7070
### Tests
7171

72-
Run `.devtools/test.sh` (or `ahoy test`
72+
Run tests individually with `cd build && ./vendor/bin/phpunit` (or `ahoy test`
7373
if [Ahoy](https://github.com/ahoy-cli/ahoy) is installed) to run all test for
7474
your extension.
7575

0 commit comments

Comments
 (0)