Merge branch '1.0' into 2.0

This commit is contained in:
terrafrost 2020-12-12 17:13:41 -06:00
commit 5701295017
41 changed files with 324 additions and 75 deletions

View File

@ -22,13 +22,15 @@ matrix:
dist: xenial
- php: 7.4
dist: xenial
- php: 8.0
dist: bionic
before_install: true
install:
- wget http://ftp.gnu.org/gnu/parallel/parallel-20170822.tar.bz2
- tar -xvjf parallel*
- cd parallel*
- cd parallel-20170822
- ./configure
- make
- sudo make install

View File

@ -55,7 +55,7 @@
},
"require-dev": {
"phing/phing": "~2.7",
"phpunit/phpunit": "^4.8.35|^5.7|^6.0",
"phpunit/phpunit": "^4.8.35|^5.7|^6.0|^9.4",
"squizlabs/php_codesniffer": "~2.0"
},
"suggest": {

View File

@ -315,19 +315,20 @@ class ANSI
$mods = explode(';', $match[1]);
foreach ($mods as $mod) {
switch ($mod) {
case 0: // Turn off character attributes
case '':
case '0': // Turn off character attributes
$attr_cell = clone $this->base_attr_cell;
break;
case 1: // Turn bold mode on
case '1': // Turn bold mode on
$attr_cell->bold = true;
break;
case 4: // Turn underline mode on
case '4': // Turn underline mode on
$attr_cell->underline = true;
break;
case 5: // Turn blinking mode on
case '5': // Turn blinking mode on
$attr_cell->blink = true;
break;
case 7: // Turn reverse video on
case '7': // Turn reverse video on
$attr_cell->reverse = !$attr_cell->reverse;
$temp = $attr_cell->background;
$attr_cell->background = $attr_cell->foreground;
@ -340,23 +341,23 @@ class ANSI
$back = &$attr_cell->{ $attr_cell->reverse ? 'foreground' : 'background' };
switch ($mod) {
// @codingStandardsIgnoreStart
case 30: $front = 'black'; break;
case 31: $front = 'red'; break;
case 32: $front = 'green'; break;
case 33: $front = 'yellow'; break;
case 34: $front = 'blue'; break;
case 35: $front = 'magenta'; break;
case 36: $front = 'cyan'; break;
case 37: $front = 'white'; break;
case '30': $front = 'black'; break;
case '31': $front = 'red'; break;
case '32': $front = 'green'; break;
case '33': $front = 'yellow'; break;
case '34': $front = 'blue'; break;
case '35': $front = 'magenta'; break;
case '36': $front = 'cyan'; break;
case '37': $front = 'white'; break;
case 40: $back = 'black'; break;
case 41: $back = 'red'; break;
case 42: $back = 'green'; break;
case 43: $back = 'yellow'; break;
case 44: $back = 'blue'; break;
case 45: $back = 'magenta'; break;
case 46: $back = 'cyan'; break;
case 47: $back = 'white'; break;
case '40': $back = 'black'; break;
case '41': $back = 'red'; break;
case '42': $back = 'green'; break;
case '43': $back = 'yellow'; break;
case '44': $back = 'blue'; break;
case '45': $back = 'magenta'; break;
case '46': $back = 'cyan'; break;
case '47': $back = 'white'; break;
// @codingStandardsIgnoreEnd
default:

View File

@ -98,3 +98,7 @@ class Functional_Net_SCPSSH2UserStoryTest extends PhpseclibFunctionalTestCase
);
}
}
class SCPSSH2UserStoryTest extends Functional_Net_SCPSSH2UserStoryTest
{
}

View File

@ -41,3 +41,7 @@ class Functional_Net_SFTPLargeFileTest extends Functional_Net_SFTPTestCase
);
}
}
class SFTPLargeFileTest extends Functional_Net_SFTPLargeFileTest
{
}

View File

@ -51,3 +51,7 @@ class Functional_Net_SFTPStreamTest extends Functional_Net_SFTPTestCase
);
}
}
class SFTPStreamTest extends Functional_Net_SFTPStreamTest
{
}

View File

