Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 48 additions & 13 deletions integration-tests/LDDFeatureRequesterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,54 @@ public function testGetApc() {
}

private function gen_feature($key, $val) {
$data = <<<EOF
{"name": "Feature $key", "key": "$key", "kind": "flag", "salt": "Zm9v", "on": true,
"variations": [{"value": "$val", "weight": 100,
"targets": [{"attribute": "key", "op": "in", "values": []}],
"userTarget": {"attribute": "key", "op": "in", "values": []}},
{"value": false, "weight": 0,
"targets": [{"attribute": "key", "op": "in", "values": []}],
"userTarget": {"attribute": "key", "op": "in", "values": []}}],
"commitDate": "2015-09-08T21:24:16.712Z",
"creationDate": "2015-09-08T21:06:16.527Z",
"version": 4}
EOF;
return $data;
$data = [
'name' => 'Feature ' . $key,
'key' => $key,
'kind' => 'flag',
'salt' => 'Zm9v',
'on' => true,
'variations' => [
$val,
false,
],
'commitDate' => '2015-09-08T21:24:16.712Z',
'creationDate' => '2015-09-08T21:06:16.527Z',
'version' => 4,
'prerequisites' => [],
'targets' => [
[
'values' => [
$val,
],
'variation' => 0,
],
[
'values' => [
false,
],
'variation' => 1,
],
],
'rules' => [],
'fallthrough' => [
'rollout' => [
'variations' => [
[
'variation' => 0,
'weight' => 95000,
],
[
'variation' => 1,
'weight' => 5000,
],
],
],
],
'offVariation' => null,
'deleted' => false,
];

return \json_encode($data);
}

}
Expand Down
1 change: 1 addition & 0 deletions integration-tests/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box_url = "https://vagrantcloud.com/ubuntu/boxes/trusty64"

config.vm.provision :shell, path: "bootstrap.sh"
config.vm.provision :shell, path: "bootstrap.user.sh", privileged: false

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
Expand Down
22 changes: 0 additions & 22 deletions integration-tests/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,3 @@ cat <<EOF > /home/vagrant/.vimrc
set tabstop=4
EOF
chown vagrant.vagrant /home/vagrant/.vimrc

su - vagrant
cd ~vagrant
pwd
curl -s -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/bin/phpbrew
phpbrew init
phpbrew known --update
phpbrew update
phpbrew install 5.4.34 +default

echo "source $HOME/.phpbrew/bashrc" >> /home/vagrant/.bashrc
source $HOME/.bashrc
phpbrew switch php-5.4.34
phpbrew ext install apc
echo "apc.enable_cli = 1" >> ~/.phpbrew/php/php-5.4.34/etc/php.ini


cd /home/vagrant/project/integration-tests
curl -sS https://getcomposer.org/installer | php
php composer.phar install
30 changes: 30 additions & 0 deletions integration-tests/bootstrap.user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

echo
echo "install phpbrew and php54"
cd ~
curl -s -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/bin/phpbrew
phpbrew init
phpbrew known --update
phpbrew update
phpbrew install 5.4.34 +default

echo
echo "switch php54"
echo "source $HOME/.phpbrew/bashrc" >> /home/vagrant/.bashrc
source $HOME/.phpbrew/bashrc
phpbrew switch 5.4.34

echo
echo "install php54-apc"
phpbrew ext install apc
echo "apc.enable_cli = 1" >> ~/.phpbrew/php/php-5.4.34/etc/php.ini
echo "date.timezone =UTC" >> ~/.phpbrew/php/php-5.4.34/etc/php.ini

echo
echo "update project dependencies"
cd /home/vagrant/project/integration-tests
curl -sS https://getcomposer.org/installer | php
php composer.phar update
2 changes: 1 addition & 1 deletion src/LaunchDarkly/LDClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function __construct($sdkKey, $options = array()) {
$featureRequesterClass = '\\LaunchDarkly\\GuzzleFeatureRequester';
}

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