@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | |
44 | 44 | $events = $eventsService->listAll(1000, true); |
45 | 45 | |
46 | - $this->assertTrue(count($events)==1); |
|
46 | + $this->assertTrue(count($events) == 1); |
|
47 | 47 | $this->assertTrue($events[0] instanceOf Event); |
48 | - $this->assertTrue($events[0]->getName()=='Add to Cart'); |
|
48 | + $this->assertTrue($events[0]->getName() == 'Add to Cart'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | public function testGet() |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $event = $eventsService->get(5000); |
81 | 81 | |
82 | 82 | $this->assertTrue($event instanceOf Event); |
83 | - $this->assertTrue($event->getName()=='Add to Cart'); |
|
83 | + $this->assertTrue($event->getName() == 'Add to Cart'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | public function testCreateClickEvent() |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $createdEvent = $eventsService->createClickEvent(0, $event); |
129 | 129 | |
130 | 130 | $this->assertTrue($createdEvent instanceOf ClickEvent); |
131 | - $this->assertTrue($createdEvent->getName()=='Add to Cart'); |
|
131 | + $this->assertTrue($createdEvent->getName() == 'Add to Cart'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | public function testCreateCustomEvent() |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $createdEvent = $eventsService->createCustomEvent(0, $event); |
169 | 169 | |
170 | 170 | $this->assertTrue($createdEvent instanceOf CustomEvent); |
171 | - $this->assertTrue($createdEvent->getName()=='Loaded New App'); |
|
171 | + $this->assertTrue($createdEvent->getName() == 'Loaded New App'); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | public function testUpdateClickEvent() |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $updatedEvent = $eventsService->updateClickEvent(0, 0, $event); |
217 | 217 | |
218 | 218 | $this->assertTrue($updatedEvent instanceOf ClickEvent); |
219 | - $this->assertTrue($updatedEvent->getName()=='Add to Cart'); |
|
219 | + $this->assertTrue($updatedEvent->getName() == 'Add to Cart'); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | public function testUpdateCustomEvent() |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $updatedEvent = $eventsService->updateCustomEvent(0, 0, $event); |
257 | 257 | |
258 | 258 | $this->assertTrue($updatedEvent instanceOf CustomEvent); |
259 | - $this->assertTrue($updatedEvent->getName()=='Loaded New App'); |
|
259 | + $this->assertTrue($updatedEvent->getName() == 'Loaded New App'); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | |
107 | 107 | $experiments = $experimentsService->listAll(1000); |
108 | 108 | |
109 | - $this->assertTrue(count($experiments)==1); |
|
109 | + $this->assertTrue(count($experiments) == 1); |
|
110 | 110 | $this->assertTrue($experiments[0] instanceOf Experiment); |
111 | - $this->assertTrue($experiments[0]->getName()=='Blue Button Experiment'); |
|
111 | + $this->assertTrue($experiments[0]->getName() == 'Blue Button Experiment'); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | public function testGet() |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | $experiment = $experimentsService->get(3000); |
206 | 206 | |
207 | 207 | $this->assertTrue($experiment instanceOf Experiment); |
208 | - $this->assertTrue($experiment->getName()=='Blue Button Experiment'); |
|
208 | + $this->assertTrue($experiment->getName() == 'Blue Button Experiment'); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | public function testGetResults() |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $experimentResults = $experimentsService->getResults(3000); |
287 | 287 | |
288 | 288 | $this->assertTrue($experimentResults instanceOf ExperimentResults); |
289 | - $this->assertTrue($experimentResults->getConfidenceThreshold()==0.9); |
|
289 | + $this->assertTrue($experimentResults->getConfidenceThreshold() == 0.9); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | public function testCreate() |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | $createdExperiment = $experimentsService->create($experiment, true); |
456 | 456 | |
457 | 457 | $this->assertTrue($createdExperiment instanceOf Experiment); |
458 | - $this->assertTrue($createdExperiment->getName()=='Blue Button Experiment'); |
|
458 | + $this->assertTrue($createdExperiment->getName() == 'Blue Button Experiment'); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | public function testUpdate() |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | $updatedExperiment = $experimentsService->update(1000, $experiment, true, true); |
621 | 621 | |
622 | 622 | $this->assertTrue($updatedExperiment instanceOf Experiment); |
623 | - $this->assertTrue($updatedExperiment->getName()=='Blue Button Experiment'); |
|
623 | + $this->assertTrue($updatedExperiment->getName() == 'Blue Button Experiment'); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | public function testDelete() |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | public function loadCredentialsFromFile() |
9 | 9 | { |
10 | 10 | // Get OAuth 2.0 credentials from auth_credentials.json file. |
11 | - $credentials = file_get_contents(dirname(__FILE__) . '/../../../auth_credentials.json'); |
|
12 | - if ($credentials===false) { |
|
13 | - $this->fail("Couldn't read OAuth credentials from auth_credentials.json. Make sure " . |
|
11 | + $credentials = file_get_contents(dirname(__FILE__).'/../../../auth_credentials.json'); |
|
12 | + if ($credentials === false) { |
|
13 | + $this->fail("Couldn't read OAuth credentials from auth_credentials.json. Make sure ". |
|
14 | 14 | "the file exists (if not, copy from auth_credentials.json.dist)."); |
15 | 15 | } |
16 | 16 | |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | // Try to read access_token.json and merge it with the rest of credentials. |
23 | - if (is_readable(dirname(__FILE__) . '/../../../access_token.json')) { |
|
24 | - $accessToken = file_get_contents(dirname(__FILE__) . '/access_token.json'); |
|
23 | + if (is_readable(dirname(__FILE__).'/../../../access_token.json')) { |
|
24 | + $accessToken = file_get_contents(dirname(__FILE__).'/access_token.json'); |
|
25 | 25 | |
26 | 26 | $accessToken = json_decode($accessToken, true); |
27 | 27 | if (!is_array($accessToken)) { |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | |
68 | 68 | $campaigns = $campaignsService->listAll(1000); |
69 | 69 | |
70 | - $this->assertTrue(count($campaigns)==1); |
|
70 | + $this->assertTrue(count($campaigns) == 1); |
|
71 | 71 | $this->assertTrue($campaigns[0] instanceOf Campaign); |
72 | - $this->assertTrue($campaigns[0]->getName()=='Landing Page Optimization'); |
|
72 | + $this->assertTrue($campaigns[0]->getName() == 'Landing Page Optimization'); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | public function testGet() |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $campaign = $campaignsService->get(2000); |
129 | 129 | |
130 | 130 | $this->assertTrue($campaign instanceOf Campaign); |
131 | - $this->assertTrue($campaign->getName()=='Landing Page Optimization'); |
|
131 | + $this->assertTrue($campaign->getName() == 'Landing Page Optimization'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | public function testGetResults() |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | $campaignResults = $campaignsService->getResults(3000); |
195 | 195 | |
196 | 196 | $this->assertTrue($campaignResults instanceOf CampaignResults); |
197 | - $this->assertTrue($campaignResults->getConfidenceThreshold()==0); |
|
198 | - $this->assertTrue($campaignResults->getStartTime()=="2016-10-18T03:27:04.148Z"); |
|
197 | + $this->assertTrue($campaignResults->getConfidenceThreshold() == 0); |
|
198 | + $this->assertTrue($campaignResults->getStartTime() == "2016-10-18T03:27:04.148Z"); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | public function testCreate() |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | $createdCampaign = $campaignsService->create($campaign); |
295 | 295 | |
296 | 296 | $this->assertTrue($createdCampaign instanceOf Campaign); |
297 | - $this->assertTrue($createdCampaign->getName()=='Landing Page Optimization'); |
|
297 | + $this->assertTrue($createdCampaign->getName() == 'Landing Page Optimization'); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | public function testUpdate() |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $updatedCampaign = $campaignsService->update(2000, $campaign); |
394 | 394 | |
395 | 395 | $this->assertTrue($updatedCampaign instanceOf Campaign); |
396 | - $this->assertTrue($updatedCampaign->getName()=='Landing Page Optimization'); |
|
396 | + $this->assertTrue($updatedCampaign->getName() == 'Landing Page Optimization'); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | public function testDelete() |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | function load_credentials_from_file() |
14 | 14 | { |
15 | 15 | // Get OAuth 2.0 credentials from auth_credentials.json file. |
16 | - $credentials = file_get_contents(dirname(__FILE__) . '/auth_credentials.json'); |
|
17 | - if ($credentials===false) { |
|
18 | - throw new \Exception("Couldn't read OAuth credentials from auth_credentials.json. Make sure " . |
|
16 | + $credentials = file_get_contents(dirname(__FILE__).'/auth_credentials.json'); |
|
17 | + if ($credentials === false) { |
|
18 | + throw new \Exception("Couldn't read OAuth credentials from auth_credentials.json. Make sure ". |
|
19 | 19 | "the file exists (if not, copy from auth_credentials.json.dist)."); |
20 | 20 | } |
21 | 21 | |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | // Try to read access_token.json and merge it with the rest of credentials. |
28 | - if (is_readable(dirname(__FILE__) . '/access_token.json')) { |
|
29 | - $accessToken = file_get_contents(dirname(__FILE__) . '/access_token.json'); |
|
28 | + if (is_readable(dirname(__FILE__).'/access_token.json')) { |
|
29 | + $accessToken = file_get_contents(dirname(__FILE__).'/access_token.json'); |
|
30 | 30 | |
31 | 31 | $accessToken = json_decode($accessToken, true); |
32 | 32 | if (!is_array($accessToken)) { |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | $result = $pagesService->listAll(1000); |
43 | 43 | $pages = $result->getPayload(); |
44 | 44 | |
45 | - $this->assertTrue(count($pages)==1); |
|
45 | + $this->assertTrue(count($pages) == 1); |
|
46 | 46 | $this->assertTrue($pages[0] instanceOf Page); |
47 | - $this->assertTrue($pages[0]->getName()=='Home Page'); |
|
47 | + $this->assertTrue($pages[0]->getName() == 'Home Page'); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function testGet() |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $createdPage = $result->getPayload(); |
128 | 128 | |
129 | 129 | $this->assertTrue($createdPage instanceOf Page); |
130 | - $this->assertTrue($createdPage->getName()=='Home Page'); |
|
130 | + $this->assertTrue($createdPage->getName() == 'Home Page'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public function testUpdate() |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $updatedPage = $result->getPayload(); |
176 | 176 | |
177 | 177 | $this->assertTrue($updatedPage instanceOf Page); |
178 | - $this->assertTrue($updatedPage->getName()=='Home Page'); |
|
178 | + $this->assertTrue($updatedPage->getName() == 'Home Page'); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | public function testDelete() |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | $result = $audiencesService->listAll(1000); |
50 | 50 | $audiences = $result->getPayload(); |
51 | 51 | |
52 | - $this->assertTrue(count($audiences)==1); |
|
52 | + $this->assertTrue(count($audiences) == 1); |
|
53 | 53 | $this->assertTrue($audiences[0] instanceOf Audience); |
54 | - $this->assertTrue($audiences[0]->getName()=='Spanish speaking San Franciscans'); |
|
54 | + $this->assertTrue($audiences[0]->getName() == 'Spanish speaking San Franciscans'); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | public function testGet() |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $audience = $result->getPayload(); |
93 | 93 | |
94 | 94 | $this->assertTrue($audience instanceOf Audience); |
95 | - $this->assertTrue($audience->getName()=='Spanish speaking San Franciscans'); |
|
95 | + $this->assertTrue($audience->getName() == 'Spanish speaking San Franciscans'); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | public function testCreate() |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $createdAudience = $result->getPayload(); |
153 | 153 | |
154 | 154 | $this->assertTrue($createdAudience instanceOf Audience); |
155 | - $this->assertTrue($createdAudience->getName()=='Spanish speaking San Franciscans'); |
|
155 | + $this->assertTrue($createdAudience->getName() == 'Spanish speaking San Franciscans'); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | public function testUpdate() |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $createdAudience = $result->getPayload(); |
213 | 213 | |
214 | 214 | $this->assertTrue($createdAudience instanceOf Audience); |
215 | - $this->assertTrue($createdAudience->getName()=='Spanish speaking San Franciscans'); |
|
215 | + $this->assertTrue($createdAudience->getName() == 'Spanish speaking San Franciscans'); |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 |
@@ -16,10 +16,10 @@ 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 | // Get OAuth 2.0 credentials from auth_credentials.json and access_token.json files. |
25 | 25 | $credentials = load_credentials_from_file(); |
@@ -42,24 +42,24 @@ discard block |
||
42 | 42 | $projects = $result->getPayload(); |
43 | 43 | |
44 | 44 | foreach ($projects as $project) { |
45 | - echo "ID: " . $project->getId() . "\n"; |
|
46 | - echo "Name: " . $project->getName() . "\n"; |
|
47 | - echo "Account ID: " . $project->getAccountId() . "\n"; |
|
48 | - echo "Platform: " . $project->getPlatform() . "\n"; |
|
49 | - echo "Status: " . $project->getStatus() . "\n"; |
|
50 | - echo "Is Classic: " . ($project->getIsClassic()?"true":"false") . "\n"; |
|
51 | - echo "Created: " . $project->getCreated() . "\n"; |
|
52 | - echo "Last Modified: " . $project->getLastModified() . "\n"; |
|
45 | + echo "ID: ".$project->getId()."\n"; |
|
46 | + echo "Name: ".$project->getName()."\n"; |
|
47 | + echo "Account ID: ".$project->getAccountId()."\n"; |
|
48 | + echo "Platform: ".$project->getPlatform()."\n"; |
|
49 | + echo "Status: ".$project->getStatus()."\n"; |
|
50 | + echo "Is Classic: ".($project->getIsClassic() ? "true" : "false")."\n"; |
|
51 | + echo "Created: ".$project->getCreated()."\n"; |
|
52 | + echo "Last Modified: ".$project->getLastModified()."\n"; |
|
53 | 53 | |
54 | 54 | echo "\n"; |
55 | 55 | } |
56 | 56 | |
57 | 57 | // Determine if there are more projects. |
58 | - if ($result->getNextPage()==null) |
|
58 | + if ($result->getNextPage() == null) |
|
59 | 59 | break; |
60 | 60 | |
61 | 61 | // Increment page counter. |
62 | - $page ++; |
|
62 | + $page++; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | } catch (Exception $e) { |
@@ -73,6 +73,6 @@ discard block |
||
73 | 73 | |
74 | 74 | // Save access token for later use |
75 | 75 | $accessToken = $optimizelyClient->getAccessToken(); |
76 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
76 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
77 | 77 | |
78 | 78 | echo "Done!\n"; |
79 | 79 | \ No newline at end of file |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | use WebMarketingROI\OptimizelyPHP\Resource\v2\Project; |
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 | // Get OAuth 2.0 credentials from auth_credentials.json and access_token.json files. |
26 | 26 | $credentials = load_credentials_from_file(); |
@@ -117,6 +117,6 @@ discard block |
||
117 | 117 | |
118 | 118 | // Save access token for later use |
119 | 119 | $accessToken = $optimizelyClient->getAccessToken(); |
120 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
120 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
121 | 121 | |
122 | 122 | echo "Done!\n"; |
123 | 123 | \ No newline at end of file |