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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 49 additions & 14 deletions integration-tests/LDDFeatureRequesterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i now know that this change is not acceptable. i'm having trouble understanding why it seems to be necessary in my vagrant test-suite. closing this merge request. i'll focus on getting the integration tests to run in CI instead.


apc_delete("launchdarkly:features.foo");
$this->assertEquals("baz", $client->variation('foo', $user, 'jim'));
}

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 ' . $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);
}

}
Expand Down
1 change: 1 addition & 0 deletions integration-tests/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
}
],
"require": {
"monolog/monolog": "1.21.0",
"php": ">=5.3",
"predis/predis": "1.0.*"
},
Expand Down