Completed
Push — master ( 5246d9...f37493 )
by James
04:14
created
tests/OptimizelyPHPTest/Service/v2/EventsTest.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
                             "category" => "add_to_cart",
25 25
                             "description" => "Item added to cart",
26 26
                             "event_filter" => array(
27
-                              "filter_type" => "target_selector",
28
-                              "selector" => ".menu-options"
27
+                                "filter_type" => "target_selector",
28
+                                "selector" => ".menu-options"
29 29
                             ),
30 30
                             "event_type" => "custom",
31 31
                             "key" => "add_to_cart",
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
                             "category" => "add_to_cart",
65 65
                             "description" => "Item added to cart",
66 66
                             "event_filter" => array(
67
-                              "filter_type" => "target_selector",
68
-                              "selector" => ".menu-options"
67
+                                "filter_type" => "target_selector",
68
+                                "selector" => ".menu-options"
69 69
                             ),
70 70
                             "event_type" => "custom",
71 71
                             "key" => "add_to_cart",
@@ -98,22 +98,22 @@  discard block
 block discarded – undo
98 98
                             ->getMock();
99 99
 
100 100
         $result = new Result(array(
101
-                              "event_filter" => array(
101
+                                "event_filter" => array(
102 102
                                 "filter_type" => "target_selector",
103 103
                                 "selector" => ".menu-options"
104
-                              ),
105
-                              "name" => "Add to Cart",
106
-                              "archived" => true,
107
-                              "category" => "add_to_cart",
108
-                              "description" => "string",
109
-                              "event_type" => "click",
110
-                              "key" => "add_to_cart",
111
-                              "created" => "2016-10-18T05:07:04.153Z",
112
-                              "id" => 0,
113
-                              "is_classic" => false,
114
-                              "is_editable" => true,
115
-                              "page_id" => 0,
116
-                              "project_id" => 1000
104
+                                ),
105
+                                "name" => "Add to Cart",
106
+                                "archived" => true,
107
+                                "category" => "add_to_cart",
108
+                                "description" => "string",
109
+                                "event_type" => "click",
110
+                                "key" => "add_to_cart",
111
+                                "created" => "2016-10-18T05:07:04.153Z",
112
+                                "id" => 0,
113
+                                "is_classic" => false,
114
+                                "is_editable" => true,
115
+                                "page_id" => 0,
116
+                                "project_id" => 1000
117 117
                         ), 201);
118 118
         
119 119
         $optimizelyApiClientMock->method('sendApiRequest')
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
         $eventsService = new Events($optimizelyApiClientMock);
123 123
         
124 124
         $event = new ClickEvent(array(
125
-              "event_filter" => array(
125
+                "event_filter" => array(
126 126
                 "filter_type" => "target_selector",
127 127
                 "selector" => ".menu-options"
128
-              ),
129
-              "name" => "Add to Cart",
130
-              "archived" => true,
131
-              "category" => "add_to_cart",
132
-              "description" => "string",
133
-              "event_type" => "click",
134
-              "key" => "add_to_cart"
128
+                ),
129
+                "name" => "Add to Cart",
130
+                "archived" => true,
131
+                "category" => "add_to_cart",
132
+                "description" => "string",
133
+                "event_type" => "click",
134
+                "key" => "add_to_cart"
135 135
         ));
136 136
         
137 137
         $result = $eventsService->createClickEvent(0, $event);
@@ -192,22 +192,22 @@  discard block
 block discarded – undo
192 192
                             ->getMock();
193 193
 
