Skip to content

Commit 4217951

Browse files
committed
apply suggestions from code review
1 parent 777c2a3 commit 4217951

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

test/helpers

+35-28
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
### Helpers functions
44

5-
test::helpers::classic_deploy() {
6-
# Deploys a classic PHP app step by step and tests that everything is
7-
# working as expected.
5+
test::helpers::common_deploy() {
6+
# Deploys a PHP app step by step and tests that everything related to the
7+
# PHP setup is as expected.
88
# To do so, this function runs the buildpack scripts and mimicks the
99
# platform behavior wherever needed.
1010
#
@@ -13,17 +13,17 @@ test::helpers::classic_deploy() {
1313
# default_modules
1414
#
1515
# Arguments:
16-
# $1 > $php_version
17-
# See `test::helpers::php`.
16+
# $1 > $detect_expectation
17+
# See `test::helpers::detect`.
1818
#
19-
# $2 > $nginx_version
20-
# See `test::helpers::nginx`
19+
# $2 > $php_version
20+
# See `test::helpers::php`.
2121

22-
local php_version="${1}"
23-
local nginx_version="${2}"
22+
local detect_expectation="${1}"
23+
local php_version="${2}"
2424

2525
# Test bin/detect:
26-
test::helpers::detect "PHP (classic)"
26+
test::helpers::detect "${detect_expectation}"
2727

2828
# Test bin/compile:
2929
test::helpers::compile
@@ -36,6 +36,28 @@ test::helpers::classic_deploy() {
3636

3737
# Test PHP default modules:
3838
test::helpers::default_php_modules
39+
}
40+
41+
test::helpers::classic_deploy() {
42+
# Deploys a classic PHP app step by step and tests that everything is
43+
# working as expected, including the Nginx version.
44+
#
45+
# Globals:
46+
# STD_OUT
47+
# default_modules
48+
#
49+
# Arguments:
50+
# $1 > $php_version
51+
# See `test::helpers::php`.
52+
#
53+
# $2 > $nginx_version
54+
# See `test::helpers::nginx`
55+
56+
local php_version="${1}"
57+
local nginx_version="${2}"
58+
59+
# Test everything related to PHP:
60+
test::helpers::common_deploy "PHP (classic)" "${php_version}"
3961

4062
# Test Nginx version:
4163
test::helpers::nginx "${nginx_version}"
@@ -45,10 +67,7 @@ test::helpers::classic_deploy() {
4567

4668
test::helpers::composer_deploy() {
4769
# Deploys a Composer PHP app step by step and tests that everything is
48-
# working as expected.
49-
# To do so, this function runs the buildpack scripts and mimicks the
50-
# platform behavior wherever needed.
51-
# The different fixtures allow us to test different setup and conditions.
70+
# working as expected, including the Nginx and the Composer versions.
5271
#
5372
# Globals:
5473
# STD_OUT
@@ -68,20 +87,8 @@ test::helpers::composer_deploy() {
6887
local nginx_version="${2}"
6988
local composer_version="${3}"
7089

71-
# Test bin/detect:
72-
test::helpers::detect "PHP (composer.json)"
73-
74-
# Test bin/compile:
75-
test::helpers::compile
76-
77-
# Switch environment:
78-
test::helpers::enter_prod
79-
80-
# Test PHP version:
81-
test::helpers::php "${php_version}"
82-
83-
# Test default PHP defaults modules:
84-
test::helpers::default_php_modules
90+
# Test everything related to PHP:
91+
test::helpers::common_deploy "PHP (composer.json)" "${php_version}"
8592

8693
# Test Nginx version:
8794
test::helpers::nginx "${nginx_version}"

0 commit comments

Comments
 (0)