Skip to content

Commit b2a94be

Browse files
committed
put back checks to please phpunit
1 parent 74b9244 commit b2a94be

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

resources/lib/UnitySite.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ public static function getGithubKeys($username)
5252

5353
public static function testValidSSHKey($key_str)
5454
{
55+
// https://github.com/phpseclib/phpseclib/issues/2077
56+
// key loader still throws exception, this just mutes a warning for phpunit
57+
if (preg_match("/^[0-9]+$/", $key_str)) {
58+
return false;
59+
}
60+
// https://github.com/phpseclib/phpseclib/issues/2076
61+
// key loader still throws exception, this just mutes a warning for phpunit
62+
if (!is_null(@json_decode($key_str))) {
63+
return false;
64+
}
5565
try {
5666
PublicKeyLoader::load($key_str);
5767
return true;

test/unit/UnitySiteTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ public static function SSHKeyProvider()
2727
public function testTestValidSSHKey(bool $expected, string $key)
2828
{
2929
$SITE = new UnitySite();
30-
// https://github.com/phpseclib/phpseclib/issues/2077
31-
if (preg_match("/^[0-9]+$/", $key)) {
32-
$this->expectWarning();
33-
}
34-
// https://github.com/phpseclib/phpseclib/issues/2076
35-
if (!is_null(@json_decode($key))) {
36-
$this->expectWarning();
37-
}
3830
$this->assertEquals($expected, $SITE->testValidSSHKey($key));
3931
}
4032

0 commit comments

Comments
 (0)