Skip to content

Commit f12484a

Browse files
authored
Bump event builder version to 2.0 beta. (#102)
1 parent 02282a1 commit f12484a

File tree

3 files changed

+26
-25
lines changed

3 files changed

+26
-25
lines changed

CHANGELOG.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ $booleanVariable = $optimizelyClient->getFeatureVariableBoolean('my_feature_key'
2828
$eventTags = ['revenue' => 4200];
2929
3030
$optimizelyClient->track('event_key', 'user_id', $userAttributes, $eventTags);
31+
```
3132

3233
## 1.5.0
3334
- Added support for notification listeners.
@@ -44,11 +45,11 @@ $optimizelyClient->track('event_key', 'user_id', $userAttributes, $eventTags);
4445
* Force a user into a variation for a given experiment.
4546
*
4647
* @param $experimentKey string Key identifying the experiment.
47-
* @param $userId string The user ID to be used for bucketing.
48-
* @param $variationKey string The variation key specifies the variation which the user
48+
* @param $userId string The user ID to be used for bucketing.
49+
* @param $variationKey string The variation key specifies the variation which the user
4950
* will be forced into. If null, then clear the existing experiment-to-variation mapping.
5051
*
51-
* @return boolean A boolean value that indicates if the set completed successfully.
52+
* @return boolean A boolean value that indicates if the set completed successfully.
5253
*/
5354
```
5455
```
@@ -58,14 +59,14 @@ public function setForcedVariation($experimentKey, $userId, $variationKey);
5859
* Gets the forced variation for a given user and experiment.
5960
*
6061
* @param $experimentKey string Key identifying the experiment.
61-
* @param $userId string The user ID to be used for bucketing.
62+
* @param $userId string The user ID to be used for bucketing.
6263
*
6364
* @return string|null The forced variation key.
6465
*/
6566
public function getForcedVariation($experimentKey, $userId);
6667
```
6768

68-
- Added the bucketing ID feature allows decoupling bucketing from user identification so that a group of users that have the same bucketing ID are put into the same variation.
69+
- Added the bucketing ID feature allows decoupling bucketing from user identification so that a group of users that have the same bucketing ID are put into the same variation.
6970

7071
## 1.2.0
7172
- Add user profile service.

src/Optimizely/Event/Builder/EventBuilder.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class EventBuilder
3737
/**
3838
* @const string Version of the Optimizely PHP SDK.
3939
*/
40-
const SDK_VERSION = '1.5.0';
40+
const SDK_VERSION = '2.0.0-beta1';
4141

4242
/**
4343
* @var string URL to send event to.
@@ -184,7 +184,7 @@ private function getConversionParams($config, $eventKey, $experimentVariationMap
184184
$singleSnapshot = [];
185185
$experiment = $config->getExperimentFromId($experimentId);
186186
$eventEntity = $config->getEvent($eventKey);
187-
187+
188188
$singleSnapshot[DECISIONS] = [
189189
[
190190
CAMPAIGN_ID => $experiment->getLayerId(),

tests/EventTests/EventBuilderTest.php

+18-18
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function setUp()
6868
]],
6969
'revision' => '15',
7070
'client_name' => 'php-sdk',
71-
'client_version' => '1.5.0',
71+
'client_version' => '2.0.0-beta1',
7272
'anonymize_ip'=> false,
7373
];
7474
$this->expectedEventHttpVerb = 'POST';
@@ -89,7 +89,7 @@ private function areLogEventsEqual($e1, $e2)
8989
if (!$isEqual) {
9090
$msg = $this->differ->diff(var_export($e1, true), var_export($e2, true));
9191
}
92-
92+
9393
return [$isEqual,$msg];
9494
}
9595

@@ -129,7 +129,7 @@ public function testCreateImpressionEventNoAttributesNoValue()
129129
$this->testUserId,
130130
null
131131
);
132-
132+
133133
$logEvent = $this->fakeParamsToReconcile($logEvent);
134134
$result = $this->areLogEventsEqual($this->expectedLogEvent, $logEvent);
135135
$this->assertTrue($result[0], $result[1]);
@@ -149,7 +149,7 @@ public function testCreateImpressionEventWithAttributesNoValue()
149149
$this->expectedEventHttpVerb,
150150
$this->expectedEventHeaders
151151
);
152-
152+
153153
$userAttributes = [
154154
'device_type' => 'iPhone',
155155
'company' => 'Optimizely'
@@ -218,7 +218,7 @@ public function testCreateImpressionEventWithZeroAttributesNoValue()
218218
$this->expectedEventHttpVerb,
219219
$this->expectedEventHeaders
220220
);
221-
221+
222222
$userAttributes = [
223223
'device_type' => 0,
224224
'company' => 'Optimizely'
@@ -247,7 +247,7 @@ public function testCreateImpressionEventWithInvalidAttributesNoValue()
247247
$this->expectedEventHttpVerb,
248248
$this->expectedEventHeaders
249249
);
250-
250+
251251
$userAttributes = [
252252
'invalid_attribute' => 'sorry_not_sorry'
253253
];
@@ -316,7 +316,7 @@ public function testCreateConversionEventWithAttributesNoValue()
316316
$this->expectedEventHttpVerb,
317317
$this->expectedEventHeaders
318318
);
319-
319+
320320
$userAttributes = [
321321
'device_type' => 'iPhone',
322322
'company' => 'Optimizely'
@@ -346,14 +346,14 @@ public function testCreateConversionEventInvalidAttributesNoValue()
346346
'key'=> 'purchase'
347347
];
348348
$this->expectedEventParams['visitors'][0]['snapshots'][0]['decisions'][0]['variation_id'] = '7722370027';
349-
349+
350350
$expectedLogEvent = new LogEvent(
351351
$this->expectedEventUrl,
352352
$this->expectedEventParams,
353353
$this->expectedEventHttpVerb,
354354
$this->expectedEventHeaders
355355
);
356-
356+
357357
$userAttributes = [
358358
'invalid_attribute'=> 'sorry_not_sorry'
359359
];
@@ -388,7 +388,7 @@ public function testCreateConversionEventNoAttributesWithValue()
388388
];
389389

390390
$this->expectedEventParams['visitors'][0]['snapshots'][0]['decisions'][0]['variation_id'] = '7722370027';
391-
391+
392392
$expectedLogEvent = new LogEvent(
393393
$this->expectedEventUrl,
394394
$this->expectedEventParams,
@@ -432,7 +432,7 @@ public function testCreateConversionEventWithAttributesWithValue()
432432
]
433433
];
434434
$this->expectedEventParams['visitors'][0]['snapshots'][0]['decisions'][0]['variation_id'] = '7722370027';
435-
435+
436436
$expectedLogEvent = new LogEvent(
437437
$this->expectedEventUrl,
438438
$this->expectedEventParams,
@@ -456,7 +456,7 @@ public function testCreateConversionEventWithAttributesWithValue()
456456
'value'=> '13.37'
457457
)
458458
);
459-
459+
460460
$logEvent = $this->fakeParamsToReconcile($logEvent);
461461
$result = $this->areLogEventsEqual($expectedLogEvent, $logEvent);
462462
$this->assertTrue($result[0], $result[1]);
@@ -482,7 +482,7 @@ public function testCreateConversionEventWithAttributesWithNumericTag()
482482
]
483483
];
484484
$this->expectedEventParams['visitors'][0]['snapshots'][0]['decisions'][0]['variation_id'] = '7722370027';
485-
485+
486486
$expectedLogEvent = new LogEvent(
487487
$this->expectedEventUrl,
488488
$this->expectedEventParams,
@@ -503,7 +503,7 @@ public function testCreateConversionEventWithAttributesWithNumericTag()
503503
'value'=> '13.37'
504504
)
505505
);
506-
506+
507507
$logEvent = $this->fakeParamsToReconcile($logEvent);
508508
$result = $this->areLogEventsEqual($expectedLogEvent, $logEvent);
509509
$this->assertTrue($result[0], $result[1]);
@@ -524,14 +524,14 @@ public function testCreateConversionEventNoAttributesWithInvalidValue()
524524
]
525525
];
526526
$this->expectedEventParams['visitors'][0]['snapshots'][0]['decisions'][0]['variation_id'] = '7722370027';
527-
527+
528528
$expectedLogEvent = new LogEvent(
529529
$this->expectedEventUrl,
530530
$this->expectedEventParams,
531531
$this->expectedEventHttpVerb,
532532
$this->expectedEventHeaders
533533
);
534-
534+
535535
$logEvent = $this->eventBuilder->createConversionEvent(
536536
$this->config,
537537
'purchase',
@@ -544,7 +544,7 @@ public function testCreateConversionEventNoAttributesWithInvalidValue()
544544
'value' => 'invalid value'
545545
)
546546
);
547-
547+
548548
$logEvent = $this->fakeParamsToReconcile($logEvent);
549549
$result = $this->areLogEventsEqual($expectedLogEvent, $logEvent);
550550
$this->assertTrue($result[0], $result[1]);
@@ -587,7 +587,7 @@ public function testCreateImpressionEventWithBucketingIDAttribute()
587587
$userAttributes
588588
);
589589

590-
590+
591591
$logEvent = $this->fakeParamsToReconcile($logEvent);
592592
$result = $this->areLogEventsEqual($expectedLogEvent, $logEvent);
593593
$this->assertTrue($result[0], $result[1]);

0 commit comments

Comments
 (0)