File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
src/LaunchDarkly/Integrations Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ public function update(FlagBuilder $flagBuilder): TestData
110
110
111
111
$ oldFlag = $ this ->_currentFlags [$ key ] ?? null ;
112
112
if ($ oldFlag ) {
113
- $ oldVersion = $ oldFlag[ ' version ' ] ;
113
+ $ oldVersion = $ oldFlag-> getVersion () ;
114
114
}
115
115
116
116
$ newFlag = $ flagBuilder ->build ($ oldVersion + 1 );
Original file line number Diff line number Diff line change @@ -430,6 +430,37 @@ public function testCanSetAndGetFeatureFlag()
430
430
$ this ->assertEquals ($ expectedFeatureFlag , $ featureFlag );
431
431
}
432
432
433
+ public function testCanSetAndResetFeatureFlag ()
434
+ {
435
+ $ key = 'test-flag ' ;
436
+ $ expectedUpdatedFlagJson = [
437
+ 'key ' => $ key ,
438
+ 'version ' => 2 ,
439
+ 'deleted ' => false ,
440
+ 'on ' => true ,
441
+ 'targets ' => [],
442
+ 'rules ' => [],
443
+ 'offVariation ' => 1 ,
444
+ 'fallthrough ' => ['variation ' => 2 ],
445
+ 'variations ' => ['red ' , 'amber ' , 'green ' ],
446
+
447
+ /* Required FeatureFlag fields */
448
+ 'salt ' => null ,
449
+ 'prerequisites ' => [],
450
+ ];
451
+ $ expectedUpdatedFeatureFlag = FeatureFlag::decode ($ expectedUpdatedFlagJson );
452
+
453
+ $ td = new TestData ();
454
+ $ flag = $ td ->flag ($ key );
455
+ $ td ->update ($ flag );
456
+
457
+ $ updatedFlag = $ flag ->variations ('red ' , 'amber ' , 'green ' )->fallthroughVariation (2 );
458
+ $ td ->update ($ updatedFlag );
459
+
460
+ $ featureFlag = $ td ->getFeature ($ key );
461
+ $ this ->assertEquals ($ expectedUpdatedFeatureFlag , $ featureFlag );
462
+ }
463
+
433
464
public function testFlagBuilderCanAddAndBuildRules ()
434
465
{
435
466
$ td = new TestData ();
You can’t perform that action at this time.
0 commit comments