Skip to content

Commit 473e0b2

Browse files
committed
duplicate experiment added in unit test data
1 parent 14e336c commit 473e0b2

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

tests/ConfigTests/DatafileProjectConfigTest.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public function testInit()
146146
'177776' => $this->config->getExperimentFromId('177776'),
147147
'177774' => $this->config->getExperimentFromId('177774'),
148148
'177779' => $this->config->getExperimentFromId('177779'),
149+
'7716830083' => $this->config->getExperimentFromId('7716830083'),
149150
],
150151
$experimentIdMap->getValue($this->config)
151152
);
@@ -533,7 +534,7 @@ public function testGetEventValidKey()
533534
$event = $this->config->getEvent('purchase');
534535
$this->assertEquals('purchase', $event->getKey());
535536
$this->assertEquals('7718020063', $event->getId());
536-
$this->assertEquals(['7716830082', '7723330021', '7718750065', '7716830585'], $event->getExperimentIds());
537+
$this->assertEquals(['7716830082', '7716830083', '7723330021', '7718750065', '7716830585'], $event->getExperimentIds());
537538
}
538539

539540
public function testGetEventInvalidKey()
@@ -653,6 +654,13 @@ public function testGetVariationFromKeyValidExperimentKeyValidVariationKey()
653654
$this->assertEquals('control', $variation->getKey());
654655
}
655656

657+
public function testGetVariationFromKeyValidExperimentIdValidVariationKey()
658+
{
659+
$variation = $this->config->getVariationFromKeyByExperimentId('7716830083', 'control');
660+
$this->assertEquals('7722370028', $variation->getId());
661+
$this->assertEquals('control', $variation->getKey());
662+
}
663+
656664
public function testGetVariationFromKeyValidExperimentKeyInvalidVariationKey()
657665
{
658666
$this->loggerMock->expects($this->once())
@@ -690,6 +698,13 @@ public function testGetVariationFromIdValidExperimentKeyValidVariationId()
690698
$this->assertEquals('7722370027', $variation->getId());
691699
}
692700

701+
public function testGetVariationFromIdValidExperimentIdValidVariationId()
702+
{
703+
$variation = $this->config->getVariationFromIdByExperimentId('7716830083', '7722370028');
704+
$this->assertEquals('control', $variation->getKey());
705+
$this->assertEquals('7722370028', $variation->getId());
706+
}
707+
693708
public function testGetVariationFromIdValidExperimentKeyInvalidVariationId()
694709
{
695710
$this->loggerMock->expects($this->once())

tests/TestData.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,42 @@
3131
'DATAFILE',
3232
'{
3333
"experiments": [
34+
{
35+
"status": "Running",
36+
"key": "test_experiment",
37+
"layerId": "7719770040",
38+
"trafficAllocation": [
39+
{
40+
"entityId": "",
41+
"endOfRange": 1500
42+
},
43+
{
44+
"entityId": "7722370028",
45+
"endOfRange": 4000
46+
},
47+
{
48+
"entityId": "7721010010",
49+
"endOfRange": 8000
50+
}
51+
],
52+
"audienceIds": [
53+
"7718080042"
54+
],
55+
"variations": [
56+
{
57+
"id": "7722370028",
58+
"key": "control"
59+
},
60+
{
61+
"id": "7721010010",
62+
"key": "variation"
63+
}
64+
],
65+
"forcedVariations": {
66+
"user1": "control"
67+
},
68+
"id": "7716830083"
69+
},
3470
{
3571
"status": "Running",
3672
"key": "test_experiment",
@@ -575,6 +611,7 @@
575611
{
576612
"experimentIds": [
577613
"7716830082",
614+
"7716830083",
578615
"7723330021",
579616
"7718750065",
580617
"7716830585"
@@ -590,6 +627,7 @@
590627
{
591628
"experimentIds":[
592629
"7716830082",
630+
"7716830083",
593631
"122230"
594632
],
595633
"id": "7718020065",

0 commit comments

Comments
 (0)