File tree Expand file tree Collapse file tree 2 files changed +48
-1
lines changed Expand file tree Collapse file tree 2 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ public static function getDecoder() {
5757 $ v ['key ' ],
5858 $ v ['version ' ],
5959 $ v ['on ' ],
60- array_map (Prerequisite::getDecoder (), $ v ['prerequisites ' ]),
60+ array_map (Prerequisite::getDecoder (), $ v ['prerequisites ' ] ?: [] ),
6161 $ v ['salt ' ],
6262 array_map (Target::getDecoder (), $ v ['targets ' ]),
6363 array_map (Rule::getDecoder (), $ v ['rules ' ]),
Original file line number Diff line number Diff line change @@ -140,5 +140,52 @@ public function testDecode() {
140140 FeatureFlag::decode (\GuzzleHttp \json_decode (FeatureFlagTest::$ json1 , true ));
141141 FeatureFlag::decode (\GuzzleHttp \json_decode (FeatureFlagTest::$ json2 , true ));
142142 }
143+
144+ public function dataDecodeMulti ()
145+ {
146+ return [
147+ 'null-prerequisites ' => [
148+ [
149+ 'key ' => 'sysops-test ' ,
150+ 'version ' => 14 ,
151+ 'on ' => true ,
152+ 'prerequisites ' => NULL ,
153+ 'salt ' => 'c3lzb3BzLXRlc3Q= ' ,
154+ 'sel ' => '8ed13de1bfb14507ba7e6dde01f3e035 ' ,
155+ 'targets ' => [
156+ [
157+ 'values ' => [],
158+ 'variation ' => 0 ,
159+ ],
160+ [
161+ 'values ' => [],
162+ 'variation ' => 1 ,
163+ ],
164+ ],
165+ 'rules ' => [],
166+ 'fallthrough ' => [
167+ 'variation ' => 0 ,
168+ ],
169+ 'offVariation ' => NULL ,
170+ 'variations ' => [
171+ true ,
172+ false ,
173+ ],
174+ 'deleted ' => false ,
175+ ]
176+ ],
177+ ];
178+ }
179+
180+ /**
181+ * @dataProvider dataDecodeMulti
182+ * @param array $feature
183+ */
184+ public function testDecodeMulti (array $ feature )
185+ {
186+ $ featureFlag = FeatureFlag::decode ($ feature );
187+
188+ self ::assertInstanceOf (FeatureFlag::class, $ featureFlag );
189+ }
143190}
144191
You can’t perform that action at this time.
0 commit comments