-
Notifications
You must be signed in to change notification settings - Fork 30
feat: datafile accessor #211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: datafile accessor #211
Conversation
@ozayr-zaviar can you take care of signing our CLA mentioned in the CONTRIBUTING document? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address.
@@ -159,4 +159,11 @@ public function getFeatureVariableFromKey($featureFlagKey, $variableKey); | |||
* @return boolean A boolean value that indicates if the experiment is a feature test. | |||
*/ | |||
public function isFeatureExperiment($experimentId); | |||
|
|||
/** | |||
* Determines if given experiment is a feature test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. Fix this docstring
@@ -63,6 +68,7 @@ public function __construct(ProjectConfigInterface $projectConfig) | |||
$this->experiments = $projectConfig->getAllExperiments(); | |||
$this->featureFlags = $projectConfig->getFeatureFlags(); | |||
$this->revision = $projectConfig->getRevision(); | |||
$this->datafile = $$projectConfig->toDatafile(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit $$
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You haven't passed datafile to new OptimizelyConfig below
private $datafile; | ||
|
||
|
||
public function __construct($revision, array $experimentsMap, array $featuresMap, $datafile = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not provide a default null for datafile.
@@ -14,709 +14,464 @@ | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
|
|||
namespace Optimizely\Tests; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix this file. This should only show diff of the new unit test you have added.
public function testGetDatafile() | ||
{ | ||
$expectedDatafile = DATAFILE_FOR_OPTIMIZELY_CONFIG; | ||
$actualDatafile = $this->optConfigService->getDatafile(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getDatafile() has been defined for OptimizelyConfig, not OptimizelyConfigService.
@msohailhussain Testapp PR should be merged to get FSC passed https://github.com/optimizely/php-testapp/pull/65 |
/** | ||
* @var string datafile. | ||
*/ | ||
private $datafile; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be $_datafile?
/** | ||
* @var string Contents of datafile. | ||
*/ | ||
private $datafile; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private $datafile; | ||
|
||
|
||
public function __construct($revision, array $experimentsMap, array $featuresMap, $datafile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't it break existing functionality?
@@ -31,7 +31,8 @@ public function testOptimizelyConfigEntity() | |||
$optConfig = new OptimizelyConfig( | |||
"20", | |||
["a" => "apple"], | |||
["o" => "orange"] | |||
["o" => "orange"], | |||
null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this shouldn't be changed.
@@ -41,7 +42,8 @@ public function testOptimizelyConfigEntity() | |||
$expectedJson = '{ | |||
"revision": "20", | |||
"experimentsMap" : {"a": "apple"}, | |||
"featuresMap": {"o": "orange"} | |||
"featuresMap": {"o": "orange"}, | |||
"datafile": null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Approving assuming my variable name suggestion will be incorporated before merge.
/** | ||
* @var string datafile. | ||
*/ | ||
private $datafile; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be $_datafile
to be consistent with other private variable conventions. @oakbani ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the privacy convention has changed. I think @oakbani had showed me that previously. See: https://www.php-fig.org/psr/psr-12/#43-properties-and-constants
@@ -37,6 +37,11 @@ class OptimizelyConfigService | |||
*/ | |||
private $revision; | |||
|
|||
/** | |||
* @var string config datafile. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. @var string String denoting datafile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Summary
Test plan
https://travis-ci.com/github/optimizely/fullstack-sdk-compatibility-suite/builds/181695026