diff --git a/integration-tests/LDDFeatureRequesterTest.php b/integration-tests/LDDFeatureRequesterTest.php index 602b87717..64ac40eaf 100644 --- a/integration-tests/LDDFeatureRequesterTest.php +++ b/integration-tests/LDDFeatureRequesterTest.php @@ -47,19 +47,54 @@ public function testGetApc() { } private function gen_feature($key, $val) { - $data = << '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); } } diff --git a/integration-tests/Vagrantfile b/integration-tests/Vagrantfile index ff73f459b..5529ac9d3 100644 --- a/integration-tests/Vagrantfile +++ b/integration-tests/Vagrantfile @@ -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, diff --git a/integration-tests/bootstrap.sh b/integration-tests/bootstrap.sh index 3e75fe316..786182dfa 100755 --- a/integration-tests/bootstrap.sh +++ b/integration-tests/bootstrap.sh @@ -35,25 +35,3 @@ cat < /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 diff --git a/integration-tests/bootstrap.user.sh b/integration-tests/bootstrap.user.sh new file mode 100755 index 000000000..60145cb70 --- /dev/null +++ b/integration-tests/bootstrap.user.sh @@ -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 diff --git a/src/LaunchDarkly/LDClient.php b/src/LaunchDarkly/LDClient.php index bc4e96ce7..d2f3551f0 100644 --- a/src/LaunchDarkly/LDClient.php +++ b/src/LaunchDarkly/LDClient.php @@ -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);