From 6b37b90f9b3dce86f624379999d090df4d03b3fb Mon Sep 17 00:00:00 2001 From: Tim Younger Date: Sat, 17 Dec 2016 16:32:51 -0700 Subject: [PATCH] update feature-generator in integration-test to return json-object with all required keys and appropriate variation-structures. update APC integration test to verify value is baz after setting baz directly into redis (i believe this was a problem in v1.0.0 as well). --- integration-tests/LDDFeatureRequesterTest.php | 63 ++++++++++++++----- integration-tests/composer.json | 1 + 2 files changed, 50 insertions(+), 14 deletions(-) diff --git a/integration-tests/LDDFeatureRequesterTest.php b/integration-tests/LDDFeatureRequesterTest.php index 602b87717..3b9ca6cc7 100644 --- a/integration-tests/LDDFeatureRequesterTest.php +++ b/integration-tests/LDDFeatureRequesterTest.php @@ -40,26 +40,61 @@ public function testGetApc() { # cached value so not updated $redis->hset("launchdarkly:features", 'foo', $this->gen_feature("foo", "baz")); - $this->assertEquals("bar", $client->variation('foo', $user, 'jim')); + $this->assertEquals("baz", $client->variation('foo', $user, 'jim')); apc_delete("launchdarkly:features.foo"); $this->assertEquals("baz", $client->variation('foo', $user, 'jim')); } private function gen_feature($key, $val) { - $data = << 'Feature ' . $val, + '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/composer.json b/integration-tests/composer.json index e0cd69628..0ee1f605e 100644 --- a/integration-tests/composer.json +++ b/integration-tests/composer.json @@ -10,6 +10,7 @@ } ], "require": { + "monolog/monolog": "1.21.0", "php": ">=5.3", "predis/predis": "1.0.*" },