From: =?utf-8?q?David_Pr=C3=A9vot?= <taffit@debian.org>
Date: Sat, 12 Dec 2020 15:32:34 -0400
Subject: Adapt to recent version of PHPUnit (9)

---
 tests/Functional/Net/SFTPUserStoryTest.php | 12 ++++--------
 tests/Functional/Net/SSH2Test.php          |  2 +-
 tests/Unit/Crypt/RSA/LoadKeyTest.php       | 22 +++++++++++-----------
 tests/Unit/File/ASN1Test.php               | 10 +++++-----
 tests/Unit/File/X509/CSRTest.php           |  6 +++---
 tests/Unit/File/X509/SPKACTest.php         | 14 +++++++-------
 tests/Unit/File/X509/X509Test.php          |  2 +-
 tests/Unit/Math/BigInteger/TestCase.php    |  2 +-
 tests/Unit/Net/SSH2Test.php                | 24 ++++++++++++------------
 9 files changed, 45 insertions(+), 49 deletions(-)

diff --git a/tests/Functional/Net/SFTPUserStoryTest.php b/tests/Functional/Net/SFTPUserStoryTest.php
index 2609c42..cd6bf96 100644
--- a/tests/Functional/Net/SFTPUserStoryTest.php
+++ b/tests/Functional/Net/SFTPUserStoryTest.php
@@ -437,8 +437,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'
         );
@@ -453,14 +452,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'
         );
@@ -602,8 +599,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'
         );
diff --git a/tests/Functional/Net/SSH2Test.php b/tests/Functional/Net/SSH2Test.php
index 872c8e7..09c9ff0 100644
--- a/tests/Functional/Net/SSH2Test.php
+++ b/tests/Functional/Net/SSH2Test.php
@@ -122,7 +122,7 @@ class Functional_Net_SSH2Test extends PhpseclibFunctionalTestCase
     {
         $ssh = new Net_SSH2($this->getEnv('SSH_HOSTNAME'));
 
-        $this->assertInternalType('string', $ssh->getServerPublicHostKey());
+        $this->assertIsString($ssh->getServerPublicHostKey());
     }
 
     public function testOpenSocketConnect()
diff --git a/tests/Unit/Crypt/RSA/LoadKeyTest.php b/tests/Unit/Crypt/RSA/LoadKeyTest.php
index f4dc544..00f0098 100644
--- a/tests/Unit/Crypt/RSA/LoadKeyTest.php
+++ b/tests/Unit/Crypt/RSA/LoadKeyTest.php
@@ -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()
@@ -185,7 +185,7 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
         $this->assertTrue($rsa->loadKey($key));
 
         $key = $rsa->getPrivateKey(CRYPT_RSA_PRIVATE_FORMAT_PKCS8);
-        $this->assertInternalType('string', $key);
+        $this->assertIsString($key);
 
         $this->assertTrue($rsa->loadKey($key));
     }
@@ -204,7 +204,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 +223,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 +237,7 @@ ZQIDAQAB
                'phpseclib-generated-key';
 
         $this->assertTrue($rsa->loadKey($key));
-        $this->assertInternalType('string', $rsa->getPublicKey());
+        $this->assertIsString($rsa->getPublicKey());
         $this->assertFalse($rsa->getPrivateKey());
     }
 
@@ -415,7 +415,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());
     }
diff --git a/tests/Unit/File/ASN1Test.php b/tests/Unit/File/ASN1Test.php
index 1864eff..00ee7c8 100644
--- a/tests/Unit/File/ASN1Test.php
+++ b/tests/Unit/File/ASN1Test.php
@@ -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 File_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 File_ASN1();
         $decoded = $asn1->decodeBER("\xa0\x00");
-        $this->assertInternalType('array', $decoded);
+        $this->assertIsArray($decoded);
         $this->assertCount(0, $decoded[0]['content']);
     }
 
@@ -390,6 +390,6 @@ class Unit_File_ASN1Test extends PhpseclibTestCase
         $a = $asn1->decodeBER($a);
         $a = $asn1->asn1map($a[0], $map);
 
-        $this->assertInternalType('array', $a);
+        $this->assertIsArray($a);
     }
 }
diff --git a/tests/Unit/File/X509/CSRTest.php b/tests/Unit/File/X509/CSRTest.php
index fa86d35..f57a0e6 100644
--- a/tests/Unit/File/X509/CSRTest.php
+++ b/tests/Unit/File/X509/CSRTest.php
@@ -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
diff --git a/tests/Unit/File/X509/SPKACTest.php b/tests/Unit/File/X509/SPKACTest.php
index 59bda3a..1345f45 100644
--- a/tests/Unit/File/X509/SPKACTest.php
+++ b/tests/Unit/File/X509/SPKACTest.php
@@ -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 File_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()
diff --git a/tests/Unit/File/X509/X509Test.php b/tests/Unit/File/X509/X509Test.php
index 6758cdc..65b4c36 100644
--- a/tests/Unit/File/X509/X509Test.php
+++ b/tests/Unit/File/X509/X509Test.php
@@ -55,7 +55,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()
diff --git a/tests/Unit/Math/BigInteger/TestCase.php b/tests/Unit/Math/BigInteger/TestCase.php
index b3e6f90..efa1bdc 100644
--- a/tests/Unit/Math/BigInteger/TestCase.php
+++ b/tests/Unit/Math/BigInteger/TestCase.php
@@ -402,7 +402,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;
     }
 
diff --git a/tests/Unit/Net/SSH2Test.php b/tests/Unit/Net/SSH2Test.php
index e13b54a..8555343 100644
--- a/tests/Unit/Net/SSH2Test.php
+++ b/tests/Unit/Net/SSH2Test.php
@@ -42,25 +42,25 @@ class Unit_Net_SSH2Test extends PhpseclibTestCase
         $this->assertStringStartsWith('SSH-2.0-phpseclib_1.0', $identifier);
 
         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);
         }
     }
 
