Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/optimizely/master' into Feature…
Browse files Browse the repository at this point in the history
…Flag&Rollouts-newAPIs

# Conflicts:
#	tests/DecisionServiceTests/DecisionServiceTest.php
  • Loading branch information
oakbani committed Nov 15, 2017
2 parents 377dae7 + afa7a55 commit efeaa82
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions tests/DecisionServiceTests/DecisionServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ public function testGetVariationForFeatureExperimentGivenNullExperimentIds()

$this->assertSame(
null,
$this->decisionService->getVariationForFeatureExperiment($feature_flag, 'user1', [])
$this->decisionService->getVariationForFeatureExperiment($feature_flag, 'user1', [])
);
}

Expand All @@ -642,7 +642,7 @@ public function testGetVariationForFeatureExperimentGivenExperimentNotInDataFile
);

$this->assertSame(
null,
null,
$this->decisionService->getVariationForFeatureExperiment($feature_flag, 'user1', [])
);
}
Expand Down Expand Up @@ -759,10 +759,11 @@ public function testGetVariationForFeatureWhenTheUserIsBucketedIntoFeatureExperi
$expected_experiment_id = $feature_flag->getExperimentIds()[0];
$expected_experiment = $this->config->getExperimentFromId($expected_experiment_id);
$expected_variation = $expected_experiment->getVariations()[0];
$expected_decision = [
'experiment' => $expected_experiment,
'variation' => $expected_variation
];
$expected_decision = new FeatureDecision(
$expected_experiment->getId(),
$expected_variation->getId(),
FeatureDecision::DECISION_SOURCE_EXPERIMENT
);

$decisionServiceMock->expects($this->at(0))
->method('getVariationForFeatureExperiment')
Expand All @@ -788,7 +789,10 @@ public function testGetVariationForFeatureWhenBucketedToFeatureRollout()
$experiment = $rollout->getExperiments()[0];
$expected_variation = $experiment->getVariations()[0];
$expected_decision = new FeatureDecision(
$experiment->getId(), $expected_variation->getId(), FeatureDecision::DECISION_SOURCE_ROLLOUT);
$experiment->getId(),
$expected_variation->getId(),
FeatureDecision::DECISION_SOURCE_ROLLOUT
);


$decisionServiceMock
Expand Down Expand Up @@ -878,7 +882,7 @@ public function testGetVariationForFeatureRolloutWhenRolloutIsNotInDataFile()
);

$this->assertEquals(
null,
null,
$this->decisionServiceMock->getVariationForFeatureRollout($feature_flag, 'user_1', [])
);
}
Expand Down Expand Up @@ -921,7 +925,10 @@ public function testGetVariationForFeatureRolloutWhenUserIsBucketedInTheTargetin
$experiment = $rollout->getExperiments()[0];
$expected_variation = $experiment->getVariations()[0];
$expected_decision = new FeatureDecision(
$experiment->getId(), $expected_variation->getId(), FeatureDecision::DECISION_SOURCE_ROLLOUT);
$experiment->getId(),
$expected_variation->getId(),
FeatureDecision::DECISION_SOURCE_ROLLOUT
);

// Provide attributes such that user qualifies for audience
$user_attributes = ["browser_type" => "chrome"];
Expand Down Expand Up @@ -959,7 +966,10 @@ public function testGetVariationForFeatureRolloutWhenUserIsNotBucketedInTheTarge
$experiment2 = $rollout->getExperiments()[2];
$expected_variation = $experiment2->getVariations()[0];
$expected_decision = new FeatureDecision(
$experiment2->getId(), $expected_variation->getId(), FeatureDecision::DECISION_SOURCE_ROLLOUT);
$experiment2->getId(),
$expected_variation->getId(),
FeatureDecision::DECISION_SOURCE_ROLLOUT
);

// Provide attributes such that user qualifies for audience
$user_attributes = ["browser_type" => "chrome"];
Expand Down Expand Up @@ -1064,7 +1074,10 @@ public function testGetVariationForFeatureRolloutWhenUserDoesNotQualifyForAnyTar
$experiment2 = $rollout->getExperiments()[2];
$expected_variation = $experiment2->getVariations()[0];
$expected_decision = new FeatureDecision(
$experiment2->getId(), $expected_variation->getId(), FeatureDecision::DECISION_SOURCE_ROLLOUT);
$experiment2->getId(),
$expected_variation->getId(),
FeatureDecision::DECISION_SOURCE_ROLLOUT
);

// Provide null attributes so that user does not qualify for audience
$user_attributes = [];
Expand Down

0 comments on commit efeaa82

Please sign in to comment.