194 194
         $result = new Result(array(
195
-                              "event_filter" => array(
195
+                                "event_filter" => array(
196 196
                                 "filter_type" => "target_selector",
197 197
                                 "selector" => ".menu-options"
198
-                              ),
199
-                              "name" => "Add to Cart",
200
-                              "archived" => true,
201
-                              "category" => "add_to_cart",
202
-                              "description" => "string",
203
-                              "event_type" => "click",
204
-                              "key" => "add_to_cart",
205
-                              "created" => "2016-10-18T05:07:04.153Z",
206
-                              "id" => 0,
207
-                              "is_classic" => false,
208
-                              "is_editable" => true,
209
-                              "page_id" => 0,
210
-                              "project_id" => 1000
198
+                                ),
199
+                                "name" => "Add to Cart",
200
+                                "archived" => true,
201
+                                "category" => "add_to_cart",
202
+                                "description" => "string",
203
+                                "event_type" => "click",
204
+                                "key" => "add_to_cart",
205
+                                "created" => "2016-10-18T05:07:04.153Z",
206
+                                "id" => 0,
207
+                                "is_classic" => false,
208
+                                "is_editable" => true,
209
+                                "page_id" => 0,
210
+                                "project_id" => 1000
211 211
                         ), 200);
212 212
         
213 213
         $optimizelyApiClientMock->method('sendApiRequest')
@@ -216,16 +216,16 @@  discard block
 block discarded – undo
216 216
         $eventsService = new Events($optimizelyApiClientMock);
217 217
         
218 218
         $event = new ClickEvent(array(
219
-              "event_filter" => array(
219
+                "event_filter" => array(
220 220
                 "filter_type" => "target_selector",
221 221
                 "selector" => ".menu-options"
222
-              ),
223
-              "name" => "Add to Cart",
224
-              "archived" => true,
225
-              "category" => "add_to_cart",
226
-              "description" => "string",
227
-              "event_type" => "click",
228
-              "key" => "add_to_cart"
222
+                ),
223
+                "name" => "Add to Cart",
224
+                "archived" => true,
225
+                "category" => "add_to_cart",
226
+                "description" => "string",
227
+                "event_type" => "click",
228
+                "key" => "add_to_cart"
229 229
         ));
230 230
         
231 231
         $result = $eventsService->updateClickEvent(0, 0, $event);
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/Service/v2/CampaignsTest.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
                         array(
22 22
                             "project_id" => 1000,
23 23
                             "changes" => array(
24
-                              array(
24
+                                array(
25 25
                                 "type" => "custom_code",
26 26
                                 "allow_additional_redirect" => true,
27 27
                                 "async" => true,
28 28
                                 "css_selector" => "a[href*=\"optimizely\"]",
29 29
                                 "dependencies" => array(
30
-                                  24,
31
-                                  26
30
+                                    24,
31
+                                    26
32 32
                                 ),
33 33
                                 "destination" => "https://app.optimizely.com/",
34 34
                                 "extension_id" => 1234,
@@ -36,30 +36,30 @@  discard block
 block discarded – undo
36 36
                                 "src" => 524,
37 37
                                 "value" => "window.someGlobalFunction();",
38 38
                                 "id" => "string"
39
-                              )
39
+                                )
40 40
                             ),
41 41
                             "created" => "2016-10-18T03:27:04.123Z",
42 42
                             "earliest" => "2016-10-18T03:27:04.123Z",
43 43
                             "experiment_ids" => array(
44
-                              0
44
+                                0
45 45
                             ),
46 46
                             "holdback" => 0,
47 47
                             "last_modified" => "2016-10-18T03:27:04.123Z",
48 48
                             "latest" => "2016-10-18T03:27:04.123Z",
49 49
                             "metrics" => array(
50
-                              array(
50
+                                array(
51 51
                                 "kind" => "string",
52 52
                                 "id" => 0
53
-                              )
53
+                                )
54 54
                             ),
55 55
                             "name" => "Landing Page Optimization",
56 56
                             "page_ids" => array(
57
-                              0
57
+                                0
58 58
                             ),
59 59
                             "status" => "active",
60 60
                             "type" => "a/b",
61 61
                             "id" => 2000
62
-                          )
62
+                            )
63 63
                         ), 200);
