Skip to content

Commit

Permalink
Fixed: Outdated update query string parameters #3
Browse files Browse the repository at this point in the history
  • Loading branch information
olegkrivtsov committed May 8, 2017
1 parent 6427ed5 commit a994962
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions lib/WebMarketingROI/OptimizelyPHP/Service/v2/Experiments.php
Expand Up @@ -163,12 +163,11 @@ public function create($experiment, $action = null)
* Update an Experiment by ID
* @param integer $experimentId
* @param Experiment $experiment
* @param boolean $overrideChanges If there are draft changes already in the experiment, you can override those changes by providing this query parameter.
* @param boolean $publish Whether to publish the changes to the world.
* @param string $action Action to change the state of the Experiment.
* @return Result
* @throws Exception
*/
public function update($experimentId, $experiment, $overrideChanges, $publish)
public function update($experimentId, $experiment, $action)
{
if (!is_int($experimentId)) {
throw new Exception("Expected argument of type Experiment");
Expand All @@ -183,8 +182,7 @@ public function update($experimentId, $experiment, $overrideChanges, $publish)
}

$queryParams = array(
'override_changes' => $overrideChanges,
'publish' => $publish
'action' => $action
);

$postData = $experiment->toArray();
Expand Down
4 changes: 2 additions & 2 deletions tests/OptimizelyPHPTest/Service/v2/ExperimentsTest.php
Expand Up @@ -720,7 +720,7 @@ public function testUpdate()
)
));

$result = $experimentsService->update(1000, $experiment, true, true);
$result = $experimentsService->update(1000, $experiment, 'start');
$updatedExperiment = $result->getPayload();

$this->assertTrue($updatedExperiment instanceOf Experiment);
Expand Down Expand Up @@ -943,7 +943,7 @@ public function testIntegration()

// Update experiment
$createdExperiment->setName('Some new experiment name');
$result = $optimizelyClient->experiments()->update($createdExperiment->getId(), $createdExperiment);
$result = $optimizelyClient->experiments()->update($createdExperiment->getId(), $createdExperiment, 'start');
$updatedExperiment = $result->getPayload();

$this->assertTrue($updatedExperiment instanceOf Experiment);
Expand Down

0 comments on commit a994962

Please sign in to comment.