Skip to content

Commit 92a2699

Browse files
committed
refactor integration-test feature-generator to match v2 feature structure, e.g. \LaunchDarkly\Tests\FeatureFlagTest::$json1 and \LaunchDarkly\Tests\FeatureFlagTest::$json2.
1 parent 373d43f commit 92a2699

File tree

1 file changed

+48
-13
lines changed

1 file changed

+48
-13
lines changed

integration-tests/LDDFeatureRequesterTest.php

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,54 @@ public function testGetApc() {
4747
}
4848

4949
private function gen_feature($key, $val) {
50-
$data = <<<EOF
51-
{"name": "Feature $key", "key": "$key", "kind": "flag", "salt": "Zm9v", "on": true,
52-
"variations": [{"value": "$val", "weight": 100,
53-
"targets": [{"attribute": "key", "op": "in", "values": []}],
54-
"userTarget": {"attribute": "key", "op": "in", "values": []}},
55-
{"value": false, "weight": 0,
56-
"targets": [{"attribute": "key", "op": "in", "values": []}],
57-
"userTarget": {"attribute": "key", "op": "in", "values": []}}],
58-
"commitDate": "2015-09-08T21:24:16.712Z",
59-
"creationDate": "2015-09-08T21:06:16.527Z",
60-
"version": 4}
61-
EOF;
62-
return $data;
50+
$data = [
51+
'name' => 'Feature ' . $key,
52+
'key' => $key,
53+
'kind' => 'flag',
54+
'salt' => 'Zm9v',
55+
'on' => true,
56+
'variations' => [
57+
$val,
58+
false,
59+
],
60+
'commitDate' => '2015-09-08T21:24:16.712Z',
61+
'creationDate' => '2015-09-08T21:06:16.527Z',
62+
'version' => 4,
63+
'prerequisites' => [],
64+
'targets' => [
65+
[
66+
'values' => [
67+
$val,
68+
],
69+
'variation' => 0,
70+
],
71+
[
72+
'values' => [
73+
false,
74+
],
75+
'variation' => 1,
76+
],
77+
],
78+
'rules' => [],
79+
'fallthrough' => [
80+
'rollout' => [
81+
'variations' => [
82+
[
83+
'variation' => 0,
84+
'weight' => 95000,
85+
],
86+
[
87+
'variation' => 1,
88+
'weight' => 5000,
89+
],
90+
],
91+
],
92+
],
93+
'offVariation' => null,
94+
'deleted' => false,
95+
];
96+
97+
return \json_encode($data);
6398
}
6499

65100
}

0 commit comments

Comments
 (0)