File tree Expand file tree Collapse file tree 4 files changed +20
-2
lines changed
functions/helloworld_pubsub Expand file tree Collapse file tree 4 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 11{
22 "require" : {
3+ "php" : " >= 7.4" ,
34 "cloudevents/sdk-php" : " ^1.0" ,
45 "google/cloud-functions-framework" : " ^1.1"
56 },
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ require __DIR__ . '/vendor/autoload.php ' ;
4+
5+ if (count ($ argv ) > 2 ) {
6+ die ('Usage: check_version.php CONSTRAINT ' . PHP_EOL );
7+ }
8+
9+ if ('null ' === $ argv [1 ]) {
10+ // If there is no php constraint, it satisfies
11+ echo '0 ' ;
12+ return ;
13+ }
14+
15+ echo Composer \Semver \Semver::satisfies (PHP_VERSION , $ argv [1 ]) ? '0 ' : '1 ' ;
Original file line number Diff line number Diff line change 88 "google/cloud-tools" : " dev-master" ,
99 "guzzlehttp/guzzle" : " ^7.0" ,
1010 "phpunit/phpunit" : " ^7|^8" ,
11- "friendsofphp/php-cs-fixer" : " ^3.0"
11+ "friendsofphp/php-cs-fixer" : " ^3.0" ,
12+ "composer/semver" : " ^3.2"
1213 }
1314}
Original file line number Diff line number Diff line change 170170 # Generate the lock file (required for check-platform-reqs)
171171 composer update --ignore-platform-reqs
172172 # If the PHP required version is too low, skip the test
173- if composer check-platform-reqs | grep " requires php" | grep failed ; then
173+ EXPLICITLY_SKIPPED=$( php $TESTDIR /check_version.php " $( cat composer.json | jq -r .require.php) " ) ;
174+ if composer check-platform-reqs | grep " requires php" | grep failed && [ " $EXPLICITLY_SKIPPED " -eq " 1" ]; then
174175 echo " Skipping tests in $DIR (incompatible PHP version)"
175176 else
176177 # Run composer without "-q"
You can’t perform that action at this time.
0 commit comments