Skip to content

Commit 9402c0d

Browse files
committed
restructure weird structure
1 parent c50abe7 commit 9402c0d

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
@@ -127,23 +127,19 @@ public function testAddSshKeysGithub(int $expectedKeysAdded, array $keys)
127127
$numKeysBefore = $this->getKeyCount();
128128
$this->assertEquals(0, $numKeysBefore);
129129
$oldGithub = $GITHUB;
130+
$GITHUB = $this->createMock(UnityGithub::class);
131+
$GITHUB->method("getSshPublicKeys")->willReturn($keys);
130132
try {
131-
$GITHUB = $this->createMock(UnityGithub::class);
132-
$GITHUB->method("getSshPublicKeys")->willReturn($keys);
133-
try {
134-
http_post(__DIR__ . "/../../webroot/panel/account.php", [
135-
"form_type" => "addKey",
136-
"add_type" => "github",
137-
"gh_user" => "foobar",
138-
]);
139-
} finally {
140-
$GITHUB = $oldGithub;
141-
}
133+
http_post(__DIR__ . "/../../webroot/panel/account.php", [
134+
"form_type" => "addKey",
135+
"add_type" => "github",
136+
"gh_user" => "foobar",
137+
]);
142138
$numKeysAfter = $this->getKeyCount();
143139
$this->assertEquals($expectedKeysAdded, $numKeysAfter - $numKeysBefore);
144140
} finally {
145-
$USER->setSSHKeys([]);
146141
$GITHUB = $oldGithub;
142+
$USER->setSSHKeys([]);
147143
}
148144
}
149145
}

0 commit comments

Comments
 (0)