Skip to content

Commit

Permalink
Add PHP 7.2 in CI (#489)
Browse files Browse the repository at this point in the history
* Add PHP 7.2 in CI
* Tests: PHP 7.2 fix
  • Loading branch information
Jean85 authored Oct 9, 2017
1 parent df2b599 commit 5958fdf
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ tools:
php_code_coverage: true
external_code_coverage:
timeout: 2400 # There can be another pull request in progress
runs: 6 # PHP 5.3 + PHP 5.4 + PHP 5.5 + PHP 5.6 + PHP 7.0 + PHP 7.1
runs: 7 # PHP 5.3 + PHP 5.4 + PHP 5.5 + PHP 5.6 + PHP 7.0 + PHP 7.1 + PHP 7.2

build:
environment:
Expand Down
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
language: php
sudo: false
dist: precise

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- nightly
env:
- REMOVE_XDEBUG="0"
Expand Down Expand Up @@ -45,3 +47,4 @@ after_script:
- if [ $(phpenv version-name) = "5.6" ] && [ "$REMOVE_XDEBUG" = "0" ]; then php ocular.phar code-coverage:upload --format=php-clover test/clover.xml --revision=$TRAVIS_COMMIT; fi
- if [ $(phpenv version-name) = "7.0" ] && [ "$REMOVE_XDEBUG" = "0" ]; then php ocular.phar code-coverage:upload --format=php-clover test/clover.xml --revision=$TRAVIS_COMMIT; fi
- if [ $(phpenv version-name) = "7.1" ] && [ "$REMOVE_XDEBUG" = "0" ]; then php ocular.phar code-coverage:upload --format=php-clover test/clover.xml --revision=$TRAVIS_COMMIT; fi
- if [ $(phpenv version-name) = "7.2" ] && [ "$REMOVE_XDEBUG" = "0" ]; then php ocular.phar code-coverage:upload --format=php-clover test/clover.xml --revision=$TRAVIS_COMMIT; fi
41 changes: 31 additions & 10 deletions test/Raven/Tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2030,28 +2030,50 @@ public function test__destruct_calls_close_functions()

/**
* @covers Raven_Client::get_user_data
* @backupGlobals
*/
public function testGet_user_data()
public function testGet_user_data_step1()
{
// step 1
$client = new Dummy_Raven_Client();
$output = $client->get_user_data();
$this->assertInternalType('array', $output);
$this->assertArrayHasKey('user', $output);
$this->assertArrayHasKey('id', $output['user']);
$session_old = $_SESSION;
}

// step 2
/**
* @covers Raven_Client::get_user_data
* @backupGlobals
*/
public function testGet_user_data_step2()
{
if (version_compare(PHP_VERSION, '7.1.999', '>')) {
/**
* @doc https://3v4l.org/OVbja
* @doc https://3v4l.org/uT00O
* @doc https://github.com/php/php-src/blob/316802d8f2b07b863f1596cd804db28a183556e5/NEWS#L87
*/
$this->markTestSkipped('PHP 7.2 does not support clearing session id');
}
$client = new Dummy_Raven_Client();
$session_id = session_id();
session_write_close();
session_id('');
@session_id('');
$output = $client->get_user_data();
session_id($session_id);
$this->assertInternalType('array', $output);
$this->assertEquals(0, count($output));
}

// step 3
session_id($session_id);
@session_start(array('use_cookies' => false, ));
/**
* @covers Raven_Client::get_user_data
* @backupGlobals
*/
public function testGet_user_data_step3()
{
$client = new Dummy_Raven_Client();
@session_start(array('use_cookies' => false));
$_SESSION = array('foo' => 'bar');
$output = $client->get_user_data();
$this->assertInternalType('array', $output);
Expand All @@ -2060,7 +2082,6 @@ public function testGet_user_data()
$this->assertArrayHasKey('data', $output['user']);
$this->assertArrayHasKey('foo', $output['user']['data']);
$this->assertEquals('bar', $output['user']['data']['foo']);
$_SESSION = $session_old;
}

/**
Expand Down Expand Up @@ -2140,15 +2161,15 @@ public function testCaptureNoUserAndRequest()
));
$session_id = session_id();
session_write_close();
session_id('');
@session_id('');
$client->capture(array('user' => '', 'request' => ''));
$events = $client->getSentEvents();
$event = array_pop($events);
$this->assertArrayNotHasKey('user', $event);
$this->assertArrayNotHasKey('request', $event);

// step 3
session_id($session_id);
@session_id($session_id);
@session_start(array('use_cookies' => false, ));
}

Expand Down

0 comments on commit 5958fdf

Please sign in to comment.