64 64
         
65 65
         $optimizelyApiClientMock->method('sendApiRequest')
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
         $result = new Result(array(
116 116
                             "project_id" => 1000,
117 117
                             "changes" => array(
118
-                              array(
118
+                                array(
119 119
                                 "type" => "custom_code",
120 120
                                 "allow_additional_redirect" => true,
121 121
                                 "async" => true,
122 122
                                 "css_selector" => "a[href*=\"optimizely\"]",
123 123
                                 "dependencies" => array(
124
-                                  24,
125
-                                  26
124
+                                    24,
125
+                                    26
126 126
                                 ),
127 127
                                 "destination" => "https://app.optimizely.com/",
128 128
                                 "extension_id" => 1234,
@@ -130,25 +130,25 @@  discard block
 block discarded – undo
130 130
                                 "src" => 524,
131 131
                                 "value" => "window.someGlobalFunction();",
132 132
                                 "id" => "string"
133
-                              )
133
+                                )
134 134
                             ),
135 135
                             "created" => "2016-10-18T03:27:04.139Z",
136 136
                             "earliest" => "2016-10-18T03:27:04.139Z",
137 137
                             "experiment_ids" => array(
138
-                              0
138
+                                0
139 139
                             ),
140 140
                             "holdback" => 0,
141 141
                             "last_modified" => "2016-10-18T03:27:04.139Z",
142 142
                             "latest" => "2016-10-18T03:27:04.139Z",
143 143
                             "metrics" => array(
144
-                              array(
144
+                                array(
145 145
                                 "kind" => "string",
146 146
                                 "id" => 0
147
-                              )
147
+                                )
148 148
                             ),
149 149
                             "name" => "Landing Page Optimization",
150 150
                             "page_ids" => array(
151
-                              0
151
+                                0
152 152
                             ),
153 153
                             "status" => "active",
154 154
                             "type" => "a/b",
@@ -179,47 +179,47 @@  discard block
 block discarded – undo
179 179
                             "confidence_threshold" => 0,
180 180
                             "end_time" => "2016-10-18T03:27:04.147Z",
181 181
                             "metrics" => array(
182
-                              array(
182
+                                array(
183 183
                                 "event" => "string",
184 184
                                 "event_name" => "string",
185 185
                                 "measure" => "conversions",
186 186
                                 "metric_id" => "string",
187 187
                                 "priority" => 0,
188 188
                                 "results" => array(
189
-                                  "campaign" => array(
189
+                                    "campaign" => array(
190 190
                                     "experiment_id" => 0,
191 191
                                     "is_baseline" => true,
192 192
                                     "lift" => array(
193
-                                      "confidence_interval" => array(
193
+                                        "confidence_interval" => array(
194 194
                                         0.010399560300730457,
195 195
                                         0.0850821459929161
196
-                                      ),
197
-                                      "is_most_conclusive" => true,
198
-                                      "is_significant" => true,
199
-                                      "significance" => 0,
200
-                                      "value" => 0,
201
-                                      "visitors_remaining" => 0
196
+                                        ),
197
+                                        "is_most_conclusive" => true,
198
+                                        "is_significant" => true,
199
+                                        "significance" => 0,
200
+                                        "value" => 0,
201
+                                        "visitors_remaining" => 0
202 202
                                     ),
203 203
                                     "name" => "Blue Button",
204 204
                                     "rate" => 0,
205 205
                                     "scope" => "variation",
206 206
                                     "total_increase" => array(
207
-                                      "confidence_interval" => array(
207
+                                        "confidence_interval" => array(
208 208
                                         0.010399560300730457,
209 209
                                         0.0850821459929161
210
-                                      ),
211
-                                      "is_most_conclusive" => true,
212
-                                      "is_significant" => true,
213
-                                      "significance" => 0,
214
-                                      "value" => 0,
215
-                                      "visitors_remaining" => 0
210
+                                        ),
211
+                                        "is_most_conclusive" => true,
212
+                                        "is_significant" => true,
213
+                                        "significance" => 0,
214
+                                        "value" => 0,
215
+                                        "visitors_remaining" => 0
216 216
                                     ),
217 217
                                     "value" => 0,
218 218
                                     "variation_id" => "string"
219
-                                  )
219
+                                    )
220 220
                                 ),
221 221
                                 "unit" => "session"
222
-                              )
222
+                                )
223 223
                             ),
224 224
                             "start_time" => "2016-10-18T03:27:04.148Z"
225 225
                         ), 200);
