Skip to content

Commit fcc616a

Browse files
committed
restructure weird structure
1 parent 9026317 commit fcc616a

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

test/functional/SSHKeyAddTest.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,19 @@ public function testAddSshKeysGithub(int $expectedKeysAdded, array $keys)
125125
$numKeysBefore = $this->getKeyCount();
126126
$this->assertEquals(0, $numKeysBefore);
127127
$oldGithub = $GITHUB;
128+
$GITHUB = $this->createMock(UnityGithub::class);
129+
$GITHUB->method("getSshPublicKeys")->willReturn($keys);
128130
try {
129-
$GITHUB = $this->createMock(UnityGithub::class);
130-
$GITHUB->method("getSshPublicKeys")->willReturn($keys);
131-
try {
132-
http_post(__DIR__ . "/../../webroot/panel/account.php", [
133-
"form_type" => "addKey",
134-
"add_type" => "github",
135-
"gh_user" => "foobar",
136-
]);
137-
} finally {
138-
$GITHUB = $oldGithub;
139-
}
131+
http_post(__DIR__ . "/../../webroot/panel/account.php", [
132+
"form_type" => "addKey",
133+
"add_type" => "github",
134+
"gh_user" => "foobar",
135+
]);
140136
$numKeysAfter = $this->getKeyCount();
141137
$this->assertEquals($expectedKeysAdded, $numKeysAfter - $numKeysBefore);
142138
} finally {
143-
$USER->setSSHKeys([]);
144139
$GITHUB = $oldGithub;
140+
$USER->setSSHKeys([]);
145141
}
146142
}
147143
}

0 commit comments

Comments
 (0)