@ -135,13 +135,23 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
return $sftp;
}
static function demoCallback($length)
{
$r = substr(self::$buffer, 0, $length);
self::$buffer = substr(self::$buffer, $length);
if (strlen($r)) {
return $r;
}
return null;
}
/**
* @depends testStatOnDir
*/
public function testPutSizeGetFile($sftp)
{
$this->assertTrue(
$sftp->put('file1.txt', self::$exampleData),
$sftp->put('file1.txt', array(__CLASS__, 'demoCallback'), NET_SFTP_CALLBACK),
'Failed asserting that example data could be successfully put().'
);
@ -439,8 +449,7 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
*/
public function testReadlink($sftp)
{
$this->assertInternalType(
'string',
$this->assertIsString(
$sftp->readlink('symlink'),
'Failed asserting that a symlink\'s target could be read'
);
@ -455,14 +464,12 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
public function testStatOnCWD($sftp)
{
$stat = $sftp->stat('.');
$this->assertInternalType(
'array',
$this->assertIsArray(
$stat,
'Failed asserting that stat on . returns an array'
);
$lstat = $sftp->lstat('.');
$this->assertInternalType(
'array',
$this->assertIsArray(
$lstat,
'Failed asserting that lstat on . returns an array'
);
@ -604,8 +611,7 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
'Failed asserting that scratch directory could ' .
'be created.'
);
$this->assertInternalType(
'array',
$this->assertIsArray(
$sftp->stat(self::$scratchDir),
'Failed asserting that stat on an existant empty directory returns an array'
);
@ -752,3 +758,7 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
$this->assertEquals($list_cache_enabled, $list_cache_disabled, 'The files should be the same regardless of stat cache', 0.0, 10, true);
}
}
class SFTPUserStoryTest extends Functional_Net_SFTPUserStoryTest
{
}

View File

@ -53,3 +53,7 @@ class Functional_Net_SSH2AgentTest extends PhpseclibFunctionalTestCase
return $args;
}
}
class SSH2AgentTest extends Functional_Net_SSH2AgentTest
{
}

View File

@ -124,7 +124,7 @@ class Functional_Net_SSH2Test extends PhpseclibFunctionalTestCase
{
$ssh = new SSH2($this->getEnv('SSH_HOSTNAME'));
$this->assertInternalType('string', $ssh->getServerPublicHostKey());
$this->assertIsString($ssh->getServerPublicHostKey());
}
public function testOpenSocketConnect()
@ -172,3 +172,7 @@ class Functional_Net_SSH2Test extends PhpseclibFunctionalTestCase
$ssh->read();
}
}
class SSH2Test extends Functional_Net_SSH2Test
{
}

View File

@ -101,4 +101,48 @@ abstract class PhpseclibTestCase extends PHPUnit\Framework\TestCase
}
}
}
// assertIsArray was not introduced until PHPUnit 8
public static function assertIsArray($actual, $message = '')
{
if (method_exists('\PHPUnit\Framework\TestCase', 'assertIsArray')) {
parent::assertIsArray($actual, $message);
return;
}
parent::assertInternalType('array', $actual, $message);
}
// assertIsString was not introduced until PHPUnit 8
public static function assertIsString($actual, $message = '')
{
if (method_exists('\PHPUnit\Framework\TestCase', 'assertIsString')) {
parent::assertIsString($actual, $message);
return;
}
parent::assertInternalType('string', $actual, $message);
}
// assertContains is deprecated for strings in PHPUnit 8
public static function assertStringContainsString($needle, $haystack, $message = '')
{
if (method_exists('\PHPUnit\Framework\TestCase', 'assertStringContainsString')) {
parent::assertStringContainsString($needle, $haystack, $message);
return;
}
parent::assertContains($needle, $haystack, $message);
}
// assertNotContains is deprecated for strings in PHPUnit 8
public static function assertStringNotContainsString($needle, $haystack, $message = '')
{
if (method_exists('\PHPUnit\Framework\TestCase', 'assertStringContainsString')) {
parent::assertStringNotContainsString($needle, $haystack, $message);
return;
}
parent::assertNotContains($needle, $haystack, $message);
}
}

