Skip to content

Commit 8aaa01b

Browse files
committed
chore(tests): add comments to functions
1 parent dacff0d commit 8aaa01b

File tree

2 files changed

+357
-59
lines changed

2 files changed

+357
-59
lines changed

test/helpers

+40-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,41 @@
33
### Helpers functions
44

55
test::helpers::test_deploy() {
6-
# Deploy a PHP app in a Scalingo runtime and test that everything is as
7-
# expected. The different fixtures allow us to test different setup and
8-
# conditions.
6+
# Deploys a PHP app step by step and tests that everything is working as
7+
# expected.
8+
# To do so, this function runs the buildpack scripts and mimicks the
9+
# platform behavior wherever needed.
10+
# The different fixtures allow us to test different setup and conditions.
11+
#
12+
# Globals:
13+
# STD_OUT
14+
# default_modules
15+
#
16+
# Arguments:
17+
# $1 > $fixture_name: Name of the fixture to deploy.
18+
# The fixture sets the deployment conditions.
19+
# In fact, this is the name of a directory that must exist in
20+
# `BUILDPACK_DIR/test/fixtures/` and that contains the fixture code.
21+
# See `test::utils::setupFixture` for more details.
22+
#
23+
# $2 > $detect_expectation: Expected output of `bin/compile`.
24+
# The value of this variable is compared to the actual output of the
25+
# `bin/detect` script (and should match).
26+
#
27+
# $3 > $version: Expected version of PHP.
28+
# The value of this variable is compared to the version of PHP
29+
# that has actually been installed by the buildpack.
30+
# PHP version numbers follow the semver standard (i.e.
31+
# `maj.min.patch`).
32+
# Consequently, to test that PHP 8 is installed, one must set this
33+
# variable value to `8.` (notice the ending `.`) to make sure the test
34+
# fails if any other version starting with a `8` is installed (for
35+
# example, PHP `80.1.0`).
36+
# The logic is the same with minor version: to test that PHP 8.2 is
37+
# installed, set this variable to `8.2.` to make sure the test fails
38+
# if PHP 8.20.1 is installed, for example.
39+
# To test a full version, please add a trailing space, i.e. `8.1.15␣`,
40+
# so that `8.1.156` doesn't make the test pass.
941

1042
local fixture_name="${1}"
1143
local detect_expectation="${2}"
@@ -70,6 +102,11 @@ test::helpers::enter_prod() {
70102
# /!\ This function is meant to be called after a successful call to
71103
# to `test::utils::compile` to further test the result of the
72104
# bin/compile call. It makes no sense to call it in another context.
105+
#
106+
# Globals:
107+
# HOME
108+
# PREV_HOME
109+
# BUILD_DIR
73110

74111
PREV_HOME="${HOME}"
75112
export PREV_HOME

0 commit comments

Comments
 (0)