Skip to content

Commit ad69e52

Browse files
authored
Add strategy as configuration option (#102)
* derekparnell-20220603-add-strategy-yml-config-option Added the strategy configuration option to the possible yml configuration settings. * derekparnell-20220603-add-strategy-yml-config-option Added the strategy configuration option to the possible yml configuration settings. Added a unit test to verify it configures the toggles with the unanimous strategy. * derekparnell-20220603-add-strategy-yml-config-option Removed the strategy configuration option from the condition.
1 parent 4eb6b6d commit ad69e52

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

DependencyInjection/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function getConfigTreeBuilder()
5656
->prototype('array')
5757
->children()
5858
->scalarNode('name')->end()
59+
->scalarNode('strategy')->end()
5960
->scalarNode('status')->end()
6061
->arrayNode('conditions')
6162
->prototype('array')

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,72 @@ public function it_configures_toggles_with_inset_operator()
199199
);
200200
}
201201

202+
/**
203+
* @test
204+
*/
205+
public function it_configures_toggles_with_unanimous_strategy()
206+
{
207+
$this->assertProcessedConfigurationEquals(
208+
[
209+
[
210+
'toggles' => [
211+
'conditionally-active' => [
212+
'name' => 'conditionally-active',
213+
'status' => 'conditionally-active',
214+
'strategy' => 'unanimous',
215+
'conditions' => [
216+
[
217+
'name' => 'operator-condition',
218+
'key' => 'env',
219+
'operator' => [
220+
'name' => 'in-set',
221+
'values' => ['dev'],
222+
],
223+
],
224+
[
225+
'name' => 'operator-condition',
226+
'key' => 'roles',
227+
'operator' => [
228+
'name' => 'has-intersection',
229+
'values' => ['ROLE_SOME_ROLE'],
230+
],
231+
],
232+
],
233+
],
234+
],
235+
],
236+
],
237+
[
238+
'toggles' => [
239+
'conditionally_active' => [
240+
'name' => 'conditionally-active',
241+
'status' => 'conditionally-active',
242+
'strategy' => 'unanimous',
243+
'conditions' => [
244+
[
245+
'name' => 'operator-condition',
246+
'key' => 'env',
247+
'operator' => [
248+
'name' => 'in-set',
249+
'values' => ['dev'],
250+
],
251+
],
252+
[
253+
'name' => 'operator-condition',
254+
'key' => 'roles',
255+
'operator' => [
256+
'name' => 'has-intersection',
257+
'values' => ['ROLE_SOME_ROLE'],
258+
],
259+
],
260+
],
261+
],
262+
],
263+
],
264+
'toggles'
265+
);
266+
}
267+
202268
/**
203269
* @test
204270
*/

0 commit comments

Comments
 (0)