Skip to content

Commit bf1c5b2

Browse files
rashidspmikeproeng37
authored andcommitted
Get enabled features: Removes sorting (#103)
1 parent 411c9a8 commit bf1c5b2

File tree

2 files changed

+0
-47
lines changed

2 files changed

+0
-47
lines changed

src/Optimizely/Optimizely.php

-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,6 @@ public function getEnabledFeatures($userId, $attributes = null)
542542
}
543543
}
544544

545-
sort($enabledFeatureKeys);
546545
return $enabledFeatureKeys;
547546
}
548547

tests/OptimizelyTest.php

-46
Original file line numberDiff line numberDiff line change
@@ -2248,52 +2248,6 @@ public function testGetEnabledFeaturesGivenFeaturesAreEnabledForUser()
22482248
);
22492249
}
22502250

2251-
public function testGetEnabledFeaturesReturnsSortedFeatureKeys()
2252-
{
2253-
$optimizelyMock = $this->getMockBuilder(Optimizely::class)
2254-
->setConstructorArgs(array($this->datafile))
2255-
->setMethods(array('isFeatureEnabled'))
2256-
->getMock();
2257-
2258-
// Mock isFeatureEnabled and assert that isFeatureEnabled does get called in an unsorted order
2259-
$optimizelyMock->expects($this->at(0))
2260-
->method('isFeatureEnabled')
2261-
->with('boolean_feature', 'user_id', [])
2262-
->willReturn(true);
2263-
$optimizelyMock->expects($this->at(1))
2264-
->method('isFeatureEnabled')
2265-
->with('double_single_variable_feature', 'user_id', [])
2266-
->willReturn(true);
2267-
$optimizelyMock->expects($this->at(2))
2268-
->method('isFeatureEnabled')
2269-
->with('integer_single_variable_feature', 'user_id', [])
2270-
->willReturn(true);
2271-
$optimizelyMock->expects($this->at(3))
2272-
->method('isFeatureEnabled')
2273-
->with('boolean_single_variable_feature', 'user_id', [])
2274-
->willReturn(true);
2275-
$optimizelyMock->expects($this->at(4))
2276-
->method('isFeatureEnabled')
2277-
->with('string_single_variable_feature', 'user_id', [])
2278-
->willReturn(true);
2279-
$optimizelyMock->expects($this->at(5))
2280-
->method('isFeatureEnabled')
2281-
->with('multi_variate_feature', 'user_id', [])
2282-
->willReturn(true);
2283-
2284-
$this->assertEquals(
2285-
[
2286-
'boolean_feature',
2287-
'boolean_single_variable_feature',
2288-
'double_single_variable_feature',
2289-
'integer_single_variable_feature',
2290-
'multi_variate_feature',
2291-
'string_single_variable_feature'
2292-
],
2293-
$optimizelyMock->getEnabledFeatures("user_id", [])
2294-
);
2295-
}
2296-
22972251
public function testGetEnabledFeaturesWithUserAttributes()
22982252
{
22992253
$optimizelyMock = $this->getMockBuilder(Optimizely::class)

0 commit comments

Comments
 (0)