mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-13 18:02:58 +00:00
Tests: data providers need to be static
This commit is contained in:
parent
b0c0a82ae7
commit
89f0d3c952
@ -30,7 +30,7 @@ abstract class TestCase extends PhpseclibTestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function continuousBufferCombos()
|
||||
public static function continuousBufferCombos()
|
||||
{
|
||||
$modes = [
|
||||
'ctr',
|
||||
@ -133,7 +133,7 @@ abstract class TestCase extends PhpseclibTestCase
|
||||
*
|
||||
* @return list<array{string, string, array}>
|
||||
*/
|
||||
public function continuousBufferBatteryCombos()
|
||||
public static function continuousBufferBatteryCombos()
|
||||
{
|
||||
$modes = [
|
||||
'ctr',
|
||||
@ -176,9 +176,9 @@ abstract class TestCase extends PhpseclibTestCase
|
||||
/**
|
||||
* @return array<array{string, string, array}>
|
||||
*/
|
||||
public function continuousBufferBatteryCombosWithoutSingleCombos()
|
||||
public static function continuousBufferBatteryCombosWithoutSingleCombos()
|
||||
{
|
||||
return array_filter($this->continuousBufferBatteryCombos(), function (array $continuousBufferBatteryCombo) {
|
||||
return array_filter(self::continuousBufferBatteryCombos(), function (array $continuousBufferBatteryCombo) {
|
||||
return count($continuousBufferBatteryCombo[2]) > 1;
|
||||
});
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ use phpseclib3\Tests\PhpseclibTestCase;
|
||||
|
||||
class BlowfishTest extends PhpseclibTestCase
|
||||
{
|
||||
public function engineVectors()
|
||||
public static function engineVectors()
|
||||
{
|
||||
$engines = [
|
||||
'PHP',
|
||||
|
@ -16,7 +16,7 @@ use phpseclib3\Tests\PhpseclibTestCase;
|
||||
|
||||
class CurveTest extends PhpseclibTestCase
|
||||
{
|
||||
public function curves()
|
||||
public static function curves()
|
||||
{
|
||||
$curves = [];
|
||||
foreach (new \DirectoryIterator(__DIR__ . '/../../../../phpseclib/Crypt/EC/Curves/') as $file) {
|
||||
@ -38,7 +38,7 @@ class CurveTest extends PhpseclibTestCase
|
||||
return $curves;
|
||||
}
|
||||
|
||||
public function allCurves()
|
||||
public static function allCurves()
|
||||
{
|
||||
$curves = [];
|
||||
foreach (new \DirectoryIterator(__DIR__ . '/../../../../phpseclib/Crypt/EC/Curves/') as $file) {
|
||||
@ -55,7 +55,7 @@ class CurveTest extends PhpseclibTestCase
|
||||
return $curves;
|
||||
}
|
||||
|
||||
public function curvesWithOIDs()
|
||||
public static function curvesWithOIDs()
|
||||
{
|
||||
$class = new \ReflectionClass('phpseclib3\Crypt\EC\Formats\Keys\PKCS8');
|
||||
|
||||
|
@ -18,7 +18,7 @@ class GCMTest extends PhpseclibTestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function engine128Vectors()
|
||||
public static function engine128Vectors()
|
||||
{
|
||||
$engines = [
|
||||
'PHP',
|
||||
@ -131,7 +131,7 @@ class GCMTest extends PhpseclibTestCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function engine256Vectors()
|
||||
public static function engine256Vectors()
|
||||
{
|
||||
$engines = [
|
||||
'PHP',
|
||||
|
@ -426,7 +426,7 @@ class HashTest extends PhpseclibTestCase
|
||||
$this->assertSame($hash->getLengthInBytes(), $length);
|
||||
}
|
||||
|
||||
public function lengths()
|
||||
public static function lengths()
|
||||
{
|
||||
return [
|
||||
// known
|
||||
@ -439,7 +439,7 @@ class HashTest extends PhpseclibTestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function UMACs()
|
||||
public static function UMACs()
|
||||
{
|
||||
return [
|
||||
['', 'umac-32', '113145FB', "umac-32 and message of <empty>"],
|
||||
|
@ -13,14 +13,14 @@ use phpseclib3\Tests\PhpseclibTestCase;
|
||||
|
||||
class RC2Test extends PhpseclibTestCase
|
||||
{
|
||||
public $engines = [
|
||||
public static $engines = [
|
||||
'PHP',
|
||||
'Eval',
|
||||
'mcrypt',
|
||||
'OpenSSL',
|
||||
];
|
||||
|
||||
public function engineVectors()
|
||||
public static function engineVectors()
|
||||
{
|
||||
// tests from https://tools.ietf.org/html/rfc2268#page-8
|
||||
$tests = [
|
||||
@ -37,7 +37,7 @@ class RC2Test extends PhpseclibTestCase
|
||||
|
||||
$result = [];
|
||||
|
||||
foreach ($this->engines as $engine) {
|
||||
foreach (self::$engines as $engine) {
|
||||
foreach ($tests as $test) {
|
||||
$result[] = [$engine, $test[0], $test[1], $test[2], $test[3]];
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ use phpseclib3\Tests\PhpseclibTestCase;
|
||||
|
||||
class RC4Test extends PhpseclibTestCase
|
||||
{
|
||||
public function engineVectors()
|
||||
public static function engineVectors()
|
||||
{
|
||||
$engines = [
|
||||
'PHP',
|
||||
|
@ -13,9 +13,9 @@ use phpseclib3\Tests\PhpseclibTestCase;
|
||||
|
||||
class RandomTest extends PhpseclibTestCase
|
||||
{
|
||||
public function stringLengthData()
|
||||
public static function stringLengthData()
|
||||
{
|
||||
return array_map([$this, 'wrap'], [
|
||||
return array_map(function($x) { return [$x]; }, [
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 17, 19, 20, 23, 29, 31, 37,
|
||||
41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 111, 128, 1000,
|
||||
1024, 10000, 12345, 100000, 123456
|
||||
@ -50,10 +50,4 @@ class RandomTest extends PhpseclibTestCase
|
||||
$values[$rand] = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected function wrap($x)
|
||||
{
|
||||
// array() is not a function, but $this->wrap() is.
|
||||
return [$x];
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ use phpseclib3\Tests\PhpseclibTestCase;
|
||||
|
||||
class Salsa20Test extends PhpseclibTestCase
|
||||
{
|
||||
public function engineVectors()
|
||||
public static function engineVectors()
|
||||
{
|
||||
$engines = [
|
||||
'PHP',
|
||||
|
@ -13,14 +13,14 @@ use phpseclib3\Tests\PhpseclibTestCase;
|
||||
|
||||
class TripleDESTest extends PhpseclibTestCase
|
||||
{
|
||||
public $engines = [
|
||||
public static $engines = [
|
||||
'PHP',
|
||||
'Eval',
|
||||
'mcrypt',
|
||||
'OpenSSL',
|
||||
];
|
||||
|
||||
public function engineVectors()
|
||||
public static function engineVectors()
|
||||
{
|
||||
// tests from http://csrc.nist.gov/publications/nistpubs/800-20/800-20.pdf#page=273
|
||||
$tests = [
|
||||
@ -94,7 +94,7 @@ class TripleDESTest extends PhpseclibTestCase
|
||||
|
||||
$result = [];
|
||||
|
||||
foreach ($this->engines as $engine) {
|
||||
foreach (self::$engines as $engine) {
|
||||
foreach ($tests as $test) {
|
||||
$result[] = [$engine, $test[0], $test[1], $test[2]];
|
||||
}
|
||||
@ -121,7 +121,7 @@ class TripleDESTest extends PhpseclibTestCase
|
||||
$this->assertEquals($result, $expected, "Failed asserting that $plaintext yielded expected output in $engine engine");
|
||||
}
|
||||
|
||||
public function engineIVVectors()
|
||||
public static function engineIVVectors()
|
||||
{
|
||||
$engines = [
|
||||
'PHP',
|
||||
@ -184,7 +184,7 @@ class TripleDESTest extends PhpseclibTestCase
|
||||
$des->setKey('abcdefghijklmnopqrstuvwx');
|
||||
$des->setIV(str_repeat("\0", $des->getBlockLength() >> 3));
|
||||
|
||||
foreach ($this->engines as $engine) {
|
||||
foreach (self::$engines as $engine) {
|
||||
$des->setPreferredEngine($engine);
|
||||
if (!$des->isValidEngine($engine)) {
|
||||
self::markTestSkipped("Unable to initialize $engine engine");
|
||||
@ -212,7 +212,7 @@ class TripleDESTest extends PhpseclibTestCase
|
||||
/**
|
||||
* @return list<array{string, string}>
|
||||
*/
|
||||
public function provideForCorrectSelfUseInLambda()
|
||||
public static function provideForCorrectSelfUseInLambda()
|
||||
{
|
||||
return [
|
||||
['YWFhYWFhYWFhYWFhYWFhYWFhYWG9l9gm', 'fDSmC5bbLdx8NKYLltst3Hw0pguW2y3cfDSmC5bbLdxmhqEOIeS2ig=='],
|
||||
|
@ -14,7 +14,7 @@ use phpseclib3\Tests\PhpseclibTestCase;
|
||||
|
||||
class SSH2UnitTest extends PhpseclibTestCase
|
||||
{
|
||||
public function formatLogDataProvider()
|
||||
public static function formatLogDataProvider()
|
||||
{
|
||||
return [
|
||||
[
|
||||
|
Loading…
Reference in New Issue
Block a user