Skip to content

Commit 241bca5

Browse files
authored
Merge pull request #62 from abacaphiliac/drop-php54
drop php54 from the integration-test VM
2 parents 208b9f8 + 0a7bd12 commit 241bca5

File tree

8 files changed

+17
-71
lines changed

8 files changed

+17
-71
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
composer.phar
55
.vagrant
66
integration-tests/vendor
7-
integration-tests/composer.lock
7+
composer.lock

circle.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ dependencies:
1515
test:
1616
override:
1717
- vendor/bin/phpunit tests --coverage-text
18-
- ln -s vendor integration-tests/vendor
1918
- vendor/bin/phpunit integration-tests/LDDFeatureRequesterTest.php
2019

2120
- composer update && vendor/bin/phpunit tests

integration-tests/LDDFeatureRequesterTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
<?php
22
namespace LaunchDarkly\Tests;
33

4-
require_once 'vendor/autoload.php';
5-
64
use LaunchDarkly\LDClient;
75
use LaunchDarkly\LDUserBuilder;
6+
use LaunchDarkly\LDDFeatureRequester;
7+
use LaunchDarkly\ApcLDDFeatureRequester;
88
use Predis\Client;
9+
use LaunchDarkly\ApcuLDDFeatureRequester;
910

1011
class LDDFeatureRetrieverTest extends \PHPUnit_Framework_TestCase {
1112

1213
public function testGet() {
13-
$redis = new \Predis\Client(array(
14+
$redis = new Client(array(
1415
"scheme" => "tcp",
1516
"host" => 'localhost',
1617
"port" => 6379));
17-
$client = new LDClient("BOGUS_API_KEY", array('feature_requester_class' => '\\LaunchDarkly\\LDDFeatureRequester'));
18+
$client = new LDClient("BOGUS_API_KEY", array('feature_requester_class' => LDDFeatureRequester::class));
1819
$builder = new LDUserBuilder(3);
1920
$user = $builder->build();
2021

@@ -28,11 +29,11 @@ public function testGetApc() {
2829
if (!extension_loaded('apc')) {
2930
self::markTestSkipped('Install `apc` extension to run this test.');
3031
}
31-
$redis = new \Predis\Client(array(
32+
$redis = new Client(array(
3233
"scheme" => "tcp",
3334
"host" => 'localhost',
3435
"port" => 6379));
35-
$client = new LDClient("BOGUS_API_KEY", array('feature_requester_class' => '\\LaunchDarkly\\ApcLDDFeatureRequester',
36+
$client = new LDClient("BOGUS_API_KEY", array('feature_requester_class' => ApcLDDFeatureRequester::class,
3637
'apc_expiration' => 1));
3738
$builder = new LDUserBuilder(3);
3839
$user = $builder->build();
@@ -62,7 +63,7 @@ public function testGetApcu() {
6263
]);
6364

6465
$client = new LDClient('BOGUS_API_KEY', [
65-
'feature_requester_class' => '\LaunchDarkly\ApcuLDDFeatureRequester',
66+
'feature_requester_class' => ApcuLDDFeatureRequester::class,
6667
'apc_expiration' => 1
6768
]);
6869

integration-tests/bootstrap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ apt-get install -y php-apc 2> /dev/null
2121
apt-get install -y phpunit 2> /dev/null
2222

2323
# phpbrew stuff for 5.4
24-
apt-get build-dep php5 2> /dev/null
24+
apt-get build-dep -y php5 2> /dev/null
2525
apt-get install -y php5 php5-dev php-pear autoconf automake curl build-essential libxslt1-dev re2c libxml2 libxml2-dev php5-cli bison libbz2-dev libreadline-dev 2> /dev/null
2626
apt-get install -y libfreetype6 libfreetype6-dev libpng12-0 libpng12-dev libjpeg-dev libjpeg8-dev libjpeg8 libgd-dev libgd3 libxpm4 libltdl7 libltdl-dev 2> /dev/null
2727
apt-get install -y libssl-dev openssl 2> /dev/null

integration-tests/bootstrap.user.sh

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,8 @@
11
#!/bin/bash
22
set -uxe
33

4-
echo
5-
echo "install phpbrew and php54"
6-
cd ~
7-
curl -s -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
8-
chmod +x phpbrew
9-
sudo mv phpbrew /usr/bin/phpbrew
10-
phpbrew init
11-
phpbrew known --update
12-
phpbrew update
13-
phpbrew install 5.4.34 +default
14-
15-
echo
16-
echo "switch php54"
17-
echo "source $HOME/.phpbrew/bashrc" >> /home/vagrant/.bashrc
18-
source $HOME/.phpbrew/bashrc
19-
phpbrew switch 5.4.34
20-
21-
echo
22-
echo "install php54-apc"
23-
phpbrew ext install apc
24-
echo "apc.enable_cli = 1" >> ~/.phpbrew/php/php-5.4.34/etc/php.ini
25-
php -i | grep apc
26-
echo "date.timezone =UTC" >> ~/.phpbrew/php/php-5.4.34/etc/php.ini
27-
284
echo
295
echo "update project dependencies"
30-
cd /home/vagrant/project/integration-tests
6+
cd /home/vagrant/project
317
curl -sS https://getcomposer.org/installer | php
328
php composer.phar update

integration-tests/composer.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/LaunchDarkly/LDClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ public function __construct($sdkKey, $options = array()) {
8585
if (isset($options['feature_requester_class'])) {
8686
$featureRequesterClass = $options['feature_requester_class'];
8787
} else {
88-
$featureRequesterClass = '\\LaunchDarkly\\GuzzleFeatureRequester';
88+
$featureRequesterClass = GuzzleFeatureRequester::class;
8989
}
9090

91-
if (!is_a($featureRequesterClass, '\LaunchDarkly\FeatureRequester', true)) {
91+
if (!is_a($featureRequesterClass, FeatureRequester::class, true)) {
9292
throw new \InvalidArgumentException;
9393
}
9494
$this->_featureRequester = new $featureRequesterClass($this->_baseUri, $sdkKey, $options);

tests/LDClientTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function testDefaultCtor() {
1717
public function testToggleDefault() {
1818
MockFeatureRequester::$val = null;
1919
$client = new LDClient("someKey", array(
20-
'feature_requester_class' => '\\LaunchDarkly\Tests\\MockFeatureRequester',
20+
'feature_requester_class' => MockFeatureRequester::class,
2121
'events' => false
2222
));
2323

@@ -29,7 +29,7 @@ public function testToggleDefault() {
2929
public function testToggleFromArray() {
3030
MockFeatureRequester::$val = null;
3131
$client = new LDClient("someKey", array(
32-
'feature_requester_class' => '\\LaunchDarkly\Tests\\MockFeatureRequester',
32+
'feature_requester_class' => MockFeatureRequester::class,
3333
'events' => false,
3434
'defaults' => array('foo' => 'fromarray')
3535
));
@@ -42,7 +42,7 @@ public function testToggleFromArray() {
4242
public function testToggleEvent() {
4343
MockFeatureRequester::$val = null;
4444
$client = new LDClient("someKey", array(
45-
'feature_requester_class' => '\\LaunchDarkly\Tests\\MockFeatureRequester',
45+
'feature_requester_class' => MockFeatureRequester::class,
4646
'events' => true
4747
));
4848

@@ -56,7 +56,7 @@ public function testToggleEvent() {
5656

5757
public function testOnlyValidFeatureRequester() {
5858
$this->setExpectedException(InvalidArgumentException::class);
59-
new LDClient("BOGUS_SDK_KEY", ['feature_requester_class' => 'stdClass']);
59+
new LDClient("BOGUS_SDK_KEY", ['feature_requester_class' => \stdClass::class]);
6060
}
6161

6262
public function testSecureModeHash() {

0 commit comments

Comments
 (0)