mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-27 00:58:25 +00:00
enable unit tests for PHP 8 / PHPUnit 9
This commit is contained in:
parent
ee4af462b6
commit
266f16816a
@ -22,13 +22,15 @@ matrix:
|
|||||||
dist: xenial
|
dist: xenial
|
||||||
- php: 7.4
|
- php: 7.4
|
||||||
dist: xenial
|
dist: xenial
|
||||||
|
- php: 8.0
|
||||||
|
dist: bionic
|
||||||
|
|
||||||
before_install: true
|
before_install: true
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- wget http://ftp.gnu.org/gnu/parallel/parallel-20170822.tar.bz2
|
- wget http://ftp.gnu.org/gnu/parallel/parallel-20170822.tar.bz2
|
||||||
- tar -xvjf parallel*
|
- tar -xvjf parallel*
|
||||||
- cd parallel*
|
- cd parallel-20170822
|
||||||
- ./configure
|
- ./configure
|
||||||
- make
|
- make
|
||||||
- sudo make install
|
- sudo make install
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phing/phing": "~2.7",
|
"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"
|
"squizlabs/php_codesniffer": "~2.0"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
|
@ -342,19 +342,20 @@ class File_ANSI
|
|||||||
$mods = explode(';', $match[1]);
|
$mods = explode(';', $match[1]);
|
||||||
foreach ($mods as $mod) {
|
foreach ($mods as $mod) {
|
||||||
switch ($mod) {
|
switch ($mod) {
|
||||||
case 0: // Turn off character attributes
|
case '':
|
||||||
|
case '0': // Turn off character attributes
|
||||||
$attr_cell = clone($this->base_attr_cell);
|
$attr_cell = clone($this->base_attr_cell);
|
||||||
break;
|
break;
|
||||||
case 1: // Turn bold mode on
|
case '1': // Turn bold mode on
|
||||||
$attr_cell->bold = true;
|
$attr_cell->bold = true;
|
||||||
break;
|
break;
|
||||||
case 4: // Turn underline mode on
|
case '4': // Turn underline mode on
|
||||||
$attr_cell->underline = true;
|
$attr_cell->underline = true;
|
||||||
break;
|
break;
|
||||||
case 5: // Turn blinking mode on
|
case '5': // Turn blinking mode on
|
||||||
$attr_cell->blink = true;
|
$attr_cell->blink = true;
|
||||||
break;
|
break;
|
||||||
case 7: // Turn reverse video on
|
case '7': // Turn reverse video on
|
||||||
$attr_cell->reverse = !$attr_cell->reverse;
|
$attr_cell->reverse = !$attr_cell->reverse;
|
||||||
$temp = $attr_cell->background;
|
$temp = $attr_cell->background;
|
||||||
$attr_cell->background = $attr_cell->foreground;
|
$attr_cell->background = $attr_cell->foreground;
|
||||||
@ -367,23 +368,23 @@ class File_ANSI
|
|||||||
$back = &$attr_cell->{ $attr_cell->reverse ? 'foreground' : 'background' };
|
$back = &$attr_cell->{ $attr_cell->reverse ? 'foreground' : 'background' };
|
||||||
switch ($mod) {
|
switch ($mod) {
|
||||||
// @codingStandardsIgnoreStart
|
// @codingStandardsIgnoreStart
|
||||||
case 30: $front = 'black'; break;
|
case '30': $front = 'black'; break;
|
||||||
case 31: $front = 'red'; break;
|
case '31': $front = 'red'; break;
|
||||||
case 32: $front = 'green'; break;
|
case '32': $front = 'green'; break;
|
||||||
case 33: $front = 'yellow'; break;
|
case '33': $front = 'yellow'; break;
|
||||||
case 34: $front = 'blue'; break;
|
case '34': $front = 'blue'; break;
|
||||||
case 35: $front = 'magenta'; break;
|
case '35': $front = 'magenta'; break;
|
||||||
case 36: $front = 'cyan'; break;
|
case '36': $front = 'cyan'; break;
|
||||||
case 37: $front = 'white'; break;
|
case '37': $front = 'white'; break;
|
||||||
|
|
||||||
case 40: $back = 'black'; break;
|
case '40': $back = 'black'; break;
|
||||||
case 41: $back = 'red'; break;
|
case '41': $back = 'red'; break;
|
||||||
case 42: $back = 'green'; break;
|
case '42': $back = 'green'; break;
|
||||||
case 43: $back = 'yellow'; break;
|
case '43': $back = 'yellow'; break;
|
||||||
case 44: $back = 'blue'; break;
|
case '44': $back = 'blue'; break;
|
||||||
case 45: $back = 'magenta'; break;
|
case '45': $back = 'magenta'; break;
|
||||||
case 46: $back = 'cyan'; break;
|
case '46': $back = 'cyan'; break;
|
||||||
case 47: $back = 'white'; break;
|
case '47': $back = 'white'; break;
|
||||||
// @codingStandardsIgnoreEnd
|
// @codingStandardsIgnoreEnd
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -86,3 +86,7 @@ class Functional_Net_SCPSSH2UserStoryTest extends PhpseclibFunctionalTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SCPSSH2UserStoryTest extends Functional_Net_SCPSSH2UserStoryTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -40,3 +40,7 @@ class Functional_Net_SFTPLargeFileTest extends Functional_Net_SFTPTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SFTPLargeFileTest extends Functional_Net_SFTPLargeFileTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -46,3 +46,7 @@ class Functional_Net_SFTPStreamTest extends Functional_Net_SFTPTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SFTPStreamTest extends Functional_Net_SFTPStreamTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -133,7 +133,7 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
|
|||||||
return $sftp;
|
return $sftp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function callback($length)
|
static function demoCallback($length)
|
||||||
{
|
{
|
||||||
$r = substr(self::$buffer, 0, $length);
|
$r = substr(self::$buffer, 0, $length);
|
||||||
self::$buffer = substr(self::$buffer, $length);
|
self::$buffer = substr(self::$buffer, $length);
|
||||||
@ -150,7 +150,7 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
|
|||||||
{
|
{
|
||||||
self::$buffer = self::$exampleData;
|
self::$buffer = self::$exampleData;
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$sftp->put('file1.txt', array(__CLASS__, 'callback'), NET_SFTP_CALLBACK),
|
$sftp->put('file1.txt', array(__CLASS__, 'demoCallback'), NET_SFTP_CALLBACK),
|
||||||
'Failed asserting that example data could be successfully put().'
|
'Failed asserting that example data could be successfully put().'
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -437,8 +437,7 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
|
|||||||
*/
|
*/
|
||||||
public function testReadlink($sftp)
|
public function testReadlink($sftp)
|
||||||
{
|
{
|
||||||
$this->assertInternalType(
|
$this->assertIsString(
|
||||||
'string',
|
|
||||||
$sftp->readlink('symlink'),
|
$sftp->readlink('symlink'),
|
||||||
'Failed asserting that a symlink\'s target could be read'
|
'Failed asserting that a symlink\'s target could be read'
|
||||||
);
|
);
|
||||||
@ -453,14 +452,12 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
|
|||||||
public function testStatOnCWD($sftp)
|
public function testStatOnCWD($sftp)
|
||||||
{
|
{
|
||||||
$stat = $sftp->stat('.');
|
$stat = $sftp->stat('.');
|
||||||
$this->assertInternalType(
|
$this->assertIsArray(
|
||||||
'array',
|
|
||||||
$stat,
|
$stat,
|
||||||
'Failed asserting that stat on . returns an array'
|
'Failed asserting that stat on . returns an array'
|
||||||
);
|
);
|
||||||
$lstat = $sftp->lstat('.');
|
$lstat = $sftp->lstat('.');
|
||||||
$this->assertInternalType(
|
$this->assertIsArray(
|
||||||
'array',
|
|
||||||
$lstat,
|
$lstat,
|
||||||
'Failed asserting that lstat on . returns an array'
|
'Failed asserting that lstat on . returns an array'
|
||||||
);
|
);
|
||||||
@ -602,8 +599,7 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase
|
|||||||
'Failed asserting that scratch directory could ' .
|
'Failed asserting that scratch directory could ' .
|
||||||
'be created.'
|
'be created.'
|
||||||
);
|
);
|
||||||
$this->assertInternalType(
|
$this->assertIsArray(
|
||||||
'array',
|
|
||||||
$sftp->stat(self::$scratchDir),
|
$sftp->stat(self::$scratchDir),
|
||||||
'Failed asserting that stat on an existant empty directory returns an array'
|
'Failed asserting that stat on an existant empty directory returns an array'
|
||||||
);
|
);
|
||||||
@ -750,3 +746,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);
|
$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
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -50,3 +50,7 @@ class Functional_Net_SSH2AgentTest extends PhpseclibFunctionalTestCase
|
|||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SSH2AgentTest extends Functional_Net_SSH2AgentTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -122,7 +122,7 @@ class Functional_Net_SSH2Test extends PhpseclibFunctionalTestCase
|
|||||||
{
|
{
|
||||||
$ssh = new Net_SSH2($this->getEnv('SSH_HOSTNAME'));
|
$ssh = new Net_SSH2($this->getEnv('SSH_HOSTNAME'));
|
||||||
|
|
||||||
$this->assertInternalType('string', $ssh->getServerPublicHostKey());
|
$this->assertIsString($ssh->getServerPublicHostKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testOpenSocketConnect()
|
public function testOpenSocketConnect()
|
||||||
@ -170,3 +170,7 @@ class Functional_Net_SSH2Test extends PhpseclibFunctionalTestCase
|
|||||||
$ssh->read();
|
$ssh->read();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SSH2Test extends Functional_Net_SSH2Test
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,3 +12,7 @@ class Unit_Crypt_AES_McryptTest extends Unit_Crypt_AES_TestCase
|
|||||||
$this->engine = CRYPT_ENGINE_MCRYPT;
|
$this->engine = CRYPT_ENGINE_MCRYPT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class McryptTest extends Unit_Crypt_AES_McryptTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -12,3 +12,7 @@ class Unit_Crypt_AES_OpenSSLTest extends Unit_Crypt_AES_TestCase
|
|||||||
$this->engine = CRYPT_ENGINE_OPENSSL;
|
$this->engine = CRYPT_ENGINE_OPENSSL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class OpenSSLTest extends Unit_Crypt_AES_OpenSSLTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -5,10 +5,14 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Unit_Crypt_AES_InternalTest extends Unit_Crypt_AES_TestCase
|
class Unit_Crypt_AES_PurePHPTest extends Unit_Crypt_AES_TestCase
|
||||||
{
|
{
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->engine = CRYPT_ENGINE_INTERNAL;
|
$this->engine = CRYPT_ENGINE_INTERNAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PurePHPTest extends Unit_Crypt_AES_PurePHPTest
|
||||||
|
{
|
||||||
|
}
|
@ -128,3 +128,7 @@ class Unit_Crypt_BlowfishTest extends PhpseclibTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class BlowfishTest extends Unit_Crypt_BlowfishTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -75,3 +75,7 @@ class Unit_Crypt_DESTest extends PhpseclibTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DESTest extends Unit_Crypt_DESTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -45,3 +45,7 @@ class Unit_Crypt_Hash_MD5Test extends Unit_Crypt_Hash_TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MD5Test extends Unit_Crypt_Hash_MD5Test
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -77,3 +77,7 @@ class Unit_Crypt_Hash_SHA256Test extends Unit_Crypt_Hash_TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SHA256Test extends Unit_Crypt_Hash_SHA256Test
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
require_once 'SHA256Test.php';
|
||||||
|
|
||||||
class Unit_Crypt_Hash_SHA256_96Test extends Unit_Crypt_Hash_SHA256Test
|
class Unit_Crypt_Hash_SHA256_96Test extends Unit_Crypt_Hash_SHA256Test
|
||||||
{
|
{
|
||||||
public function getInstance()
|
public function getInstance()
|
||||||
@ -28,3 +30,27 @@ class Unit_Crypt_Hash_SHA256_96Test extends Unit_Crypt_Hash_SHA256Test
|
|||||||
parent::testHMAC($key, $message, substr($longResult, 0, 24));
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -77,3 +77,7 @@ class Unit_Crypt_Hash_SHA512Test extends Unit_Crypt_Hash_TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SHA512Test extends Unit_Crypt_Hash_SHA512Test
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
require_once 'SHA512Test.php';
|
||||||
|
|
||||||
class Unit_Crypt_Hash_SHA512_96Test extends Unit_Crypt_Hash_SHA512Test
|
class Unit_Crypt_Hash_SHA512_96Test extends Unit_Crypt_Hash_SHA512Test
|
||||||
{
|
{
|
||||||
public function getInstance()
|
public function getInstance()
|
||||||
@ -28,3 +30,27 @@ class Unit_Crypt_Hash_SHA512_96Test extends Unit_Crypt_Hash_SHA512Test
|
|||||||
parent::testHMAC($key, $message, substr($longResult, 0, 24));
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -125,3 +125,7 @@ class Unit_Crypt_RC2Test extends PhpseclibTestCase
|
|||||||
$this->assertEquals($result, $plaintext, "Failed asserting that decrypted result yielded $plaintext as a result in $engineName engine");
|
$this->assertEquals($result, $plaintext, "Failed asserting that decrypted result yielded $plaintext as a result in $engineName engine");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RC2Test extends Unit_Crypt_RC2Test
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -248,3 +248,7 @@ class Unit_Crypt_RC4Test extends PhpseclibTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RC4Test extends Unit_Crypt_RC4Test
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once 'Crypt/RSA.php' ;
|
require_once 'Crypt/RSA.php';
|
||||||
|
|
||||||
class Unit_Crypt_RSA_LoadKeyTest extends PhpseclibTestCase
|
class Unit_Crypt_RSA_LoadKeyTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
@ -37,7 +37,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
|
|||||||
-----END RSA PRIVATE KEY-----';
|
-----END RSA PRIVATE KEY-----';
|
||||||
|
|
||||||
$this->assertTrue($rsa->loadKey($key));
|
$this->assertTrue($rsa->loadKey($key));
|
||||||
$this->assertInternalType('string', $rsa->getPrivateKey());
|
$this->assertIsString($rsa->getPrivateKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPKCS1SpacesKey()
|
public function testPKCS1SpacesKey()
|
||||||
@ -60,7 +60,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
|
|||||||
$key = str_replace(array("\r", "\n", "\r\n"), ' ', $key);
|
$key = str_replace(array("\r", "\n", "\r\n"), ' ', $key);
|
||||||
|
|
||||||
$this->assertTrue($rsa->loadKey($key));
|
$this->assertTrue($rsa->loadKey($key));
|
||||||
$this->assertInternalType('string', $rsa->getPrivateKey());
|
$this->assertIsString($rsa->getPrivateKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPKCS1NoHeaderKey()
|
public function testPKCS1NoHeaderKey()
|
||||||
@ -80,7 +80,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
|
|||||||
37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0=';
|
37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0=';
|
||||||
|
|
||||||
$this->assertTrue($rsa->loadKey($key));
|
$this->assertTrue($rsa->loadKey($key));
|
||||||
$this->assertInternalType('string', $rsa->getPrivateKey());
|
$this->assertIsString($rsa->getPrivateKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPKCS1NoWhitespaceNoHeaderKey()
|
public function testPKCS1NoWhitespaceNoHeaderKey()
|
||||||
@ -100,7 +100,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
|
|||||||
'37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0=';
|
'37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0=';
|
||||||
|
|
||||||
$this->assertTrue($rsa->loadKey($key));
|
$this->assertTrue($rsa->loadKey($key));
|
||||||
$this->assertInternalType('string', $rsa->getPrivateKey());
|
$this->assertIsString($rsa->getPrivateKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRawPKCS1Key()
|
public function testRawPKCS1Key()
|
||||||
@ -121,7 +121,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
|
|||||||
$key = base64_decode($key);
|
$key = base64_decode($key);
|
||||||
|
|
||||||
$this->assertTrue($rsa->loadKey($key));
|
$this->assertTrue($rsa->loadKey($key));
|
||||||
$this->assertInternalType('string', $rsa->getPrivateKey());
|
$this->assertIsString($rsa->getPrivateKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLoadPKCS8PrivateKey()
|
public function testLoadPKCS8PrivateKey()
|
||||||
@ -160,7 +160,7 @@ xryZaRDVmtMuf/OZBQ==
|
|||||||
-----END ENCRYPTED PRIVATE KEY-----';
|
-----END ENCRYPTED PRIVATE KEY-----';
|
||||||
|
|
||||||
$this->assertTrue($rsa->loadKey($key));
|
$this->assertTrue($rsa->loadKey($key));
|
||||||
$this->assertInternalType('string', $rsa->getPrivateKey());
|
$this->assertIsString($rsa->getPrivateKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSavePKCS8PrivateKey()
|
public function testSavePKCS8PrivateKey()
|
||||||
@ -185,7 +185,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
|
|||||||
$this->assertTrue($rsa->loadKey($key));
|
$this->assertTrue($rsa->loadKey($key));
|
||||||
|
|
||||||
$key = $rsa->getPrivateKey(CRYPT_RSA_PRIVATE_FORMAT_PKCS8);
|
$key = $rsa->getPrivateKey(CRYPT_RSA_PRIVATE_FORMAT_PKCS8);
|
||||||
$this->assertInternalType('string', $key);
|
$this->assertIsString($key);
|
||||||
|
|
||||||
$this->assertTrue($rsa->loadKey($key));
|
$this->assertTrue($rsa->loadKey($key));
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ Ao8eayMp6FcvNucIpUndo1X8dKMv3Y26ZQIDAQAB
|
|||||||
-----END RSA PUBLIC KEY-----';
|
-----END RSA PUBLIC KEY-----';
|
||||||
|
|
||||||
$this->assertTrue($rsa->loadKey($key));
|
$this->assertTrue($rsa->loadKey($key));
|
||||||
$this->assertInternalType('string', $rsa->getPublicKey());
|
$this->assertIsString($rsa->getPublicKey());
|
||||||
$this->assertFalse($rsa->getPrivateKey());
|
$this->assertFalse($rsa->getPrivateKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ ZQIDAQAB
|
|||||||
-----END PUBLIC KEY-----';
|
-----END PUBLIC KEY-----';
|
||||||
|
|
||||||
$this->assertTrue($rsa->loadKey($key));
|
$this->assertTrue($rsa->loadKey($key));
|
||||||
$this->assertInternalType('string', $rsa->getPublicKey());
|
$this->assertIsString($rsa->getPublicKey());
|
||||||
$this->assertFalse($rsa->getPrivateKey());
|
$this->assertFalse($rsa->getPrivateKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ ZQIDAQAB
|
|||||||
'phpseclib-generated-key';
|
'phpseclib-generated-key';
|
||||||
|
|
||||||
$this->assertTrue($rsa->loadKey($key));
|
$this->assertTrue($rsa->loadKey($key));
|
||||||
$this->assertInternalType('string', $rsa->getPublicKey());
|
$this->assertIsString($rsa->getPublicKey());
|
||||||
$this->assertFalse($rsa->getPrivateKey());
|
$this->assertFalse($rsa->getPrivateKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,7 +415,7 @@ Ao8eayMp6FcvNucIpUndo1X8dKMv3Y26ZQIDAQAB
|
|||||||
-----END RSA PUBLIC KEY-----';
|
-----END RSA PUBLIC KEY-----';
|
||||||
|
|
||||||
$this->assertTrue($rsa->loadKey($key));
|
$this->assertTrue($rsa->loadKey($key));
|
||||||
$this->assertInternalType('string', $rsa->getPublicKey());
|
$this->assertIsString($rsa->getPublicKey());
|
||||||
$this->assertFalse($rsa->loadKey('zzz'));
|
$this->assertFalse($rsa->loadKey('zzz'));
|
||||||
$this->assertFalse($rsa->getPublicKey());
|
$this->assertFalse($rsa->getPublicKey());
|
||||||
}
|
}
|
||||||
@ -478,3 +478,7 @@ Vyaqr/WTPzxdXJAAAADHJvb3RAdmFncmFudAECAwQFBg==
|
|||||||
$this->assertTrue($rsa->verify('zzz', $sig));
|
$this->assertTrue($rsa->verify('zzz', $sig));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class LoadKeyTest extends Unit_Crypt_RSA_LoadKeyTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once 'Crypt/RSA.php' ;
|
require_once 'Crypt/RSA.php';
|
||||||
|
|
||||||
class Unit_Crypt_RSA_ModeTest extends PhpseclibTestCase
|
class Unit_Crypt_RSA_ModeTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
@ -116,3 +116,7 @@ k12yS6pCS3c+1wZ9cYFVtgfpSL4XpylLe9EnRT2GRVYCqUkR4AUeTuvnAgMBAAE=
|
|||||||
$this->assertTrue($rsa->verify($payload, $sig));
|
$this->assertTrue($rsa->verify($payload, $sig));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ModeTest extends Unit_Crypt_RSA_ModeTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -51,3 +51,7 @@ class Unit_Crypt_RandomTest extends PhpseclibTestCase
|
|||||||
return array($x);
|
return array($x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RandomTest extends Unit_Crypt_RandomTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -186,3 +186,7 @@ class Unit_Crypt_TripleDESTest extends PhpseclibTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TripleDESTest extends Unit_Crypt_TripleDESTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -71,3 +71,7 @@ class Unit_Crypt_TwofishTest extends PhpseclibTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TwofishTest extends Unit_Crypt_TwofishTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -47,3 +47,7 @@ class Unit_File_ANSITest extends PhpseclibTestCase
|
|||||||
$this->assertSame(str_repeat('z', 80), $lines[22]);
|
$this->assertSame(str_repeat('z', 80), $lines[22]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ANSITest extends Unit_File_ANSITest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -79,7 +79,7 @@ class Unit_File_ASN1Test extends PhpseclibTestCase
|
|||||||
$decoded = $asn1->decodeBER(base64_decode($str));
|
$decoded = $asn1->decodeBER(base64_decode($str));
|
||||||
$result = $asn1->asn1map($decoded[0], $AS_REP);
|
$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));
|
$decoded = $asn1->decodeBER(base64_decode($str));
|
||||||
$result = $asn1->asn1map($decoded[0], $AS_REP);
|
$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 File_ASN1();
|
$asn1 = new File_ASN1();
|
||||||
$decoded = $asn1->decodeBER(base64_decode('MBaAFJtUo7c00HsI5EPZ4bkICfkOY2Pv'));
|
$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 File_ASN1();
|
$asn1 = new File_ASN1();
|
||||||
$decoded = $asn1->decodeBER("\xa0\x00");
|
$decoded = $asn1->decodeBER("\xa0\x00");
|
||||||
$this->assertInternalType('array', $decoded);
|
$this->assertIsArray($decoded);
|
||||||
$this->assertCount(0, $decoded[0]['content']);
|
$this->assertCount(0, $decoded[0]['content']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,6 +390,10 @@ class Unit_File_ASN1Test extends PhpseclibTestCase
|
|||||||
$a = $asn1->decodeBER($a);
|
$a = $asn1->decodeBER($a);
|
||||||
$a = $asn1->asn1map($a[0], $map);
|
$a = $asn1->asn1map($a[0], $map);
|
||||||
|
|
||||||
$this->assertInternalType('array', $a);
|
$this->assertIsArray($a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ASN1Test extends Unit_File_ASN1Test
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -27,7 +27,7 @@ v5RwaQHmQEzHofTzF7I+
|
|||||||
|
|
||||||
$spkac = $x509->loadCSR($test);
|
$spkac = $x509->loadCSR($test);
|
||||||
|
|
||||||
$this->assertInternalType('array', $spkac);
|
$this->assertIsArray($spkac);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCSRWithAttributes()
|
public function testCSRWithAttributes()
|
||||||
@ -67,7 +67,7 @@ draiRBZruwMPwPIP
|
|||||||
|
|
||||||
$csr = $x509->loadCSR($test);
|
$csr = $x509->loadCSR($test);
|
||||||
|
|
||||||
$this->assertInternalType('array', $csr);
|
$this->assertIsArray($csr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCSRDER()
|
public function testCSRDER()
|
||||||
@ -92,7 +92,7 @@ draiRBZruwMPwPIP
|
|||||||
|
|
||||||
$csr = $x509->loadCSR($csr);
|
$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
|
// 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'), FILE_X509_FORMAT_DER);
|
$x509->saveCSR($x509->signCSR('sha256WithRSAEncryption'), FILE_X509_FORMAT_DER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class CSRTest extends Unit_File_X509_CSRTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -28,11 +28,11 @@ class Unit_File_X509_SPKACTest extends PhpseclibTestCase
|
|||||||
|
|
||||||
$spkac = $x509->loadSPKAC($test);
|
$spkac = $x509->loadSPKAC($test);
|
||||||
|
|
||||||
$this->assertInternalType('array', $spkac);
|
$this->assertIsArray($spkac);
|
||||||
|
|
||||||
$spkac = $x509->loadSPKAC('SPKAC=' . $test);
|
$spkac = $x509->loadSPKAC('SPKAC=' . $test);
|
||||||
|
|
||||||
$this->assertInternalType('array', $spkac);
|
$this->assertIsArray($spkac);
|
||||||
|
|
||||||
$this->assertTrue(
|
$this->assertTrue(
|
||||||
$x509->validateSignature(),
|
$x509->validateSignature(),
|
||||||
@ -41,7 +41,7 @@ class Unit_File_X509_SPKACTest extends PhpseclibTestCase
|
|||||||
|
|
||||||
$pubKey = $x509->getPublicKey();
|
$pubKey = $x509->getPublicKey();
|
||||||
|
|
||||||
$this->assertInternalType('string', "$pubKey");
|
$this->assertIsString("$pubKey");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSaveSPKAC()
|
public function testSaveSPKAC()
|
||||||
@ -55,17 +55,17 @@ class Unit_File_X509_SPKACTest extends PhpseclibTestCase
|
|||||||
$x509->setChallenge('...');
|
$x509->setChallenge('...');
|
||||||
|
|
||||||
$spkac = $x509->signSPKAC();
|
$spkac = $x509->signSPKAC();
|
||||||
$this->assertInternalType('array', $spkac);
|
$this->assertIsArray($spkac);
|
||||||
|
|
||||||
$this->assertInternalType('string', $x509->saveSPKAC($spkac));
|
$this->assertIsString($x509->saveSPKAC($spkac));
|
||||||
|
|
||||||
$x509 = new File_X509();
|
$x509 = new File_X509();
|
||||||
$x509->setPrivateKey($privKey);
|
$x509->setPrivateKey($privKey);
|
||||||
|
|
||||||
$spkac = $x509->signSPKAC();
|
$spkac = $x509->signSPKAC();
|
||||||
$this->assertInternalType('array', $spkac);
|
$this->assertIsArray($spkac);
|
||||||
|
|
||||||
$this->assertInternalType('string', $x509->saveSPKAC($spkac));
|
$this->assertIsString($x509->saveSPKAC($spkac));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBadSignatureSPKAC()
|
public function testBadSignatureSPKAC()
|
||||||
@ -96,3 +96,7 @@ class Unit_File_X509_SPKACTest extends PhpseclibTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SPKACTest extends Unit_File_X509_SPKACTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -55,7 +55,7 @@ k6m17mi63YW/+iPCGOWZ2qXmY5HPEyyF2L4L4IDryFJ+8xLyw3pH9/yp5aHZDtp6
|
|||||||
|
|
||||||
$cert = $x509->loadX509($test);
|
$cert = $x509->loadX509($test);
|
||||||
|
|
||||||
$this->assertInternalType('array', $cert['tbsCertificate']['extensions'][3]['extnValue']);
|
$this->assertIsArray($cert['tbsCertificate']['extensions'][3]['extnValue']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLoadUnsupportedExtension()
|
public function testLoadUnsupportedExtension()
|
||||||
@ -856,3 +856,7 @@ mDaPrsUl15evEah6amsBfpQiWRbKpDLKs1kF
|
|||||||
$this->assertFalse($r);
|
$this->assertFalse($r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class X509Test extends Unit_File_X509_X509Test
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -18,3 +18,7 @@ class Unit_Math_BigInteger_BCMathTest extends Unit_Math_BigInteger_TestCase
|
|||||||
self::ensureConstant('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_BCMATH);
|
self::ensureConstant('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_BCMATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class BCMathTest extends Unit_Math_BigInteger_BCMathTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -18,3 +18,7 @@ class Unit_Math_BigInteger_GMPTest extends Unit_Math_BigInteger_TestCase
|
|||||||
self::ensureConstant('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_GMP);
|
self::ensureConstant('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_GMP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class GMPTest extends Unit_Math_BigInteger_GMPTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -18,3 +18,7 @@ class Unit_Math_BigInteger_InternalOpenSSLTest extends Unit_Math_BigInteger_Test
|
|||||||
self::ensureConstant('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_INTERNAL);
|
self::ensureConstant('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_INTERNAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class InternalOpenSSLTest extends Unit_Math_BigInteger_InternalOpenSSLTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -22,3 +22,7 @@ class Unit_Math_BigInteger_InternalTest extends Unit_Math_BigInteger_TestCase
|
|||||||
$this->assertSame($x->value, $y->value);
|
$this->assertSame($x->value, $y->value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class InternalTest extends Unit_Math_BigInteger_InternalTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -402,7 +402,7 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
|
|||||||
{
|
{
|
||||||
$num = $this->getInstance(50);
|
$num = $this->getInstance(50);
|
||||||
$str = print_r($num, true);
|
$str = print_r($num, true);
|
||||||
$this->assertContains('[value] => 0x32', $str);
|
$this->assertStringContainsString('[value] => 0x32', $str);
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
require_once 'Net/SFTP/Stream.php';
|
require_once 'Net/SFTP/Stream.php';
|
||||||
|
|
||||||
class Unit_Net_SFTPStreamTest extends PhpseclibTestCase
|
class Unit_Net_SFTPStreamUnitTest extends PhpseclibTestCase
|
||||||
{
|
{
|
||||||
protected $protocol = 'sftptest';
|
protected $protocol = 'sftptest';
|
||||||
|
|
||||||
@ -31,3 +31,7 @@ class Unit_Net_SFTPStreamTest extends PhpseclibTestCase
|
|||||||
$this->assertContains($this->protocol, stream_get_wrappers());
|
$this->assertContains($this->protocol, stream_get_wrappers());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SFTPStreamUnitTest extends Unit_Net_SFTPStreamUnitTest
|
||||||
|
{
|
||||||
|
}
|
@ -39,3 +39,7 @@ class Unit_Net_SSH1Test extends PhpseclibTestCase
|
|||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SSH1Test extends Unit_Net_SSH1Test
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
* @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()
|
public function formatLogDataProvider()
|
||||||
{
|
{
|
||||||
@ -42,25 +42,25 @@ class Unit_Net_SSH2Test extends PhpseclibTestCase
|
|||||||
$this->assertStringStartsWith('SSH-2.0-phpseclib_1.0', $identifier);
|
$this->assertStringStartsWith('SSH-2.0-phpseclib_1.0', $identifier);
|
||||||
|
|
||||||
if (extension_loaded('openssl')) {
|
if (extension_loaded('openssl')) {
|
||||||
$this->assertContains('openssl', $identifier);
|
$this->assertStringContainsString('openssl', $identifier);
|
||||||
$this->assertNotContains('mcrypt', $identifier);
|
$this->assertStringNotContainsString('mcrypt', $identifier);
|
||||||
} elseif (extension_loaded('mcrypt')) {
|
} elseif (extension_loaded('mcrypt')) {
|
||||||
$this->assertNotContains('openssl', $identifier);
|
$this->assertStringNotContainsString('openssl', $identifier);
|
||||||
$this->assertContains('mcrypt', $identifier);
|
$this->assertStringContainsString('mcrypt', $identifier);
|
||||||
} else {
|
} else {
|
||||||
$this->assertNotContains('openssl', $identifier);
|
$this->assertStringNotContainsString('openssl', $identifier);
|
||||||
$this->assertNotContains('mcrypt', $identifier);
|
$this->assertStringNotContainsString('mcrypt', $identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extension_loaded('gmp')) {
|
if (extension_loaded('gmp')) {
|
||||||
$this->assertContains('gmp', $identifier);
|
$this->assertStringContainsString('gmp', $identifier);
|
||||||
$this->assertNotContains('bcmath', $identifier);
|
$this->assertStringNotContainsString('bcmath', $identifier);
|
||||||
} elseif (extension_loaded('bcmath')) {
|
} elseif (extension_loaded('bcmath')) {
|
||||||
$this->assertNotContains('gmp', $identifier);
|
$this->assertStringNotContainsString('gmp', $identifier);
|
||||||
$this->assertContains('bcmath', $identifier);
|
$this->assertStringContainsString('bcmath', $identifier);
|
||||||
} else {
|
} else {
|
||||||
$this->assertNotContains('gmp', $identifier);
|
$this->assertStringNotContainsString('gmp', $identifier);
|
||||||
$this->assertNotContains('bcmath', $identifier);
|
$this->assertStringNotContainsString('bcmath', $identifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,3 +117,7 @@ class Unit_Net_SSH2Test extends PhpseclibTestCase
|
|||||||
->getMock();
|
->getMock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SSH2UnitTest extends Unit_Net_SSH2UnitTest
|
||||||
|
{
|
||||||
|
}
|
@ -20,6 +20,17 @@ then
|
|||||||
PHPUNIT_ARGS="$PHPUNIT_ARGS -d zend.enable_gc=0"
|
PHPUNIT_ARGS="$PHPUNIT_ARGS -d zend.enable_gc=0"
|
||||||
fi
|
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" ]
|
if [ "$TRAVIS_PHP_VERSION" = 'hhvm' -o `php -r "echo (int) version_compare(PHP_VERSION, '7.0', '>=');"` = "1" ]
|
||||||
then
|
then
|
||||||
find tests -type f -name "*Test.php" | \
|
find tests -type f -name "*Test.php" | \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user