View File

@ -14,3 +14,7 @@ class Unit_Crypt_AES_McryptTest extends Unit_Crypt_AES_TestCase
$this->engine = Base::ENGINE_MCRYPT;
}
}
class McryptTest extends Unit_Crypt_AES_McryptTest
{
}

View File

@ -14,3 +14,7 @@ class Unit_Crypt_AES_OpenSSLTest extends Unit_Crypt_AES_TestCase
$this->engine = Base::ENGINE_OPENSSL;
}
}
class OpenSSLTest extends Unit_Crypt_AES_OpenSSLTest
{
}

View File

@ -7,10 +7,14 @@
use phpseclib\Crypt\Base;
class Unit_Crypt_AES_InternalTest extends Unit_Crypt_AES_TestCase
class Unit_Crypt_AES_PurePHPTest extends Unit_Crypt_AES_TestCase
{
protected function setUp()
{
$this->engine = Base::ENGINE_INTERNAL;
}
}
class PurePHPTest extends Unit_Crypt_AES_PurePHPTest
{
}

View File

@ -129,3 +129,7 @@ class Unit_Crypt_BlowfishTest extends PhpseclibTestCase
}
}
}
class BlowfishTest extends Unit_Crypt_BlowfishTest
{
}

View File

@ -76,3 +76,7 @@ class Unit_Crypt_DESTest extends PhpseclibTestCase
}
}
}
class DESTest extends Unit_Crypt_DESTest
{
}

View File

@ -47,3 +47,7 @@ class Unit_Crypt_Hash_MD5Test extends Unit_Crypt_Hash_TestCase
);
}
}
class MD5Test extends Unit_Crypt_Hash_MD5Test
{
}

View File

@ -79,3 +79,7 @@ class Unit_Crypt_Hash_SHA256Test extends Unit_Crypt_Hash_TestCase
);
}
}
class SHA256Test extends Unit_Crypt_Hash_SHA256Test
{
}

View File

@ -30,3 +30,27 @@ class Unit_Crypt_Hash_SHA256_96Test extends Unit_Crypt_Hash_SHA256Test
parent::testHMAC($key, $message, substr($longResult, 0, 24));
}
}
class SHA256_96Test extends SHA256Test
{
public function getInstance()
{
return new Crypt_Hash('sha256-96');
}
/**
* @dataProvider hashData()
*/
public function testHash($message, $longResult)
{
parent::testHash($message, substr($longResult, 0, 24));
}
/**
* @dataProvider hmacData()
*/
public function testHMAC($key, $message, $longResult)
{
parent::testHMAC($key, $message, substr($longResult, 0, 24));
}
}

View File

@ -79,3 +79,7 @@ class Unit_Crypt_Hash_SHA512Test extends Unit_Crypt_Hash_TestCase
);
}
}
class SHA512Test extends Unit_Crypt_Hash_SHA512Test
{
}

View File

@ -30,3 +30,27 @@ class Unit_Crypt_Hash_SHA512_96Test extends Unit_Crypt_Hash_SHA512Test
parent::testHMAC($key, $message, substr($longResult, 0, 24));
}
}
class SHA512_96Test extends SHA512Test
{
public function getInstance()
{
return new Crypt_Hash('sha512-96');
}
/**
* @dataProvider hashData()
*/
public function testHash($message, $longResult)
{
parent::testHash($message, substr($longResult, 0, 24));
}
/**
* @dataProvider hmacData()
*/
public function testHMAC($key, $message, $longResult)
{
parent::testHMAC($key, $message, substr($longResult, 0, 24));
}
}

View File

@ -126,3 +126,7 @@ class Unit_Crypt_RC2Test extends PhpseclibTestCase
$this->assertEquals($result, $plaintext, "Failed asserting that decrypted result yielded $plaintext as a result in $engineName engine");
}
}
class RC2Test extends Unit_Crypt_RC2Test
{
}

View File

@ -250,3 +250,7 @@ class Unit_Crypt_RC4Test extends PhpseclibTestCase
}
}
}
class RC4Test extends Unit_Crypt_RC4Test
{
}

