@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | $result = $eventsService->listAll(1000, true); |
50 | 50 | $events = $result->getPayload(); |
51 | 51 | |
52 | - $this->assertTrue(count($events)==1); |
|
52 | + $this->assertTrue(count($events) == 1); |
|
53 | 53 | $this->assertTrue($events[0] instanceOf Event); |
54 | - $this->assertTrue($events[0]->getName()=='Add to Cart'); |
|
54 | + $this->assertTrue($events[0]->getName() == 'Add to Cart'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | public function testGet() |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $event = $result->getPayload(); |
90 | 90 | |
91 | 91 | $this->assertTrue($event instanceOf Event); |
92 | - $this->assertTrue($event->getName()=='Add to Cart'); |
|
92 | + $this->assertTrue($event->getName() == 'Add to Cart'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | public function testCreateClickEvent() |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $createdEvent = $result->getPayload(); |
141 | 141 | |
142 | 142 | $this->assertTrue($createdEvent instanceOf ClickEvent); |
143 | - $this->assertTrue($createdEvent->getName()=='Add to Cart'); |
|
143 | + $this->assertTrue($createdEvent->getName() == 'Add to Cart'); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | public function testCreateCustomEvent() |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $createdEvent = $result->getPayload(); |
184 | 184 | |
185 | 185 | $this->assertTrue($createdEvent instanceOf CustomEvent); |
186 | - $this->assertTrue($createdEvent->getName()=='Loaded New App'); |
|
186 | + $this->assertTrue($createdEvent->getName() == 'Loaded New App'); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | public function testUpdateClickEvent() |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $updatedEvent = $result->getPayload(); |
235 | 235 | |
236 | 236 | $this->assertTrue($updatedEvent instanceOf ClickEvent); |
237 | - $this->assertTrue($updatedEvent->getName()=='Add to Cart'); |
|
237 | + $this->assertTrue($updatedEvent->getName() == 'Add to Cart'); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | public function testUpdateCustomEvent() |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $updatedEvent = $result->getPayload(); |
278 | 278 | |
279 | 279 | $this->assertTrue($updatedEvent instanceOf CustomEvent); |
280 | - $this->assertTrue($updatedEvent->getName()=='Loaded New App'); |
|
280 | + $this->assertTrue($updatedEvent->getName() == 'Loaded New App'); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | public function testIntegration() |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $credentials = $this->loadCredentialsFromFile(); |
289 | 289 | |
290 | 290 | $optimizelyClient = new OptimizelyApiClient($credentials, 'v2'); |
291 | - $this->assertTrue($optimizelyClient!=null); |
|
291 | + $this->assertTrue($optimizelyClient != null); |
|
292 | 292 | |
293 | 293 | // Create new project |
294 | 294 | $curDate = date('Y-m-d H:i:s'); |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $createdPage = $result->getPayload(); |
335 | 335 | |
336 | 336 | $this->assertTrue($createdPage instanceOf Page); |
337 | - $this->assertTrue($createdPage->getName()=='Home Page'); |
|
337 | + $this->assertTrue($createdPage->getName() == 'Home Page'); |
|
338 | 338 | |
339 | 339 | // Create new event in the project |
340 | 340 | $event = new ClickEvent(array( |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $createdEvent = $result->getPayload(); |
361 | 361 | |
362 | 362 | $this->assertTrue($createdEvent instanceOf ClickEvent); |
363 | - $this->assertTrue($createdEvent->getName()=='Add to Cart'); |
|
363 | + $this->assertTrue($createdEvent->getName() == 'Add to Cart'); |
|
364 | 364 | |
365 | 365 | // List all existing events and try to find the created event |
366 | 366 | $eventFound = false; |
@@ -372,16 +372,16 @@ discard block |
||
372 | 372 | $events = $result->getPayload(); |
373 | 373 | |
374 | 374 | foreach ($events as $event) { |
375 | - if ($event->getName()=="Add to Cart") { |
|
375 | + if ($event->getName() == "Add to Cart") { |
|
376 | 376 | $eventFound = true; |
377 | 377 | break; |
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
381 | - if ($result->getNextPage()==null) |
|
381 | + if ($result->getNextPage() == null) |
|
382 | 382 | break; |
383 | 383 | |
384 | - $page ++; |
|
384 | + $page++; |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | catch (Exception $e) { |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $updatedEvent = $result->getPayload(); |
402 | 402 | |
403 | 403 | $this->assertTrue($updatedEvent instanceOf Event); |
404 | - $this->assertTrue($updatedEvent->getName()=='Add to Cart 2'); |
|
404 | + $this->assertTrue($updatedEvent->getName() == 'Add to Cart 2'); |
|
405 | 405 | |
406 | 406 | // Make project archived |
407 | 407 |
@@ -238,8 +238,9 @@ discard block |
||
238 | 238 | |
239 | 239 | public function testIntegration() |
240 | 240 | { |
241 | - if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) |
|
242 | - $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set'); |
|
241 | + if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) { |
|
242 | + $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set'); |
|
243 | + } |
|
243 | 244 | |
244 | 245 | $credentials = $this->loadCredentialsFromFile(); |
245 | 246 | |
@@ -301,13 +302,13 @@ discard block |
||
301 | 302 | } |
302 | 303 | } |
303 | 304 | |
304 | - if ($result->getNextPage()==null) |
|
305 | - break; |
|
305 | + if ($result->getNextPage()==null) { |
|
306 | + break; |
|
307 | + } |
|
306 | 308 | |
307 | 309 | $page ++; |
308 | 310 | } |
309 | - } |
|
310 | - catch (Exception $e) { |
|
311 | + } catch (Exception $e) { |
|
311 | 312 | // Handle error. |
312 | 313 | $code = $e->getCode(); |
313 | 314 | $httpCode = $e->getHttpCode(); |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | "category" => "add_to_cart", |
27 | 27 | "description" => "Item added to cart", |
28 | 28 | "event_filter" => array( |
29 | - "filter_type" => "target_selector", |
|
30 | - "selector" => ".menu-options" |
|
29 | + "filter_type" => "target_selector", |
|
30 | + "selector" => ".menu-options" |
|
31 | 31 | ), |
32 | 32 | "event_type" => "custom", |
33 | 33 | "key" => "add_to_cart", |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | "category" => "add_to_cart", |
67 | 67 | "description" => "Item added to cart", |
68 | 68 | "event_filter" => array( |
69 | - "filter_type" => "target_selector", |
|
70 | - "selector" => ".menu-options" |
|
69 | + "filter_type" => "target_selector", |
|
70 | + "selector" => ".menu-options" |
|
71 | 71 | ), |
72 | 72 | "event_type" => "custom", |
73 | 73 | "key" => "add_to_cart", |
@@ -100,22 +100,22 @@ discard block |
||
100 | 100 | ->getMock(); |
101 | 101 | |
102 | 102 | $result = new Result(array( |
103 | - "event_filter" => array( |
|
103 | + "event_filter" => array( |
|
104 | 104 | "filter_type" => "target_selector", |
105 | 105 | "selector" => ".menu-options" |
106 | - ), |
|
107 | - "name" => "Add to Cart", |
|
108 | - "archived" => true, |
|
109 | - "category" => "add_to_cart", |
|
110 | - "description" => "string", |
|
111 | - "event_type" => "click", |
|
112 | - "key" => "add_to_cart", |
|
113 | - "created" => "2016-10-18T05:07:04.153Z", |
|
114 | - "id" => 0, |
|
115 | - "is_classic" => false, |
|
116 | - "is_editable" => true, |
|
117 | - "page_id" => 0, |
|
118 | - "project_id" => 1000 |
|
106 | + ), |
|
107 | + "name" => "Add to Cart", |
|
108 | + "archived" => true, |
|
109 | + "category" => "add_to_cart", |
|
110 | + "description" => "string", |
|
111 | + "event_type" => "click", |
|
112 | + "key" => "add_to_cart", |
|
113 | + "created" => "2016-10-18T05:07:04.153Z", |
|
114 | + "id" => 0, |
|
115 | + "is_classic" => false, |
|
116 | + "is_editable" => true, |
|
117 | + "page_id" => 0, |
|
118 | + "project_id" => 1000 |
|
119 | 119 | ), 201); |
120 | 120 | |
121 | 121 | $optimizelyApiClientMock->method('sendApiRequest') |
@@ -124,16 +124,16 @@ discard block |
||
124 | 124 | $eventsService = new Events($optimizelyApiClientMock); |
125 | 125 | |
126 | 126 | $event = new ClickEvent(array( |
127 | - "event_filter" => array( |
|
127 | + "event_filter" => array( |
|
128 | 128 | "filter_type" => "target_selector", |
129 | 129 | "selector" => ".menu-options" |
130 | - ), |
|
131 | - "name" => "Add to Cart", |
|
132 | - "archived" => true, |
|
133 | - "category" => "add_to_cart", |
|
134 | - "description" => "string", |
|
135 | - "event_type" => "click", |
|
136 | - "key" => "add_to_cart" |
|
130 | + ), |
|
131 | + "name" => "Add to Cart", |
|
132 | + "archived" => true, |
|
133 | + "category" => "add_to_cart", |
|
134 | + "description" => "string", |
|
135 | + "event_type" => "click", |
|
136 | + "key" => "add_to_cart" |
|
137 | 137 | )); |
138 | 138 | |
139 | 139 | $result = $eventsService->createClickEvent(0, $event); |
@@ -194,22 +194,22 @@ discard block |
||
194 | 194 | ->getMock(); |
195 | 195 | |
196 | 196 | $result = new Result(array( |
197 | - "event_filter" => array( |
|
197 | + "event_filter" => array( |
|
198 | 198 | "filter_type" => "target_selector", |
199 | 199 | "selector" => ".menu-options" |
200 | - ), |
|
201 | - "name" => "Add to Cart", |
|
202 | - "archived" => true, |
|
203 | - "category" => "add_to_cart", |
|
204 | - "description" => "string", |
|
205 | - "event_type" => "click", |
|
206 | - "key" => "add_to_cart", |
|
207 | - "created" => "2016-10-18T05:07:04.153Z", |
|
208 | - "id" => 0, |
|
209 | - "is_classic" => false, |
|
210 | - "is_editable" => true, |
|
211 | - "page_id" => 0, |
|
212 | - "project_id" => 1000 |
|
200 | + ), |
|
201 | + "name" => "Add to Cart", |
|
202 | + "archived" => true, |
|
203 | + "category" => "add_to_cart", |
|
204 | + "description" => "string", |
|
205 | + "event_type" => "click", |
|
206 | + "key" => "add_to_cart", |
|
207 | + "created" => "2016-10-18T05:07:04.153Z", |
|
208 | + "id" => 0, |
|
209 | + "is_classic" => false, |
|
210 | + "is_editable" => true, |
|
211 | + "page_id" => 0, |
|
212 | + "project_id" => 1000 |
|
213 | 213 | ), 200); |
214 | 214 | |
215 | 215 | $optimizelyApiClientMock->method('sendApiRequest') |
@@ -218,16 +218,16 @@ discard block |
||
218 | 218 | $eventsService = new Events($optimizelyApiClientMock); |
219 | 219 | |
220 | 220 | $event = new ClickEvent(array( |
221 | - "event_filter" => array( |
|
221 | + "event_filter" => array( |
|
222 | 222 | "filter_type" => "target_selector", |
223 | 223 | "selector" => ".menu-options" |
224 | - ), |
|
225 | - "name" => "Add to Cart", |
|
226 | - "archived" => true, |
|
227 | - "category" => "add_to_cart", |
|
228 | - "description" => "string", |
|
229 | - "event_type" => "click", |
|
230 | - "key" => "add_to_cart" |
|
224 | + ), |
|
225 | + "name" => "Add to Cart", |
|
226 | + "archived" => true, |
|
227 | + "category" => "add_to_cart", |
|
228 | + "description" => "string", |
|
229 | + "event_type" => "click", |
|
230 | + "key" => "add_to_cart" |
|
231 | 231 | )); |
232 | 232 | |
233 | 233 | $result = $eventsService->updateClickEvent(0, 0, $event); |
@@ -299,14 +299,14 @@ discard block |
||
299 | 299 | "platform" => "web", |
300 | 300 | "status" => "active", |
301 | 301 | "web_snippet" => array( |
302 | - "enable_force_variation" => false, |
|
303 | - "exclude_disabled_experiments" => false, |
|
304 | - "exclude_names" => true, |
|
305 | - "include_jquery" => true, |
|
306 | - "ip_anonymization" => false, |
|
307 | - "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
308 | - "library" => "jquery-1.11.3-trim", |
|
309 | - "project_javascript" => "alert(\"Active Experiment\")" |
|
302 | + "enable_force_variation" => false, |
|
303 | + "exclude_disabled_experiments" => false, |
|
304 | + "exclude_names" => true, |
|
305 | + "include_jquery" => true, |
|
306 | + "ip_anonymization" => false, |
|
307 | + "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
308 | + "library" => "jquery-1.11.3-trim", |
|
309 | + "project_javascript" => "alert(\"Active Experiment\")" |
|
310 | 310 | ) |
311 | 311 | )); |
312 | 312 | |
@@ -338,22 +338,22 @@ discard block |
||
338 | 338 | |
339 | 339 | // Create new event in the project |
340 | 340 | $event = new ClickEvent(array( |
341 | - "event_filter" => array( |
|
341 | + "event_filter" => array( |
|
342 | 342 | "filter_type" => "target_selector", |
343 | 343 | "selector" => ".menu-options" |
344 | - ), |
|
345 | - "name" => "Add to Cart", |
|
346 | - "archived" => true, |
|
347 | - "category" => "add_to_cart", |
|
348 | - "description" => "Some simple event", |
|
349 | - "event_type" => "click", |
|
350 | - "key" => "add_to_cart", |
|
351 | - "created" => "2016-10-18T05:07:04.153Z", |
|
352 | - "id" => 0, |
|
353 | - "is_classic" => false, |
|
354 | - //"is_editable" => true, |
|
355 | - "page_id" => $createdPage->getId(), |
|
356 | - "project_id" => $createdProject->getId() |
|
344 | + ), |
|
345 | + "name" => "Add to Cart", |
|
346 | + "archived" => true, |
|
347 | + "category" => "add_to_cart", |
|
348 | + "description" => "Some simple event", |
|
349 | + "event_type" => "click", |
|
350 | + "key" => "add_to_cart", |
|
351 | + "created" => "2016-10-18T05:07:04.153Z", |
|
352 | + "id" => 0, |
|
353 | + "is_classic" => false, |
|
354 | + //"is_editable" => true, |
|
355 | + "page_id" => $createdPage->getId(), |
|
356 | + "project_id" => $createdProject->getId() |
|
357 | 357 | )); |
358 | 358 | |
359 | 359 | $result = $optimizelyClient->events()->createClickEvent($createdPage->getId(), $event); |
@@ -205,14 +205,14 @@ |
||
205 | 205 | "platform" => "web", |
206 | 206 | "status" => "active", |
207 | 207 | "web_snippet" => array( |
208 | - "enable_force_variation" => false, |
|
209 | - "exclude_disabled_experiments" => false, |
|
210 | - "exclude_names" => true, |
|
211 | - "include_jquery" => true, |
|
212 | - "ip_anonymization" => false, |
|
213 | - "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
214 | - "library" => "jquery-1.11.3-trim", |
|
215 | - "project_javascript" => "alert(\"Active Experiment\")" |
|
208 | + "enable_force_variation" => false, |
|
209 | + "exclude_disabled_experiments" => false, |
|
210 | + "exclude_names" => true, |
|
211 | + "include_jquery" => true, |
|
212 | + "ip_anonymization" => false, |
|
213 | + "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
214 | + "library" => "jquery-1.11.3-trim", |
|
215 | + "project_javascript" => "alert(\"Active Experiment\")" |
|
216 | 216 | ) |
217 | 217 | )); |
218 | 218 |
@@ -238,8 +238,9 @@ discard block |
||
238 | 238 | |
239 | 239 | public function testIntegration() |
240 | 240 | { |
241 | - if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) |
|
242 | - $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set'); |
|
241 | + if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) { |
|
242 | + $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set'); |
|
243 | + } |
|
243 | 244 | |
244 | 245 | $credentials = $this->loadCredentialsFromFile(); |
245 | 246 | |
@@ -301,13 +302,13 @@ discard block |
||
301 | 302 | } |
302 | 303 | } |
303 | 304 | |
304 | - if ($result->getNextPage()==null) |
|
305 | - break; |
|
305 | + if ($result->getNextPage()==null) { |
|
306 | + break; |
|
307 | + } |
|
306 | 308 | |
307 | 309 | $page ++; |
308 | 310 | } |
309 | - } |
|
310 | - catch (Exception $e) { |
|
311 | + } catch (Exception $e) { |
|
311 | 312 | // Handle error. |
312 | 313 | $code = $e->getCode(); |
313 | 314 | $httpCode = $e->getHttpCode(); |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | $result = $attributesService->listAll(0); |
40 | 40 | $attributes = $result->getPayload(); |
41 | 41 | |
42 | - $this->assertTrue(count($attributes)==1); |
|
42 | + $this->assertTrue(count($attributes) == 1); |
|
43 | 43 | $this->assertTrue($attributes[0] instanceOf Attribute); |
44 | - $this->assertTrue($attributes[0]->getName()=='Subscriber Status'); |
|
44 | + $this->assertTrue($attributes[0]->getName() == 'Subscriber Status'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $attribute = $result->getPayload(); |
102 | 102 | |
103 | 103 | $this->assertTrue($attribute instanceOf Attribute); |
104 | - $this->assertTrue($attribute->getName()=='Subscriber Status'); |
|
104 | + $this->assertTrue($attribute->getName() == 'Subscriber Status'); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | public function testCreate() |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $createdAttribute = $result->getPayload(); |
143 | 143 | |
144 | 144 | $this->assertTrue($createdAttribute instanceOf Attribute); |
145 | - $this->assertTrue($createdAttribute->getName()=='Subscriber Status'); |
|
145 | + $this->assertTrue($createdAttribute->getName() == 'Subscriber Status'); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | public function testUpdate() |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $createdAttribute = $result->getPayload(); |
184 | 184 | |
185 | 185 | $this->assertTrue($createdAttribute instanceOf Attribute); |
186 | - $this->assertTrue($createdAttribute->getName()=='Subscriber Status'); |
|
186 | + $this->assertTrue($createdAttribute->getName() == 'Subscriber Status'); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | public function testIntegration() |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $credentials = $this->loadCredentialsFromFile(); |
195 | 195 | |
196 | 196 | $optimizelyClient = new OptimizelyApiClient($credentials, 'v2'); |
197 | - $this->assertTrue($optimizelyClient!=null); |
|
197 | + $this->assertTrue($optimizelyClient != null); |
|
198 | 198 | |
199 | 199 | // Create new project |
200 | 200 | $curDate = date('Y-m-d H:i:s'); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $createdAttribute = $result->getPayload(); |
236 | 236 | |
237 | 237 | $this->assertTrue($createdAttribute instanceOf Attribute); |
238 | - $this->assertTrue($createdAttribute->getName()=='Subscriber Status'); |
|
238 | + $this->assertTrue($createdAttribute->getName() == 'Subscriber Status'); |
|
239 | 239 | |
240 | 240 | // List all existing attributes and try to find the created attribute |
241 | 241 | $attributeFound = false; |
@@ -247,16 +247,16 @@ discard block |
||
247 | 247 | $attributes = $result->getPayload(); |
248 | 248 | |
249 | 249 | foreach ($attributes as $attribute) { |
250 | - if ($attribute->getName()=="Subscriber Status") { |
|
250 | + if ($attribute->getName() == "Subscriber Status") { |
|
251 | 251 | $attributeFound = true; |
252 | 252 | break; |
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - if ($result->getNextPage()==null) |
|
256 | + if ($result->getNextPage() == null) |
|
257 | 257 | break; |
258 | 258 | |
259 | - $page ++; |
|
259 | + $page++; |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | catch (Exception $e) { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $updatedAttribute = $result->getPayload(); |
277 | 277 | |
278 | 278 | $this->assertTrue($updatedAttribute instanceOf Attribute); |
279 | - $this->assertTrue($updatedAttribute->getName()=='Some new attribute name'); |
|
279 | + $this->assertTrue($updatedAttribute->getName() == 'Some new attribute name'); |
|
280 | 280 | |
281 | 281 | // Make project archived |
282 | 282 |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | $result = $pagesService->listAll(1000); |
44 | 44 | $pages = $result->getPayload(); |
45 | 45 | |
46 | - $this->assertTrue(count($pages)==1); |
|
46 | + $this->assertTrue(count($pages) == 1); |
|
47 | 47 | $this->assertTrue($pages[0] instanceOf Page); |
48 | - $this->assertTrue($pages[0]->getName()=='Home Page'); |
|
48 | + $this->assertTrue($pages[0]->getName() == 'Home Page'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | public function testGet() |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $createdPage = $result->getPayload(); |
129 | 129 | |
130 | 130 | $this->assertTrue($createdPage instanceOf Page); |
131 | - $this->assertTrue($createdPage->getName()=='Home Page'); |
|
131 | + $this->assertTrue($createdPage->getName() == 'Home Page'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | public function testUpdate() |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $updatedPage = $result->getPayload(); |
177 | 177 | |
178 | 178 | $this->assertTrue($updatedPage instanceOf Page); |
179 | - $this->assertTrue($updatedPage->getName()=='Home Page'); |
|
179 | + $this->assertTrue($updatedPage->getName() == 'Home Page'); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | public function testDelete() |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $credentials = $this->loadCredentialsFromFile(); |
207 | 207 | |
208 | 208 | $optimizelyClient = new OptimizelyApiClient($credentials, 'v2'); |
209 | - $this->assertTrue($optimizelyClient!=null); |
|
209 | + $this->assertTrue($optimizelyClient != null); |
|
210 | 210 | |
211 | 211 | // Create new project |
212 | 212 | $curDate = date('Y-m-d H:i:s'); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $createdPage = $result->getPayload(); |
253 | 253 | |
254 | 254 | $this->assertTrue($createdPage instanceOf Page); |
255 | - $this->assertTrue($createdPage->getName()=='Home Page'); |
|
255 | + $this->assertTrue($createdPage->getName() == 'Home Page'); |
|
256 | 256 | |
257 | 257 | // List all existing pages and try to find the created page |
258 | 258 | $pageFound = false; |
@@ -264,16 +264,16 @@ discard block |
||
264 | 264 | $pages = $result->getPayload(); |
265 | 265 | |
266 | 266 | foreach ($pages as $pageObject) { |
267 | - if ($pageObject->getName()=="Home Page") { |
|
267 | + if ($pageObject->getName() == "Home Page") { |
|
268 | 268 | $pageFound = true; |
269 | 269 | break; |
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
273 | - if ($result->getNextPage()==null) |
|
273 | + if ($result->getNextPage() == null) |
|
274 | 274 | break; |
275 | 275 | |
276 | - $page ++; |
|
276 | + $page++; |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | catch (Exception $e) { |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | $updatedPage = $result->getPayload(); |
294 | 294 | |
295 | 295 | $this->assertTrue($updatedPage instanceOf Page); |
296 | - $this->assertTrue($updatedPage->getName()=='Some new page name'); |
|
296 | + $this->assertTrue($updatedPage->getName() == 'Some new page name'); |
|
297 | 297 | |
298 | 298 | // Make project archived |
299 | 299 |
@@ -205,14 +205,14 @@ |
||
205 | 205 | "platform" => "web", |
206 | 206 | "status" => "active", |
207 | 207 | "web_snippet" => array( |
208 | - "enable_force_variation" => false, |
|
209 | - "exclude_disabled_experiments" => false, |
|
210 | - "exclude_names" => true, |
|
211 | - "include_jquery" => true, |
|
212 | - "ip_anonymization" => false, |
|
213 | - "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
214 | - "library" => "jquery-1.11.3-trim", |
|
215 | - "project_javascript" => "alert(\"Active Experiment\")" |
|
208 | + "enable_force_variation" => false, |
|
209 | + "exclude_disabled_experiments" => false, |
|
210 | + "exclude_names" => true, |
|
211 | + "include_jquery" => true, |
|
212 | + "ip_anonymization" => false, |
|
213 | + "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
214 | + "library" => "jquery-1.11.3-trim", |
|
215 | + "project_javascript" => "alert(\"Active Experiment\")" |
|
216 | 216 | ) |
217 | 217 | )); |
218 | 218 |
@@ -238,8 +238,9 @@ discard block |
||
238 | 238 | |
239 | 239 | public function testIntegration() |
240 | 240 | { |
241 | - if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) |
|
242 | - $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set'); |
|
241 | + if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) { |
|
242 | + $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set'); |
|
243 | + } |
|
243 | 244 | |
244 | 245 | $credentials = $this->loadCredentialsFromFile(); |
245 | 246 | |
@@ -301,13 +302,13 @@ discard block |
||
301 | 302 | } |
302 | 303 | } |
303 | 304 | |
304 | - if ($result->getNextPage()==null) |
|
305 | - break; |
|
305 | + if ($result->getNextPage()==null) { |
|
306 | + break; |
|
307 | + } |
|
306 | 308 | |
307 | 309 | $page ++; |
308 | 310 | } |
309 | - } |
|
310 | - catch (Exception $e) { |
|
311 | + } catch (Exception $e) { |
|
311 | 312 | // Handle error. |
312 | 313 | $code = $e->getCode(); |
313 | 314 | $httpCode = $e->getHttpCode(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | switch ($name) { |
29 | 29 | case 'selector': $this->setSelector($value); break; |
30 | 30 | default: |
31 | - throw new Exception('Unknown option found in the InPageConfig entity: ' . $name); |
|
31 | + throw new Exception('Unknown option found in the InPageConfig entity: '.$name); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | // Remove options with empty values |
46 | 46 | $cleanedOptions = array(); |
47 | 47 | foreach ($options as $name=>$value) { |
48 | - if ($value!==null) |
|
48 | + if ($value !== null) |
|
49 | 49 | $cleanedOptions[$name] = $value; |
50 | 50 | } |
51 | 51 |
@@ -91,8 +91,9 @@ |
||
91 | 91 | // Remove options with empty values |
92 | 92 | $cleanedOptions = array(); |
93 | 93 | foreach ($options as $name=>$value) { |
94 | - if ($value!==null) |
|
95 | - $cleanedOptions[$name] = $value; |
|
94 | + if ($value!==null) { |
|
95 | + $cleanedOptions[$name] = $value; |
|
96 | + } |
|
96 | 97 | } |
97 | 98 | |
98 | 99 | return $cleanedOptions; |
@@ -70,7 +70,7 @@ |
||
70 | 70 | case 'page_id': $this->setPageId($value); break; |
71 | 71 | |
72 | 72 | default: |
73 | - throw new Exception('Unknown option found in the UrlTargeting entity: ' . $name); |
|
73 | + throw new Exception('Unknown option found in the UrlTargeting entity: '.$name); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | use WebMarketingROI\OptimizelyPHP\Resource\v2\Page; |
18 | 18 | |
19 | 19 | // Init class autloading. |
20 | -include dirname(__FILE__) . '/../../vendor/autoload.php'; |
|
20 | +include dirname(__FILE__).'/../../vendor/autoload.php'; |
|
21 | 21 | |
22 | 22 | // Include Utils.php - a file containing helper functions |
23 | -include dirname(__FILE__) . '/../Utils.php'; |
|
23 | +include dirname(__FILE__).'/../Utils.php'; |
|
24 | 24 | |
25 | 25 | // Read project ID from command line. |
26 | -if ($argc!=2) { |
|
27 | - die('Expected 1 command-line argument, while got ' . $argc-1); |
|
26 | +if ($argc != 2) { |
|
27 | + die('Expected 1 command-line argument, while got '.$argc - 1); |
|
28 | 28 | } |
29 | 29 | $projectId = $argv[1]; |
30 | 30 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | // Save access token for later use |
64 | 64 | $accessToken = $optimizelyClient->getAccessToken(); |
65 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
65 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
66 | 66 | |
67 | 67 | echo "Done!\n"; |
68 | 68 |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | use WebMarketingROI\OptimizelyPHP\Exception; |
17 | 17 | |
18 | 18 | // Init class autloading. |
19 | -include dirname(__FILE__) . '/../../vendor/autoload.php'; |
|
19 | +include dirname(__FILE__).'/../../vendor/autoload.php'; |
|
20 | 20 | |
21 | 21 | // Include Utils.php - a file containing helper functions |
22 | -include dirname(__FILE__) . '/../Utils.php'; |
|
22 | +include dirname(__FILE__).'/../Utils.php'; |
|
23 | 23 | |
24 | 24 | // Read project ID from command line. |
25 | -if ($argc!=2) { |
|
26 | - die('Expected 1 command-line argument, while got ' . $argc-1); |
|
25 | +if ($argc != 2) { |
|
26 | + die('Expected 1 command-line argument, while got '.$argc - 1); |
|
27 | 27 | } |
28 | 28 | $projectId = $argv[1]; |
29 | 29 | |
@@ -47,18 +47,18 @@ discard block |
||
47 | 47 | $pages = $result->getPayload(); |
48 | 48 | |
49 | 49 | foreach ($pages as $pageEntity) { |
50 | - echo "Id: " . $pageEntity->getId() . "\n"; |
|
51 | - echo "Name: " . $pageEntity->getName() . "\n"; |
|
52 | - echo "Edit URL: " . $pageEntity->getEditUrl() . "\n"; |
|
50 | + echo "Id: ".$pageEntity->getId()."\n"; |
|
51 | + echo "Name: ".$pageEntity->getName()."\n"; |
|
52 | + echo "Edit URL: ".$pageEntity->getEditUrl()."\n"; |
|
53 | 53 | echo "\n"; |
54 | 54 | } |
55 | 55 | |
56 | 56 | // Determine if there are more projects. |
57 | - if ($result->getNextPage()==null) |
|
57 | + if ($result->getNextPage() == null) |
|
58 | 58 | break; |
59 | 59 | |
60 | 60 | // Increment page counter. |
61 | - $page ++; |
|
61 | + $page++; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | } catch (Exception $e) { |
@@ -72,6 +72,6 @@ discard block |
||
72 | 72 | |
73 | 73 | // Save access token for later use |
74 | 74 | $accessToken = $optimizelyClient->getAccessToken(); |
75 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
75 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
76 | 76 | |
77 | 77 | echo "Done!\n"; |
@@ -55,8 +55,9 @@ |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | // Determine if there are more projects. |
58 | - if ($result->getNextPage()==null) |
|
59 | - break; |
|
58 | + if ($result->getNextPage()==null) { |
|
59 | + break; |
|
60 | + } |
|
60 | 61 | |
61 | 62 | // Increment page counter. |
62 | 63 | $page ++; |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | use WebMarketingROI\OptimizelyPHP\Exception; |
17 | 17 | |
18 | 18 | // Init class autloading. |
19 | -include dirname(__FILE__) . '/../../vendor/autoload.php'; |
|
19 | +include dirname(__FILE__).'/../../vendor/autoload.php'; |
|
20 | 20 | |
21 | 21 | // Include Utils.php - a file containing helper functions |
22 | -include dirname(__FILE__) . '/../Utils.php'; |
|
22 | +include dirname(__FILE__).'/../Utils.php'; |
|
23 | 23 | |
24 | 24 | // Read project ID from command line. |
25 | -if ($argc!=2) { |
|
26 | - die('Expected 1 command-line argument, while got ' . $argc-1); |
|
25 | +if ($argc != 2) { |
|
26 | + die('Expected 1 command-line argument, while got '.$argc - 1); |
|
27 | 27 | } |
28 | 28 | $projectId = $argv[1]; |
29 | 29 | |
@@ -47,17 +47,17 @@ discard block |
||
47 | 47 | $campaigns = $result->getPayload(); |
48 | 48 | |
49 | 49 | foreach ($campaigns as $campaign) { |
50 | - echo "Name: " . $campaign->getName() . "\n"; |
|
51 | - echo "Status: " . $campaign->getStatus() . "\n"; |
|
50 | + echo "Name: ".$campaign->getName()."\n"; |
|
51 | + echo "Status: ".$campaign->getStatus()."\n"; |
|
52 | 52 | echo "\n"; |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Determine if there are more campaigns. |
56 | - if ($result->getNextPage()==null) |
|
56 | + if ($result->getNextPage() == null) |
|
57 | 57 | break; |
58 | 58 | |
59 | 59 | // Increment page counter. |
60 | - $page ++; |
|
60 | + $page++; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | } catch (Exception $e) { |
@@ -71,6 +71,6 @@ discard block |
||
71 | 71 | |
72 | 72 | // Save access token for later use |
73 | 73 | $accessToken = $optimizelyClient->getAccessToken(); |
74 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
74 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
75 | 75 | |
76 | 76 | echo "Done!\n"; |
@@ -53,8 +53,9 @@ |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | // Determine if there are more campaigns. |
56 | - if ($result->getNextPage()==null) |
|
57 | - break; |
|
56 | + if ($result->getNextPage()==null) { |
|
57 | + break; |
|
58 | + } |
|
58 | 59 | |
59 | 60 | // Increment page counter. |
60 | 61 | $page ++; |
@@ -42,26 +42,26 @@ |
||
42 | 42 | $campaign = new Campaign(array( |
43 | 43 | "project_id" => $projectId, |
44 | 44 | "changes" => array( |
45 | - array( |
|
45 | + array( |
|
46 | 46 | "type" => "custom_code", |
47 | 47 | "value" => "window.someGlobalFunction();" |
48 | - ) |
|
48 | + ) |
|
49 | 49 | ), |
50 | 50 | "experiment_ids" => array( |
51 | - 0 |
|
51 | + 0 |
|
52 | 52 | ), |
53 | 53 | "holdback" => 0, |
54 | 54 | "metrics" => array( |
55 | - array( |
|
55 | + array( |
|
56 | 56 | "aggregator" => "sum", |
57 | 57 | "event_id" => 0, |
58 | 58 | "field" => "revenue", |
59 | 59 | "scope" => "session" |
60 | - ) |
|
60 | + ) |
|
61 | 61 | ), |
62 | 62 | "name" => "Landing Page Optimization", |
63 | 63 | "page_ids" => array( |
64 | - $pageId, |
|
64 | + $pageId, |
|
65 | 65 | ), |
66 | 66 | "status" => "not_started", |
67 | 67 | "type" => "a/b" |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | use WebMarketingROI\OptimizelyPHP\Resource\v2\Campaign; |
18 | 18 | |
19 | 19 | // Init class autloading. |
20 | -include dirname(__FILE__) . '/../../vendor/autoload.php'; |
|
20 | +include dirname(__FILE__).'/../../vendor/autoload.php'; |
|
21 | 21 | |
22 | 22 | // Include Utils.php - a file containing helper functions |
23 | -include dirname(__FILE__) . '/../Utils.php'; |
|
23 | +include dirname(__FILE__).'/../Utils.php'; |
|
24 | 24 | |
25 | 25 | // Read project ID from command line. |
26 | -if ($argc!=3) { |
|
27 | - die('Expected 2 command-line argument, while got ' . $argc-1); |
|
26 | +if ($argc != 3) { |
|
27 | + die('Expected 2 command-line argument, while got '.$argc - 1); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $projectId = $argv[1]; |
@@ -81,6 +81,6 @@ discard block |
||
81 | 81 | |
82 | 82 | // Save access token for later use |
83 | 83 | $accessToken = $optimizelyClient->getAccessToken(); |
84 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
84 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
85 | 85 | |
86 | 86 | echo "Done!\n"; |