@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | "project_id" => 1000, |
87 | 87 | "archived" => false, |
88 | 88 | "conditions" => array( |
89 | - "and", |
|
90 | - array( |
|
89 | + "and", |
|
90 | + array( |
|
91 | 91 | "type" => "language", |
92 | 92 | "value" => "es" |
93 | - ), |
|
94 | - array( |
|
93 | + ), |
|
94 | + array( |
|
95 | 95 | "type" => "location", |
96 | 96 | "value" => "US-CA-SANFRANCISCO" |
97 | - ) |
|
97 | + ) |
|
98 | 98 | ), |
99 | 99 | "description" => "People that speak spanish and are in San Francisco", |
100 | 100 | "name" => "Spanish speaking San Franciscans", |
@@ -127,15 +127,15 @@ discard block |
||
127 | 127 | "project_id" => 1000, |
128 | 128 | "archived" => false, |
129 | 129 | "conditions" => array( |
130 | - "and", |
|
131 | - array( |
|
130 | + "and", |
|
131 | + array( |
|
132 | 132 | "type" => "language", |
133 | 133 | "value" => "es" |
134 | - ), |
|
135 | - array( |
|
134 | + ), |
|
135 | + array( |
|
136 | 136 | "type" => "location", |
137 | 137 | "value" => "US-CA-SANFRANCISCO" |
138 | - ) |
|
138 | + ) |
|
139 | 139 | ), |
140 | 140 | "description" => "People that speak spanish and are in San Francisco", |
141 | 141 | "name" => "Spanish speaking San Franciscans", |
@@ -154,15 +154,15 @@ discard block |
||
154 | 154 | "project_id" => 1000, |
155 | 155 | "archived" => false, |
156 | 156 | "conditions" => array( |
157 | - "and", |
|
158 | - array( |
|
157 | + "and", |
|
158 | + array( |
|
159 | 159 | "type" => "language", |
160 | 160 | "value" => "es" |
161 | - ), |
|
162 | - array( |
|
161 | + ), |
|
162 | + array( |
|
163 | 163 | "type" => "location", |
164 | 164 | "value" => "US-CA-SANFRANCISCO" |
165 | - ) |
|
165 | + ) |
|
166 | 166 | ), |
167 | 167 | "description" => "People that speak spanish and are in San Francisco", |
168 | 168 | "name" => "Spanish speaking San Franciscans", |
@@ -187,15 +187,15 @@ discard block |
||
187 | 187 | "project_id" => 1000, |
188 | 188 | "archived" => false, |
189 | 189 | "conditions" => array( |
190 | - "and", |
|
191 | - array( |
|
190 | + "and", |
|
191 | + array( |
|
192 | 192 | "type" => "language", |
193 | 193 | "value" => "es" |
194 | - ), |
|
195 | - array( |
|
194 | + ), |
|
195 | + array( |
|
196 | 196 | "type" => "location", |
197 | 197 | "value" => "US-CA-SANFRANCISCO" |
198 | - ) |
|
198 | + ) |
|
199 | 199 | ), |
200 | 200 | "description" => "People that speak spanish and are in San Francisco", |
201 | 201 | "name" => "Spanish speaking San Franciscans", |
@@ -214,15 +214,15 @@ discard block |
||
214 | 214 | "project_id" => 1000, |
215 | 215 | "archived" => false, |
216 | 216 | "conditions" => array( |
217 | - "and", |
|
218 | - array( |
|
217 | + "and", |
|
218 | + array( |
|
219 | 219 | "type" => "language", |
220 | 220 | "value" => "es" |
221 | - ), |
|
222 | - array( |
|
221 | + ), |
|
222 | + array( |
|
223 | 223 | "type" => "location", |
224 | 224 | "value" => "US-CA-SANFRANCISCO" |
225 | - ) |
|
225 | + ) |
|
226 | 226 | ), |
227 | 227 | "description" => "People that speak spanish and are in San Francisco", |
228 | 228 | "name" => "Spanish speaking San Franciscans", |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | "platform" => "web", |
256 | 256 | "status" => "active", |
257 | 257 | "web_snippet" => array( |
258 | - "enable_force_variation" => false, |
|
259 | - "exclude_disabled_experiments" => false, |
|
260 | - "exclude_names" => true, |
|
261 | - "include_jquery" => true, |
|
262 | - "ip_anonymization" => false, |
|
263 | - "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
264 | - "library" => "jquery-1.11.3-trim", |
|
265 | - "project_javascript" => "alert(\"Active Experiment\")" |
|
258 | + "enable_force_variation" => false, |
|
259 | + "exclude_disabled_experiments" => false, |
|
260 | + "exclude_names" => true, |
|
261 | + "include_jquery" => true, |
|
262 | + "ip_anonymization" => false, |
|
263 | + "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$", |
|
264 | + "library" => "jquery-1.11.3-trim", |
|
265 | + "project_javascript" => "alert(\"Active Experiment\")" |
|
266 | 266 | ) |
267 | 267 | )); |
268 | 268 |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | $result = $audiencesService->listAll(1000); |
41 | 41 | $audiences = $result->getPayload(); |
42 | 42 | |
43 | - $this->assertTrue(count($audiences)==1); |
|
43 | + $this->assertTrue(count($audiences) == 1); |
|
44 | 44 | $this->assertTrue($audiences[0] instanceOf Audience); |
45 | - $this->assertTrue($audiences[0]->getName()=='Spanish speaking San Franciscans'); |
|
45 | + $this->assertTrue($audiences[0]->getName() == 'Spanish speaking San Franciscans'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $audience = $result->getPayload(); |
114 | 114 | |
115 | 115 | $this->assertTrue($audience instanceOf Audience); |
116 | - $this->assertTrue($audience->getName()=='Spanish speaking San Franciscans'); |
|
116 | + $this->assertTrue($audience->getName() == 'Spanish speaking San Franciscans'); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | public function testCreate() |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $createdAudience = $result->getPayload(); |
174 | 174 | |
175 | 175 | $this->assertTrue($createdAudience instanceOf Audience); |
176 | - $this->assertTrue($createdAudience->getName()=='Spanish speaking San Franciscans'); |
|
176 | + $this->assertTrue($createdAudience->getName() == 'Spanish speaking San Franciscans'); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | public function testUpdate() |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $createdAudience = $result->getPayload(); |
234 | 234 | |
235 | 235 | $this->assertTrue($createdAudience instanceOf Audience); |
236 | - $this->assertTrue($createdAudience->getName()=='Spanish speaking San Franciscans'); |
|
236 | + $this->assertTrue($createdAudience->getName() == 'Spanish speaking San Franciscans'); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | public function testIntegration() |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $credentials = $this->loadCredentialsFromFile(); |
245 | 245 | |
246 | 246 | $optimizelyClient = new OptimizelyApiClient($credentials, 'v2'); |
247 | - $this->assertTrue($optimizelyClient!=null); |
|
247 | + $this->assertTrue($optimizelyClient != null); |
|
248 | 248 | |
249 | 249 | // Create new project |
250 | 250 | $curDate = date('Y-m-d H:i:s'); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $createdAudience = $result->getPayload(); |
284 | 284 | |
285 | 285 | $this->assertTrue($createdAudience instanceOf Audience); |
286 | - $this->assertTrue($createdAudience->getName()=='Spanish speaking San Franciscans'); |
|
286 | + $this->assertTrue($createdAudience->getName() == 'Spanish speaking San Franciscans'); |
|
287 | 287 | |
288 | 288 | // List all existing audiences and try to find the created audience |
289 | 289 | $audienceFound = false; |
@@ -295,16 +295,16 @@ discard block |
||
295 | 295 | $audiences = $result->getPayload(); |
296 | 296 | |
297 | 297 | foreach ($audiences as $audience) { |
298 | - if ($audience->getName()=="Spanish speaking San Franciscans") { |
|
298 | + if ($audience->getName() == "Spanish speaking San Franciscans") { |
|
299 | 299 | $audienceFound = true; |
300 | 300 | break; |
301 | 301 | } |
302 | 302 | } |
303 | 303 | |
304 | - if ($result->getNextPage()==null) |
|
304 | + if ($result->getNextPage() == null) |
|
305 | 305 | break; |
306 | 306 | |
307 | - $page ++; |
|
307 | + $page++; |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | catch (Exception $e) { |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $updatedAudience = $result->getPayload(); |
325 | 325 | |
326 | 326 | $this->assertTrue($updatedAudience instanceOf Audience); |
327 | - $this->assertTrue($updatedAudience->getName()=='Some new audience name'); |
|
327 | + $this->assertTrue($updatedAudience->getName() == 'Some new audience name'); |
|
328 | 328 | |
329 | 329 | // Make project archived |
330 | 330 |
@@ -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(); |
@@ -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; |
@@ -74,7 +74,7 @@ |
||
74 | 74 | case 'unit': $this->setUnit($value); break; |
75 | 75 | case 'variation_results': $this->setVariationResults($value); break; |
76 | 76 | default: |
77 | - throw new Exception('Unknown option found in the ExperimentMetricResults entity: ' . $name); |
|
77 | + throw new Exception('Unknown option found in the ExperimentMetricResults entity: '.$name); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
@@ -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 | } |