|
3 | 3 | source "$( pwd )/test/utils"
|
4 | 4 | source "$( pwd )/test/helpers"
|
5 | 5 |
|
6 |
| -test::detect_legacy_default() { |
7 |
| - # Test the buildpack detect script with a single simple .php file |
8 |
| - test::utils::detect "legacy_default" |
9 |
| - test::utils::assertCapturedSuccess |
10 |
| - test::utils::assertCapturedEquals "PHP (classic)" |
| 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. |
| 9 | +readonly default_modules=( |
| 10 | + "apcu" "bcmath" "bz2" "Core" "ctype" "curl" "date" "dom" "exif" "fileinfo" |
| 11 | + "filter" "gd" "hash" "iconv" "intl" "json" "libxml" "mbstring" "mongodb" |
| 12 | + "mysqli" "mysqlnd" "openssl" "pcntl" "pcre" "PDO" "pdo_mysql" "pdo_pgsql" |
| 13 | + "pdo_sqlite" "pgsql" "Phar" "posix" "readline" "redis" "Reflection" |
| 14 | + "session" "shmop" "SimpleXML" "soap" "sockets" "SPL" "sqlite3" "standard" |
| 15 | + "tokenizer" "xml" "xmlreader" "xmlwriter" "xsl" "Zend OPcache" "zip" "zlib" |
| 16 | +) |
| 17 | + |
| 18 | + |
| 19 | +test::classic::defaults() { |
| 20 | + # Test a deployment of a classic app (not using Composer) |
| 21 | + # With default settings |
| 22 | + |
| 23 | + test::helpers::test_deploy "classic_default" "PHP (classic)" "8.1." |
11 | 24 | }
|
12 | 25 |
|
13 |
| -test::compile_legacy_default() { |
14 |
| - # Test the buildpack compile script with a single simple .php file |
15 |
| - test::utils::compile "legacy_default" |
16 |
| - test::utils::assertCapturedSuccess |
| 26 | +test::classic::php80() { |
| 27 | + # Test a deployment of a classic app (not using Composer) |
| 28 | + # Specifying we want PHP 8.0.x via environment |
17 | 29 |
|
18 |
| - test::utils::resetCapture |
| 30 | + PHP_VERSION="8.0" |
| 31 | + export PHP_VERSION |
19 | 32 |
|
20 |
| - test::helpers::get_php_version |
21 |
| - test::utils::assertCapturedStartswith "PHP 8.1." |
| 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 "classic_default" "PHP (classic)" "8.0." |
22 | 40 | }
|
23 | 41 |
|
24 |
| -test::detect_composer_default() { |
25 |
| - test::utils::detect "composer_default" |
26 |
| - test::utils::assertCapturedSuccess |
27 |
| - test::utils::assertCapturedEquals "PHP (composer.json)" |
| 42 | +test::classic::php81() { |
| 43 | + # Test a deployment of a classic 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 "classic_default" "PHP (classic)" "8.1." |
28 | 50 | }
|
29 | 51 |
|
30 |
| -test::compile_composer_default() { |
31 |
| - test::utils::compile "composer_default" |
32 |
| - # We can't use assertCapturedSuccess here: |
33 |
| - # Even with an empty composer.json file, composer will use stderr to warn |
34 |
| - # us that nothing had to be installed, causing the test to fail for no |
35 |
| - # reason -_- |
36 |
| - test::utils::assertSuccess |
| 52 | +test::classic::php82() { |
| 53 | + # Test a deployment of a classic app (not using Composer) |
| 54 | + # Specifying we want PHP 8.2.x via environment |
37 | 55 |
|
38 |
| - test::utils::resetCapture |
| 56 | + PHP_VERSION="8.2" |
| 57 | + export PHP_VERSION |
39 | 58 |
|
40 |
| - test::helpers::get_php_version |
41 |
| - test::utils::assertCapturedStartswith "PHP 8.1." |
| 59 | + test::helpers::test_deploy "classic_default" "PHP (classic)" "8.2." |
42 | 60 | }
|
43 | 61 |
|
44 |
| -test::compile_composer_php80() { |
45 |
| - # PHP 8.0 is only available on stack `scalingo-20`: |
46 |
| - [[ "${STACK}" != "scalingo-20" ]] && startSkipping |
| 62 | +test::classic::php83() { |
| 63 | + # Test a deployment of a classic app (not using Composer) |
| 64 | + # Specifying we want PHP 8.3.x via environment |
| 65 | + |
| 66 | + PHP_VERSION="8.3" |
| 67 | + export PHP_VERSION |
47 | 68 |
|
48 |
| - test::utils::compile "composer_php80" |
49 |
| - test::utils::assertSuccess |
| 69 | + test::helpers::test_deploy "classic_default" "PHP (classic)" "8.3." |
| 70 | +} |
50 | 71 |
|
51 |
| - test::utils::resetCapture |
| 72 | +test::composer::defaults() { |
| 73 | + # Test a deployment of a PHP app using Composer |
| 74 | + # With default settings |
52 | 75 |
|
53 |
| - test::helpers::get_php_version |
54 |
| - test::utils::assertCapturedSuccess |
55 |
| - test::utils::assertCapturedStartswith "PHP 8.0." |
| 76 | + test::helpers::test_deploy "composer_default" "PHP (composer.json)" "8.1." |
56 | 77 | }
|
57 | 78 |
|
58 |
| -test::compile_composer_php81() { |
59 |
| - test::utils::compile "composer_php81" |
60 |
| - test::utils::assertSuccess |
61 |
| - test::utils::resetCapture |
| 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 |
62 | 82 |
|
63 |
| - test::helpers::get_php_version |
64 |
| - test::utils::assertCapturedSuccess |
65 |
| - test::utils::assertCapturedStartswith "PHP 8.1." |
| 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." |
66 | 97 | }
|
67 | 98 |
|
68 |
| -test::compile_composer_php82() { |
69 |
| - test::utils::compile "composer_php82" |
70 |
| - test::utils::assertSuccess |
71 |
| - test::utils::resetCapture |
| 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 |
72 | 102 |
|
73 |
| - test::helpers::get_php_version |
74 |
| - test::utils::assertCapturedSuccess |
75 |
| - test::utils::assertCapturedStartswith "PHP 8.2." |
| 103 | + test::helpers::test_deploy "composer_php82" "PHP (composer.json)" "8.2." |
76 | 104 | }
|
77 | 105 |
|
78 |
| -test::compile_composer_php83() { |
79 |
| - test::utils::compile "composer_php83" |
80 |
| - test::utils::assertSuccess |
81 |
| - test::utils::resetCapture |
| 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 |
82 | 109 |
|
83 |
| - test::helpers::get_php_version |
84 |
| - test::utils::assertCapturedSuccess |
85 |
| - test::utils::assertCapturedStartswith "PHP 8.3." |
| 110 | + test::helpers::test_deploy "composer_php83" "PHP (composer.json)" "8.3." |
86 | 111 | }
|
87 | 112 |
|
| 113 | + |
88 | 114 | # Add these functions to the test suite:
|
89 | 115 |
|
90 |
| -suite_addTest test::detect_legacy_default |
91 |
| -suite_addTest test::compile_legacy_default |
92 |
| -suite_addTest test::detect_composer_default |
93 |
| -suite_addTest test::compile_composer_default |
94 |
| -suite_addTest test::compile_composer_php80 |
95 |
| -suite_addTest test::compile_composer_php81 |
96 |
| -suite_addTest test::compile_composer_php82 |
97 |
| -suite_addTest test::compile_composer_php83 |
| 116 | +suite_addTest test::classic::defaults |
| 117 | +suite_addTest test::classic::php80 |
| 118 | +suite_addTest test::classic::php81 |
| 119 | +suite_addTest test::classic::php82 |
| 120 | +suite_addTest test::classic::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