View File

@ -37,7 +37,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
-----END RSA PRIVATE KEY-----';
$this->assertTrue($rsa->loadKey($key));
$this->assertInternalType('string', $rsa->getPrivateKey());
$this->assertIsString($rsa->getPrivateKey());
}
public function testPKCS1SpacesKey()
@ -60,7 +60,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
$key = str_replace(array("\r", "\n", "\r\n"), ' ', $key);
$this->assertTrue($rsa->loadKey($key));
$this->assertInternalType('string', $rsa->getPrivateKey());
$this->assertIsString($rsa->getPrivateKey());
}
public function testPKCS1NoHeaderKey()
@ -80,7 +80,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0=';
$this->assertTrue($rsa->loadKey($key));
$this->assertInternalType('string', $rsa->getPrivateKey());
$this->assertIsString($rsa->getPrivateKey());
}
public function testPKCS1NoWhitespaceNoHeaderKey()
@ -100,7 +100,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
'37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0=';
$this->assertTrue($rsa->loadKey($key));
$this->assertInternalType('string', $rsa->getPrivateKey());
$this->assertIsString($rsa->getPrivateKey());
}
public function testRawPKCS1Key()
@ -121,7 +121,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
$key = base64_decode($key);
$this->assertTrue($rsa->loadKey($key));
$this->assertInternalType('string', $rsa->getPrivateKey());
$this->assertIsString($rsa->getPrivateKey());
}
public function testLoadPKCS8PrivateKey()
@ -160,7 +160,7 @@ xryZaRDVmtMuf/OZBQ==
-----END ENCRYPTED PRIVATE KEY-----';
$this->assertTrue($rsa->loadKey($key));
$this->assertInternalType('string', $rsa->getPrivateKey());
$this->assertIsString($rsa->getPrivateKey());
}
public function testSavePKCS8PrivateKey()
@ -184,8 +184,13 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
$this->assertTrue($rsa->loadKey($key));
<<<<<<< HEAD
$key = $rsa->getPrivateKey(RSA::PRIVATE_FORMAT_PKCS8);
$this->assertInternalType('string', $key);
=======
$key = $rsa->getPrivateKey(CRYPT_RSA_PRIVATE_FORMAT_PKCS8);
$this->assertIsString($key);
>>>>>>> 1.0
$this->assertTrue($rsa->loadKey($key));
}
@ -204,7 +209,7 @@ Ao8eayMp6FcvNucIpUndo1X8dKMv3Y26ZQIDAQAB
-----END RSA PUBLIC KEY-----';
$this->assertTrue($rsa->loadKey($key));
$this->assertInternalType('string', $rsa->getPublicKey());
$this->assertIsString($rsa->getPublicKey());
$this->assertFalse($rsa->getPrivateKey());
}
@ -223,7 +228,7 @@ ZQIDAQAB
-----END PUBLIC KEY-----';
$this->assertTrue($rsa->loadKey($key));
$this->assertInternalType('string', $rsa->getPublicKey());
$this->assertIsString($rsa->getPublicKey());
$this->assertFalse($rsa->getPrivateKey());
}
@ -237,7 +242,7 @@ ZQIDAQAB
'phpseclib-generated-key';
$this->assertTrue($rsa->loadKey($key));
$this->assertInternalType('string', $rsa->getPublicKey());
$this->assertIsString($rsa->getPublicKey());
$this->assertFalse($rsa->getPrivateKey());
}
@ -416,7 +421,7 @@ Ao8eayMp6FcvNucIpUndo1X8dKMv3Y26ZQIDAQAB
-----END RSA PUBLIC KEY-----';
$this->assertTrue($rsa->loadKey($key));
$this->assertInternalType('string', $rsa->getPublicKey());
$this->assertIsString($rsa->getPublicKey());
$this->assertFalse($rsa->loadKey('zzz'));
$this->assertFalse($rsa->getPublicKey());
}
@ -479,3 +484,7 @@ Vyaqr/WTPzxdXJAAAADHJvb3RAdmFncmFudAECAwQFBg==
$this->assertTrue($rsa->verify('zzz', $sig));
}
}
class LoadKeyTest extends Unit_Crypt_RSA_LoadKeyTest
{
}

