install_nginx() { $superuser apt-get install -y nginx } use_php_fpm() { root="$(pwd)/tests/PHPCurlClass" $superuser tee /etc/nginx/sites-enabled/default <expectWarning(/d" "$(pwd)/tests/PHPCurlClass/PHP"* } replace_assertStringContainsString() { # -->assertStringContainsString( # +->assertContains( find='->assertStringContainsString(' replace='->assertContains(' sed -i'' -e"s/${find}/${replace}/" "$(pwd)/tests/PHPCurlClass/PHP"* } phpunit_v4_8_shim() { replace_assertStringContainsString } phpunit_v6_5_shim() { remove_expectWarning replace_assertStringContainsString } phpunit_v7_5_shim() { remove_expectWarning } start_php_servers() { for i in $(seq 0 6); do port=8000 (( port += $i )) php -S "127.0.0.1:${port}" -t tests/PHPCurlClass/ & done } set -x echo "TRAVIS_PHP_VERSION: ${TRAVIS_PHP_VERSION}" php -r "var_dump(phpversion());" php -r "var_dump(curl_version());" composer self-update composer install --prefer-source --no-interaction # Use docker-specific settings. if [ -f "/.dockerenv" ]; then # Skip using sudo. superuser="" # Use unix socket. fastcgi_pass="unix:/var/run/php5-fpm.sock" else # Use sudo. superuser="sudo" # Use ip socket. fastcgi_pass="127.0.0.1:9000" fi # Let test server know we should allow testing. export PHP_CURL_CLASS_TEST_MODE_ENABLED="yes" if [[ "${TRAVIS_PHP_VERSION}" == "5.3" ]]; then if ! [ -x "$(command -v add-apt-repository)" ]; then $superuser apt-get install -y python-software-properties $superuser apt-get install -y software-properties-common fi $superuser add-apt-repository -y ppa:nginx/development $superuser apt-get update install_nginx $superuser apt-get install -y php5-fpm root="$(pwd)/tests/PHPCurlClass" $superuser tee /etc/nginx/sites-enabled/default <