Skip to content

Commit cc01bce

Browse files
author
guillermo-fisher
committed
Added second param to json_decode calls; checking that the license hash is sent with the request.
1 parent 9d4b593 commit cc01bce

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

test/Github/Tests/Api/Enterprise/ManagementConsoleTest.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ public function shouldShowConfigData()
1515
{ "status": "DONE", "key": "GitHub utilities" }, { "status": "DONE", "key": "GitHub applications" },
1616
{ "status": "CONFIGURING", "key": "GitHub services" }, { "status": "PENDING", "key":
1717
"Reloading appliance services" } ] }';
18-
$expectedArray = json_decode($expectedJson);
18+
$expectedArray = json_decode($expectedJson, true);
1919

2020
$api = $this->getApiMock();
2121
$api->expects($this->once())
2222
->method('get')
23-
->with('/setup/api/configcheck')
23+
->with('/setup/api/configcheck', array('license_md5' => $this->getLicenseHash()))
2424
->will($this->returnValue($expectedArray));
2525

2626
$this->assertEquals($expectedArray, $api->configcheck($this->getLicenseHash()));
@@ -53,12 +53,12 @@ public function shouldShowSettingsData()
5353
"file", "bucket": null, "host_name": null, "key_id": null, "access_key": null }, "pages": { "enabled": true },
5454
"collectd": { "enabled": false, "server": "", "port": "", "encryption": "", "username": "foo", "password":
5555
"bar" } }, "run_list": [ "role[configure]" ] }';
56-
$expectedArray = json_decode($expectedJson);
56+
$expectedArray = json_decode($expectedJson, true);
5757

5858
$api = $this->getApiMock();
5959
$api->expects($this->once())
6060
->method('get')
61-
->with('/setup/api/settings')
61+
->with('/setup/api/settings', array('license_md5' => $this->getLicenseHash()))
6262
->will($this->returnValue($expectedArray));
6363

6464
$this->assertEquals($expectedArray, $api->settings($this->getLicenseHash()));
@@ -72,12 +72,12 @@ public function shouldShowMaintenanceStatus()
7272
$expectedJson = '{ "status": "scheduled", "scheduled_time": "Tuesday, January 22 at 15 => 34 -0800",
7373
"connection_services": [ { "name": "git operations", "number": 0 }, { "name": "mysql queries", "number": 233 },
7474
{ "name": "resque jobs", "number": 54 } ] }';
75-
$expectedArray = json_decode($expectedJson);
75+
$expectedArray = json_decode($expectedJson, true);
7676

7777
$api = $this->getApiMock();
7878
$api->expects($this->once())
7979
->method('get')
80-
->with('/setup/api/maintenance')
80+
->with('/setup/api/maintenance', array('license_md5' => $this->getLicenseHash()))
8181
->will($this->returnValue($expectedArray));
8282

8383
$this->assertEquals($expectedArray, $api->maintenance($this->getLicenseHash()));
@@ -92,14 +92,13 @@ public function shouldShowAuthorizedKeys()
9292
"ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64" },
9393
{ "key": "ssh-rsa AAAAB3NzaC1yc2EAAAAB...", "pretty-print":
9494
"ssh-rsa 01:14:0f:f2:0f:e2:fe:e8:f4:72:62:af:75:f7:1a:88:3e:04:92:64" } ]';
95-
$expectedArray = json_decode($expectedJson);
95+
$expectedArray = json_decode($expectedJson, true);
9696

9797
$api = $this->getApiMock();
9898
$api->expects($this->once())
9999
->method('get')
100-
->with('/setup/api/settings/authorized-keys')
100+
->with('/setup/api/settings/authorized-keys', array('license_md5' => $this->getLicenseHash()))
101101
->will($this->returnValue($expectedArray));
102-
103102
$this->assertEquals($expectedArray, $api->keys($this->getLicenseHash()));
104103
}
105104

test/Github/Tests/Api/Enterprise/StatsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class StatsTest extends TestCase
1212
public function shouldShowStats()
1313
{
1414
$expectedJson = $this->getJson();
15-
$expectedArray = json_decode($expectedJson);
15+
$expectedArray = json_decode($expectedJson, true);
1616

1717
$api = $this->getApiMock();
1818
$api->expects($this->once())

0 commit comments

Comments
 (0)