3
3
source " $( pwd ) /test/utils"
4
4
source " $( pwd ) /test/helpers"
5
5
6
+ # List of modules that we want to ship with every PHP setup.
7
+ # For now, users can't specify a version for these modules, we just ship
8
+ # what we have. Hence no specific versions constraints here.
6
9
readonly default_modules=(
7
10
" apcu" " bcmath" " bz2" " Core" " ctype" " curl" " date" " dom" " exif" " fileinfo"
8
11
" filter" " gd" " hash" " iconv" " intl" " json" " libxml" " mbstring" " mongodb"
@@ -12,50 +15,112 @@ readonly default_modules=(
12
15
" tokenizer" " xml" " xmlreader" " xmlwriter" " xsl" " Zend OPcache" " zip" " zlib"
13
16
)
14
17
15
- test::detect_legacy_default () {
16
- # Test the buildpack detect script with a single simple .php file
17
- test::utils::detect " legacy_default"
18
- test::utils::assertCapturedSuccess
19
- test::utils::assertCapturedEquals " PHP (classic)"
18
+
19
+ test::legacy::defaults () {
20
+ # Test a deployment of a legacy app (not using Composer)
21
+ # With default settings
22
+
23
+ test::helpers::test_deploy " legacy_default" " PHP (classic)" " 8.1."
20
24
}
21
25
22
- test::detect_composer_default () {
23
- test::utils::detect " composer_default"
24
- test::utils::assertCapturedSuccess
25
- test::utils::assertCapturedEquals " PHP (composer.json)"
26
+ test::legacy::php80 () {
27
+ # Test a deployment of a legacy app (not using Composer)
28
+ # Specifying we want PHP 8.0.x via environment
29
+
30
+ PHP_VERSION=" 8.0"
31
+ export PHP_VERSION
32
+
33
+ # PHP 8.0 is only available on stack `scalingo-20`:
34
+ if [[ " ${STACK} " != " scalingo-20" ]]; then
35
+ echo " [skipping] PHP 8.0 is not available on scalingo-22"
36
+ startSkipping
37
+ fi
38
+
39
+ test::helpers::test_deploy " legacy_default" " PHP (classic)" " 8.0."
26
40
}
27
41
28
- test::compile_legacy_default () {
29
- test::helpers::test_compile " legacy_default" " 8.1."
42
+ test::legacy::php81 () {
43
+ # Test a deployment of a legacy app (not using Composer)
44
+ # Specifying we want PHP 8.1.x via environment
45
+
46
+ PHP_VERSION=" 8.1"
47
+ export PHP_VERSION
48
+
49
+ test::helpers::test_deploy " legacy_default" " PHP (classic)" " 8.1."
30
50
}
31
51
32
- test::compile_composer_default () {
33
- test::helpers::test_compile " composer_default" " 8.1."
52
+ test::legacy::php82 () {
53
+ # Test a deployment of a legacy app (not using Composer)
54
+ # Specifying we want PHP 8.2.x via environment
55
+
56
+ PHP_VERSION=" 8.2"
57
+ export PHP_VERSION
58
+
59
+ test::helpers::test_deploy " legacy_default" " PHP (classic)" " 8.2."
34
60
}
35
61
36
- test::compile_composer_php80 () {
37
- test::helpers::test_compile " composer_php80" " 8.0."
62
+ test::legacy::php83 () {
63
+ # Test a deployment of a legacy app (not using Composer)
64
+ # Specifying we want PHP 8.3.x via environment
65
+
66
+ PHP_VERSION=" 8.3"
67
+ export PHP_VERSION
68
+
69
+ test::helpers::test_deploy " legacy_default" " PHP (classic)" " 8.3."
38
70
}
39
71
40
- test::compile_composer_php81 () {
41
- test::helpers::test_compile " composer_php81" " 8.1."
72
+ test::composer::defaults () {
73
+ # Test a deployment of a PHP app using Composer
74
+ # With default settings
75
+
76
+ test::helpers::test_deploy " composer_default" " PHP (composer.json)" " 8.1."
42
77
}
43
78
44
- test::compile_composer_php82 () {
45
- test::helpers::test_compile " composer_php82" " 8.2."
79
+ test::composer::php80 () {
80
+ # Test a deployment of a PHP app using Composer
81
+ # Specifying we want PHP 8.0.x in composer.json
82
+
83
+ # PHP 8.0 is only available on stack `scalingo-20`:
84
+ if [[ " ${STACK} " != " scalingo-20" ]]; then
85
+ echo " [skipping] PHP 8.0 is not available on scalingo-22"
86
+ startSkipping
87
+ fi
88
+
89
+ test::helpers::test_deploy " composer_php80" " PHP (composer.json)" " 8.0."
90
+ }
91
+
92
+ test::composer::php81 () {
93
+ # Test a deployment of a PHP app using Composer
94
+ # Specifying we want PHP 8.1.x in composer.json
95
+
96
+ test::helpers::test_deploy " composer_php81" " PHP (composer.json)" " 8.1."
46
97
}
47
98
48
- test::compile_composer_php83 () {
49
- test::helpers::test_compile " composer_php83" " 8.3."
99
+ test::composer::php82 () {
100
+ # Test a deployment of a PHP app using Composer
101
+ # Specifying we want PHP 8.2.x in composer.json
102
+
103
+ test::helpers::test_deploy " composer_php82" " PHP (composer.json)" " 8.2."
50
104
}
51
105
106
+ test::composer::php83 () {
107
+ # Test a deployment of a PHP app using Composer
108
+ # Specifying we want PHP 8.3.x in composer.json
109
+
110
+ test::helpers::test_deploy " composer_php83" " PHP (composer.json)" " 8.3."
111
+ }
112
+
113
+
52
114
# Add these functions to the test suite:
53
115
54
- suite_addTest test::detect_legacy_default
55
- suite_addTest test::compile_legacy_default
56
- suite_addTest test::detect_composer_default
57
- suite_addTest test::compile_composer_default
58
- suite_addTest test::compile_composer_php80
59
- suite_addTest test::compile_composer_php81
60
- suite_addTest test::compile_composer_php82
61
- suite_addTest test::compile_composer_php83
116
+ suite_addTest test::legacy::defaults
117
+ suite_addTest test::legacy::php80
118
+ suite_addTest test::legacy::php81
119
+ suite_addTest test::legacy::php82
120
+ suite_addTest test::legacy::php83
121
+
122
+ suite_addTest test::composer::defaults
123
+ suite_addTest test::composer::php80
124
+ suite_addTest test::composer::php81
125
+ suite_addTest test::composer::php82
126
+ suite_addTest test::composer::php83
0 commit comments