View File

@ -116,3 +116,7 @@ k12yS6pCS3c+1wZ9cYFVtgfpSL4XpylLe9EnRT2GRVYCqUkR4AUeTuvnAgMBAAE=
$this->assertTrue($rsa->verify($payload, $sig));
}
}
class ModeTest extends Unit_Crypt_RSA_ModeTest
{
}

View File

@ -53,3 +53,7 @@ class Unit_Crypt_RandomTest extends PhpseclibTestCase
return array($x);
}
}
class RandomTest extends Unit_Crypt_RandomTest
{
}

View File

@ -198,3 +198,7 @@ class Unit_Crypt_TripleDESTest extends PhpseclibTestCase
}
}
}
class TripleDESTest extends Unit_Crypt_TripleDESTest
{
}

View File

@ -72,3 +72,7 @@ class Unit_Crypt_TwofishTest extends PhpseclibTestCase
}
}
}
class TwofishTest extends Unit_Crypt_TwofishTest
{
}

View File

@ -47,3 +47,7 @@ class Unit_File_ANSITest extends PhpseclibTestCase
$this->assertSame(str_repeat('z', 80), $lines[22]);
}
}
class ANSITest extends Unit_File_ANSITest
{
}

View File

@ -79,7 +79,7 @@ class Unit_File_ASN1Test extends PhpseclibTestCase
$decoded = $asn1->decodeBER(base64_decode($str));
$result = $asn1->asn1map($decoded[0], $AS_REP);
$this->assertInternalType('array', $result);
$this->assertIsArray($result);
}
/**
@ -231,7 +231,7 @@ class Unit_File_ASN1Test extends PhpseclibTestCase
$decoded = $asn1->decodeBER(base64_decode($str));
$result = $asn1->asn1map($decoded[0], $AS_REP);
$this->assertInternalType('array', $result);
$this->assertIsArray($result);
}
/**
@ -276,7 +276,7 @@ class Unit_File_ASN1Test extends PhpseclibTestCase
{
$asn1 = new ASN1();
$decoded = $asn1->decodeBER(base64_decode('MBaAFJtUo7c00HsI5EPZ4bkICfkOY2Pv'));
$this->assertInternalType('string', $decoded[0]['content'][0]['content']);
$this->assertIsString($decoded[0]['content'][0]['content']);
}
/**
@ -286,7 +286,7 @@ class Unit_File_ASN1Test extends PhpseclibTestCase
{
$asn1 = new ASN1();
$decoded = $asn1->decodeBER("\xa0\x00");
$this->assertInternalType('array', $decoded);
$this->assertIsArray($decoded);
$this->assertCount(0, $decoded[0]['content']);
}
@ -390,6 +390,10 @@ class Unit_File_ASN1Test extends PhpseclibTestCase
$a = $asn1->decodeBER($a);
$a = $asn1->asn1map($a[0], $map);
$this->assertInternalType('array', $a);
$this->assertIsArray($a);
}
}
class ASN1Test extends Unit_File_ASN1Test
{
}

View File

@ -27,7 +27,7 @@ v5RwaQHmQEzHofTzF7I+
$spkac = $x509->loadCSR($test);
$this->assertInternalType('array', $spkac);
$this->assertIsArray($spkac);
}
public function testCSRWithAttributes()
@ -67,7 +67,7 @@ draiRBZruwMPwPIP
$csr = $x509->loadCSR($test);
$this->assertInternalType('array', $csr);
$this->assertIsArray($csr);
}
public function testCSRDER()
@ -92,7 +92,7 @@ draiRBZruwMPwPIP
$csr = $x509->loadCSR($csr);
$this->assertInternalType('array', $csr);
$this->assertIsArray($csr);
}
// on PHP 7.1, with older versions of phpseclib, this would produce a "A non-numeric value encountered" warning
@ -119,3 +119,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
$x509->saveCSR($x509->signCSR('sha256WithRSAEncryption'), X509::FORMAT_DER);
}
}
class CSRTest extends Unit_File_X509_CSRTest
{
}

View File

@ -28,11 +28,11 @@ class Unit_File_X509_SPKACTest extends PhpseclibTestCase
$spkac = $x509->loadSPKAC($test);
$this->assertInternalType('array', $spkac);
$this->assertIsArray($spkac);
$spkac = $x509->loadSPKAC('SPKAC=' . $test);
$this->assertInternalType('array', $spkac);
$this->assertIsArray($spkac);
$this->assertTrue(
$x509->validateSignature(),
@ -41,7 +41,7 @@ class Unit_File_X509_SPKACTest extends PhpseclibTestCase
$pubKey = $x509->getPublicKey();
$this->assertInternalType('string', "$pubKey");
$this->assertIsString("$pubKey");
}
public function testSaveSPKAC()
@ -55,17 +55,17 @@ class Unit_File_X509_SPKACTest extends PhpseclibTestCase
$x509->setChallenge('...');
$spkac = $x509->signSPKAC();
$this->assertInternalType('array', $spkac);
$this->assertIsArray($spkac);
$this->assertInternalType('string', $x509->saveSPKAC($spkac));
$this->assertIsString($x509->saveSPKAC($spkac));
$x509 = new X509();
$x509->setPrivateKey($privKey);
$spkac = $x509->signSPKAC();
$this->assertInternalType('array', $spkac);
$this->assertIsArray($spkac);
$this->assertInternalType('string', $x509->saveSPKAC($spkac));
$this->assertIsString($x509->saveSPKAC($spkac));
}
public function testBadSignatureSPKAC()
@ -96,3 +96,7 @@ class Unit_File_X509_SPKACTest extends PhpseclibTestCase
);
}
}
class SPKACTest extends Unit_File_X509_SPKACTest
{
}

View File

@ -58,7 +58,7 @@ k6m17mi63YW/+iPCGOWZ2qXmY5HPEyyF2L4L4IDryFJ+8xLyw3pH9/yp5aHZDtp6
$cert = $x509->loadX509($test);
$this->assertInternalType('array', $cert['tbsCertificate']['extensions'][3]['extnValue']);
$this->assertIsArray($cert['tbsCertificate']['extensions'][3]['extnValue']);
}
public function testLoadUnsupportedExtension()
@ -920,3 +920,7 @@ mDaPrsUl15evEah6amsBfpQiWRbKpDLKs1kF
$this->assertFalse($r);
}
}
class X509Test extends Unit_File_X509_X509Test
{
}

View File

@ -18,3 +18,7 @@ class Unit_Math_BigInteger_BCMathTest extends Unit_Math_BigInteger_TestCase
self::ensureConstant('MATH_BIGINTEGER_MODE', \phpseclib\Math\BigInteger::MODE_BCMATH);
}
}
class BCMathTest extends Unit_Math_BigInteger_BCMathTest
{
}

View File

@ -18,3 +18,7 @@ class Unit_Math_BigInteger_GMPTest extends Unit_Math_BigInteger_TestCase
self::ensureConstant('MATH_BIGINTEGER_MODE', \phpseclib\Math\BigInteger::MODE_GMP);
}
}
class GMPTest extends Unit_Math_BigInteger_GMPTest
{
}

View File

@ -18,3 +18,7 @@ class Unit_Math_BigInteger_InternalOpenSSLTest extends Unit_Math_BigInteger_Test
self::ensureConstant('MATH_BIGINTEGER_MODE', \phpseclib\Math\BigInteger::MODE_INTERNAL);
}
}
class InternalOpenSSLTest extends Unit_Math_BigInteger_InternalOpenSSLTest
{
}

View File

@ -22,3 +22,7 @@ class Unit_Math_BigInteger_InternalTest extends Unit_Math_BigInteger_TestCase
$this->assertSame($x->value, $y->value);
}
}
class InternalTest extends Unit_Math_BigInteger_InternalTest
{
}

View File

@ -399,7 +399,7 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
{
$num = $this->getInstance(50);
$str = print_r($num, true);
$this->assertContains('[value] => 0x32', $str);
$this->assertStringContainsString('[value] => 0x32', $str);
return $str;
}

View File

@ -7,7 +7,7 @@
use phpseclib\Net\SFTP\Stream;
class Unit_Net_SFTPStreamTest extends PhpseclibTestCase
class Unit_Net_SFTPStreamUnitTest extends PhpseclibTestCase
{
public function testRegisterWithoutArgument()
{
@ -24,3 +24,7 @@ class Unit_Net_SFTPStreamTest extends PhpseclibTestCase
$this->assertTrue(stream_wrapper_unregister($protocol));
}
}
class SFTPStreamUnitTest extends Unit_Net_SFTPStreamUnitTest
{
}

View File

@ -39,3 +39,7 @@ class Unit_Net_SSH1Test extends PhpseclibTestCase
$this->assertEquals($expected, $result);
}
}
class SSH1Test extends Unit_Net_SSH1Test
{
}

View File

@ -6,7 +6,7 @@
* @license http://www.opensource.org/licenses/mit-license.html MIT License
*/
class Unit_Net_SSH2Test extends PhpseclibTestCase
class Unit_Net_SSH2UnitTest extends PhpseclibTestCase
{
public function formatLogDataProvider()
{
@ -46,25 +46,25 @@ class Unit_Net_SSH2Test extends PhpseclibTestCase
}
if (extension_loaded('openssl')) {
$this->assertContains('openssl', $identifier);
$this->assertNotContains('mcrypt', $identifier);
$this->assertStringContainsString('openssl', $identifier);
$this->assertStringNotContainsString('mcrypt', $identifier);
} elseif (extension_loaded('mcrypt')) {
$this->assertNotContains('openssl', $identifier);
$this->assertContains('mcrypt', $identifier);
$this->assertStringNotContainsString('openssl', $identifier);
$this->assertStringContainsString('mcrypt', $identifier);
} else {
$this->assertNotContains('openssl', $identifier);
$this->assertNotContains('mcrypt', $identifier);
$this->assertStringNotContainsString('openssl', $identifier);
$this->assertStringNotContainsString('mcrypt', $identifier);
}
if (extension_loaded('gmp')) {
$this->assertContains('gmp', $identifier);
$this->assertNotContains('bcmath', $identifier);
$this->assertStringContainsString('gmp', $identifier);
$this->assertStringNotContainsString('bcmath', $identifier);
} elseif (extension_loaded('bcmath')) {
$this->assertNotContains('gmp', $identifier);
$this->assertContains('bcmath', $identifier);
$this->assertStringNotContainsString('gmp', $identifier);
$this->assertStringContainsString('bcmath', $identifier);
} else {
$this->assertNotContains('gmp', $identifier);
$this->assertNotContains('bcmath', $identifier);
$this->assertStringNotContainsString('gmp', $identifier);
$this->assertStringNotContainsString('bcmath', $identifier);
}
}
@ -121,3 +121,7 @@ class Unit_Net_SSH2Test extends PhpseclibTestCase
->getMock();
}
}
class SSH2UnitTest extends Unit_Net_SSH2UnitTest
{
}

View File

@ -20,6 +20,17 @@ then
PHPUNIT_ARGS="$PHPUNIT_ARGS -d zend.enable_gc=0"
fi
if [ `php -r "echo (int) version_compare(PHP_VERSION, '7.3', '>=');"` = "1" ]
then
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/n setUpBeforeClass()/n setUpBeforeClass(): void/g'
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/n setUp()/n setUp(): void/g'
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/n tearDown()/n tearDown(): void/g'
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertIsArray([^)]*)\)/\1: void/g'
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertIsString([^)]*)\)/\1: void/g'
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertStringContainsString([^)]*)\)/\1: void/g'
find tests -type f -name "*.php" -print0 | xargs -0 sed -i 's/\(n assertStringNotContainsString([^)]*)\)/\1: void/g'
fi
if [ "$TRAVIS_PHP_VERSION" = 'hhvm' -o `php -r "echo (int) version_compare(PHP_VERSION, '7.0', '>=');"` = "1" ]
then
find tests -type f -name "*Test.php" | \