@@ -247,14 +247,14 @@  discard block
 block discarded – undo
247 247
         $result = new Result(array(
248 248
                             "project_id" => 1000,
249 249
                             "changes" => array(
250
-                              array(
250
+                                array(
251 251
                                 "type" => "custom_code",
252 252
                                 "allow_additional_redirect" => true, 
253 253
                                 "async" => true,
254 254
                                 "css_selector" => "a[href*=\"optimizely\"]",
255 255
                                 "dependencies" => array(
256
-                                  24,
257
-                                  26
256
+                                    24,
257
+                                    26
258 258
                                 ),
259 259
                                 "destination" => "https://app.optimizely.com/",
260 260
                                 "extension_id" => 1234,
@@ -262,25 +262,25 @@  discard block
 block discarded – undo
262 262
                                 "src" => 524,
263 263
                                 "value" => "window.someGlobalFunction();",
264 264
                                 "id" => "string"
265
-                              )
265
+                                )
266 266
                             ),
267 267
                             "created" => "2016-10-18T03:27:04.155Z",
268 268
                             "earliest" => "2016-10-18T03:27:04.155Z",
269 269
                             "experiment_ids" => array(
270
-                              0
270
+                                0
271 271
                             ),
272 272
                             "holdback" => 0,
273 273
                             "last_modified" => "2016-10-18T03:27:04.155Z",
274 274
                             "latest" => "2016-10-18T03:27:04.155Z",
275 275
                             "metrics" => array(
276
-                              array(
276
+                                array(
277 277
                                 "kind" => "string",
278 278
                                 "id" => 0
279
-                              )
279
+                                )
280 280
                             ),
281 281
                             "name" => "Landing Page Optimization",
282 282
                             "page_ids" => array(
283
-                              0
283
+                                0
284 284
                             ),
285 285
                             "status" => "active",
286 286
                             "type" => "a/b",
@@ -295,38 +295,38 @@  discard block
 block discarded – undo
295 295
         $campaign = new Campaign(array(
296 296
                 "project_id" => 1000,
297 297
                 "changes" => array(
298
-                  array(
298
+                    array(
299 299
                     "type" => "custom_code",
300 300
                     "allow_additional_redirect" => true,
301 301
                     "async" => true,
302 302
                     "css_selector" => "a[href*=\"optimizely\"]",
303 303
                     "dependencies" => array(
304
-                      24,
305
-                      26
304
+                        24,
305
+                        26
306 306
                     ),
307 307
                     "destination" => "https://app.optimizely.com/",
308 308
                     "extension_id" => 1234,
309 309
                     "preserve_parameters" => true,
310 310
                     "src" => 524,
311 311
                     "value" => "window.someGlobalFunction();"
312
-                  )
312
+                    )
313 313
                 ),
314 314
                 "created" => "2016-10-18T03:27:04.067Z",
315 315
                 "earliest" => "2016-10-18T03:27:04.067Z",
316 316
                 "experiment_ids" => array(
317
-                  0
317
+                    0
318 318
                 ),
319 319
                 "holdback" => 0,
320 320
                 "last_modified" => "2016-10-18T03:27:04.067Z",
321 321
                 "latest" => "2016-10-18T03:27:04.067Z",
322 322
                 "metrics" => array(
323
-                  array(
323
+                    array(
324 324
                     "kind" => "string"
325
-                  )
325
+                    )
326 326
                 ),
327 327
                 "name" => "Landing Page Optimization",
328 328
                 "page_ids" => array(
329
-                  0
329
+                    0
330 330
                 ),
331 331
                 "status" => "active",
332 332
                 "type" => "a/b"
@@ -349,14 +349,14 @@  discard block
 block discarded – undo
349 349
         $result = new Result(array(
350 350
                             "project_id" => 1000,
351 351
                             "changes" => array(
352
-                              array(
352
+                                array(
353 353
                                 "type" => "custom_code",
354 354
                                 "allow_additional_redirect" => true, 
355 355
                                 "async" => true,
356 356
                                 "css_selector" => "a[href*=\"optimizely\"]",
357 357
                                 "dependencies" => array(
358
-                                  24,
359
-                                  26
358
+                                    24,
359
+                                    26
360 360
                                 ),
361 361
                                 "destination" => "https://app.optimizely.com/",
362 362
                                 "extension_id" => 1234,
@@ -364,25 +364,25 @@  discard block
 block discarded – undo
364 364
                                 "src" => 524,
365 365
                                 "value" => "window.someGlobalFunction();",
366 366
                                 "id" => "string"
367
-                              )
367
+                                )
368 368
                             ),
369 369
                             "created" => "2016-10-18T03:27:04.155Z",
370 370
                             "earliest" => "2016-10-18T03:27:04.155Z",
371 371
                             "experiment_ids" => array(
372
-                              0
372
+                                0
373 373
                             ),
374 374
                             "holdback" => 0,
375 375
                             "last_modified" => "2016-10-18T03:27:04.155Z",
376 376
                             "latest" => "2016-10-18T03:27:04.155Z",
377 377
                             "metrics" => array(
378
-                              array(
378
+                                array(
379 379
                                 "kind" => "string",
380 380
                                 "id" => 0
381
-                              )
381
+                                )
382 382
                             ),
383 383
                             "name" => "Landing Page Optimization",
384 384
                             "page_ids" => array(
385
-                              0
385
+                                0
386 386
                             ),
387 387
                             "status" => "active",
388 388
                             "type" => "a/b",
@@ -397,38 +397,38 @@  discard block
 block discarded – undo
397 397
         $campaign = new Campaign(array(
398 398
                 "project_id" => 1000,
399 399
                 "changes" => array(
400
-                  array(
400
+                    array(
401 401
                     "type" => "custom_code",
402 402
                     "allow_additional_redirect" => true,
403 403
                     "async" => true,
404 404
                     "css_selector" => "a[href*=\"optimizely\"]",
405 405
                     "dependencies" => array(
406
-                      24,
407
-                      26
406
+                        24,
407
+                        26
408 408
                     ),
409 409
                     "destination" => "https://app.optimizely.com/",
410 410
                     "extension_id" => 1234,
411 411
                     "preserve_parameters" => true,
412 412
                     "src" => 524,
413 413
                     "value" => "window.someGlobalFunction();"
414
-                  )
414
+                    )
415 415
                 ),
416 416
                 "created" => "2016-10-18T03:27:04.067Z",
417 417
                 "earliest" => "2016-10-18T03:27:04.067Z",
418 418
                 "experiment_ids" => array(
419
-                  0
419
+                    0
420 420
                 ),
421 421
                 "holdback" => 0,
422 422
                 "last_modified" => "2016-10-18T03:27:04.067Z",
423 423
                 "latest" => "2016-10-18T03:27:04.067Z",
424 424
                 "metrics" => array(
425
-                  array(
425
+                    array(
426 426
                     "kind" => "string"
427
-                  )
427
+                    )
428 428
                 ),
429 429
                 "name" => "Landing Page Optimization",
430 430
                 "page_ids" => array(
431
-                  0
431
+                    0
432 432
                 ),
433 433
                 "status" => "active",
434 434
                 "type" => "a/b"
Please login to merge, or discard this patch.
examples/Experiments/CreateExperiment.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -33,73 +33,73 @@
 block discarded – undo
33 33
     $experiment = new Experiment(array(
34 34
             "project_id" => 1000,
35 35
             "audience_ids" => array(
36
-              1234,
37
-              1212,
38
-              1432
36
+                1234,
37
+                1212,
38
+                1432
39 39
             ),
40 40
             "campaign_id" => 2000,
41 41
             "changes" => array(
42
-              array(
42
+                array(
43 43
                 "type" => "custom_code",
44 44
                 "allow_additional_redirect" => true,
45 45
                 "async" => true,
46 46
                 "css_selector" => "a[href*=\"optimizely\"]",
47 47
                 "dependencies" => array(
48
-                  24,
49
-                  26
48
+                    24,
49
+                    26
50 50
                 ),
51 51
                 "destination" => "https://app.optimizely.com/",
52 52
                 "extension_id" => 1234,
53 53
                 "preserve_parameters" => true,
54 54
                 "src" => 524,
55 55
                 "value" => "window.someGlobalFunction();"
56
-              )
56
+                )
57 57
             ),
58 58
             "description" => "string",
59 59
             "holdback" => 5000,
60 60
             "key" => "home_page_experiment",
61 61
             "metrics" => array(
62
-              array(
62
+                array(
63 63
                 "kind" => "string"
64
-              )
64
+                )
65 65
             ),
66 66
             "name" => "Blue Button Experiment",
67 67
             "schedule" => array(
68
-              "start_time" => "2016-10-17T07:04:59.724Z",
69
-              "stop_time" => "2016-10-17T07:04:59.724Z",
70
-              "time_zone" => "UTC"
68
+                "start_time" => "2016-10-17T07:04:59.724Z",
69
+                "stop_time" => "2016-10-17T07:04:59.724Z",
70
+                "time_zone" => "UTC"
71 71
             ),
72 72
             "status" => "active",
73 73
             "variations" => array(
74
-              array(
74
+                array(
75 75
                 "actions" => array(
76
-                  array(
76
+                    array(
77 77
                     "changes" => array(
78
-                      array(
78
+                        array(
79 79
                         "type" => "custom_code",
80 80
                         "allow_additional_redirect" => true,
81 81
                         "async" => true,
82 82
                         "css_selector" => "a[href*=\"optimizely\"]",
83 83
                         "dependencies" => array(
84
-                          24,
85
-                          26
84
+                            24,
85
+                            26
86 86
                         ),
87 87
                         "destination" => "https://app.optimizely.com/",
88 88
                         "extension_id" => 1234,
89 89
                         "preserve_parameters" => true,
90 90
                         "src" => 524,
91 91
                         "value" => "window.someGlobalFunction();"
92
-                      )
92
+                        )
93 93
                     ),
94 94
                     "page_id" => 0
95
-                  )
95
+                    )
96 96
                 ),
97 97
                 "archived" => true,
98 98
                 "key" => "blue_button_variation",
99 99
                 "name" => "Blue Button",
100 100
                 "variation_id" => 0,
101 101
                 "weight" => 0
102
-              )
102
+                )
103 103
             )
104 104
         ));
105 105
         
Please login to merge, or discard this patch.
examples/Utils.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
     $credentials = file_get_contents(dirname(__FILE__) . '/auth_credentials.json');
17 17
     if ($credentials===false) {
18 18
         throw new \Exception("Couldn't read OAuth credentials from auth_credentials.json. Make sure " .
19
-             "the file exists (if not, copy from auth_credentials.json.dist).");
19
+                "the file exists (if not, copy from auth_credentials.json.dist).");
20 20
     }
21 21
 
22 22
     $credentials = json_decode($credentials, true);
Please login to merge, or discard this patch.