Skip to content

Commit 6bea622

Browse files
authored
Merge pull request php-curl-class#569 from zachborboa/master
Prevent direct execution of test server script
2 parents 4551e28 + 7dd4258 commit 6bea622

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

tests/PHPCurlClass/server.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
// Prevent direct access unless testing.
3+
getenv('PHP_CURL_CLASS_TEST_MODE_ENABLED') === 'yes' || exit;
24

35
require_once 'ContentRangeServer.php';
46
require_once 'RangeHeader.php';

tests/before_script.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ else
4040
fastcgi_pass="127.0.0.1:9000"
4141
fi
4242

43+
# Let test server know we should allow testing.
44+
export PHP_CURL_CLASS_TEST_MODE_ENABLED="yes"
45+
4346
if [[ "${TRAVIS_PHP_VERSION}" == "5.3" ]]; then
4447
if ! [ -x "$(command -v add-apt-repository)" ]; then
4548
$superuser apt-get install -y python-software-properties

tests/run.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ cd "${SCRIPT_DIR}"
33

44
set -x
55

6+
# Let test server know we should allow testing.
7+
export PHP_CURL_CLASS_TEST_MODE_ENABLED="yes"
8+
69
php -S 127.0.0.1:8000 -t PHPCurlClass/ &> /dev/null &
710
pid="${!}"
811
extra_args="${@}"

0 commit comments

Comments
 (0)