Skip to content
43 changes: 27 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,29 @@ language: php
matrix:
fast_finish: true
include:
- php: 5.2
dist: precise
- php: 5.3
dist: precise
- php: 5.4
- php: 5.5
- php: 5.6
env: TEST_COVERAGE=1
- php: 7.0
- php: 7.1
- php: 7.2
- php: 5.2
dist: precise
env: COMPOSER_PHPUNIT=false
- php: 5.3
dist: precise
env: COMPOSER_PHPUNIT=false
- php: 5.4
env: COMPOSER_PHPUNIT=false
- php: 5.5
env: COMPOSER_PHPUNIT=false
- php: 5.6
env: TEST_COVERAGE=1 COMPOSER_PHPUNIT=true
- php: 7.0
env: COMPOSER_PHPUNIT=true
- php: 7.1
env: COMPOSER_PHPUNIT=true
- php: 7.2
env: COMPOSER_PHPUNIT=true
- php: nightly
env: COMPOSER_PHPUNIT=true
allow_failures:
- php: nightly

allow_failures:
- php: nightly
env: COMPOSER_PHPUNIT=true

# Use new container infrastructure
sudo: false
Expand All @@ -30,6 +38,7 @@ cache:
install:
# Setup the test server
- phpenv local $( phpenv versions | grep 5.6 | tail -1 )
- if [ "$COMPOSER_PHPUNIT" == 'false' ]; then composer remove phpunit/phpunit --dev; fi
- composer install --dev --no-interaction
- TESTPHPBIN=$(phpenv which php)
- phpenv local --unset
Expand All @@ -54,10 +63,12 @@ before_script:
- curl -s -I http://requests-php-tests.herokuapp.com/ > /dev/null

# Environment checks
- phpunit --version
- if [ "$COMPOSER_PHPUNIT" == 'false' ]; then phpunit --version; else ../vendor/bin/phpunit --version; fi

script:
- phpunit --coverage-clover clover.xml
- if [ "$COMPOSER_PHPUNIT" == 'false' ]; then phpunit --coverage-clover clover.xml;
else ../vendor/bin/phpunit --coverage-clover clover.xml;
fi

after_script:
- utils/proxy/stop.sh
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"php": ">=5.2"
},
"require-dev": {
"requests/test-server": "dev-master"
"requests/test-server": "dev-master",
"phpunit/phpunit": "<6.0"
},
"type": "library",
"autoload": {
Expand Down
14 changes: 7 additions & 7 deletions tests/Transport/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function setExpectedException( $exception, $message = '', $code = null )
parent::setExpectedException( $exception, $message, $code );
} else {
$this->expectException( $exception );
if ( '' !== $message ) {
if ( null !== $message ) {
$this->expectExceptionMessage( $message );
}
if ( null !== $code ) {
Expand Down Expand Up @@ -414,10 +414,10 @@ public function testStatusCodeThrow($code, $success) {

if (!$success) {
if ($code >= 400) {
$this->setExpectedException('Requests_Exception_HTTP_' . $code, '', $code);
$this->setExpectedException('Requests_Exception_HTTP_' . $code, null, $code);
}
elseif ($code >= 300 && $code < 400) {
$this->setExpectedException('Requests_Exception');
$this->setExpectedException('Requests_Exception', null);
}
}
$request = Requests::get($url, array(), $options);
Expand All @@ -439,7 +439,7 @@ public function testStatusCodeThrowAllowRedirects($code, $success) {

if (!$success) {
if ($code >= 400 || $code === 304 || $code === 305 || $code === 306) {
$this->setExpectedException('Requests_Exception_HTTP_' . $code, '', $code);
$this->setExpectedException('Requests_Exception_HTTP_' . $code, null, $code);
}
}
$request = Requests::get($url, array(), $options);
Expand Down Expand Up @@ -587,16 +587,16 @@ public function testAlternateNameSupport() {
/**
* Test that the transport supports Server Name Indication with HTTPS
*
* feelingrestful.com (owned by hmn.md and used with permission) points to
* CloudFlare, and will fail if SNI isn't sent.
* humanmade.com (owned by Human Made and used with permission) points to
* CloudFront, and will fail if SNI isn't sent.
*/
public function testSNISupport() {
if ($this->skip_https) {
$this->markTestSkipped('SSL support is not available.');
return;
}

$request = Requests::head('https://feelingrestful.com/', array(), $this->getOptions());
$request = Requests::head('https://humanmade.com/', array(), $this->getOptions());
$this->assertEquals(200, $request->status_code);
}

Expand Down