Tests are now compliant with php-cs-fixer (CamelCase for method, phpdoc valid)

This commit is contained in:
2023-04-13 22:22:46 +02:00
parent b017700d0a
commit 273db5f183
51 changed files with 3926 additions and 3637 deletions

View File

@@ -1,19 +1,23 @@
<?php
/** DomFramework - Tests
* @package domframework
* @author Dominique Fournier <dominique@fournier38.fr>
*/
/**
* DomFramework - Tests
* @package domframework
* @author Dominique Fournier <dominique@fournier38.fr>
*/
namespace Domframework\Tests;
use Domframework\Encrypt;
/** Test the Encrypt.php file */
/**
* Test the Encrypt.php file
*/
class EncryptTest extends \PHPUnit_Framework_TestCase
{
/** Check the length of the otken with cipher
*/
/**
* Check the length of the otken with cipher
*/
public function testEncrypt1()
{
$encrypt = new Encrypt();
@@ -24,8 +28,9 @@ class EncryptTest extends \PHPUnit_Framework_TestCase
$this->assertSame(strlen($res), 24);
}
/** Check if the encrypt/decrypt process return the same result
*/
/**
* Check if the encrypt/decrypt process return the same result
*/
public function testEncrypt2()
{
$encrypt = new Encrypt();
@@ -36,8 +41,9 @@ class EncryptTest extends \PHPUnit_Framework_TestCase
$this->assertSame($res, $payload);
}
/** Check if the encrypted part is well unreadable
*/
/**
* Check if the encrypted part is well unreadable
*/
public function testEncrypt3()
{
$encrypt = new Encrypt();
@@ -47,8 +53,9 @@ class EncryptTest extends \PHPUnit_Framework_TestCase
$this->assertSame($res, false);
}
/** Encrypt : Invalid Cipher method
*/
/**
* Encrypt : Invalid Cipher method
*/
public function testInvalidCypher1()
{
$this->expectException(
@@ -61,8 +68,9 @@ class EncryptTest extends \PHPUnit_Framework_TestCase
$token = $encrypt->encrypt($payload, "123456789012345678901234", "TOTO");
}
/** Encrypt : Invalid Payload to encrypt
*/
/**
* Encrypt : Invalid Payload to encrypt
*/
public function testInvalidPayload()
{
$this->expectException(
@@ -71,12 +79,13 @@ class EncryptTest extends \PHPUnit_Framework_TestCase
500
);
$encrypt = new Encrypt();
$payload = array ("Invalid");
$payload = ["Invalid"];
$token = $encrypt->encrypt($payload, "123456789012345678901234");
}
/** Encrypt : Invalid Cipher Key to encrypt
*/
/**
* Encrypt : Invalid Cipher Key to encrypt
*/
public function testInvalidCipherKey()
{
$this->expectException(
@@ -90,8 +99,9 @@ class EncryptTest extends \PHPUnit_Framework_TestCase
$token = $encrypt->encrypt($payload, "124");
}
/** Decrypt : invalid cipher text
*/
/**
* Decrypt : invalid cipher text
*/
public function testDecryptInvalidCipherKey()
{
$this->expectException(
@@ -104,8 +114,9 @@ class EncryptTest extends \PHPUnit_Framework_TestCase
$token = $encrypt->decrypt("zfz", "124");
}
/** Decrypt : empty cipher string
*/
/**
* Decrypt : empty cipher string
*/
public function testDecryptEmptyCipherString()
{
$this->expectException(
@@ -117,8 +128,9 @@ class EncryptTest extends \PHPUnit_Framework_TestCase
$token = $encrypt->decrypt("", "124");
}
/** Decrypt : Not a string cypher
*/
/**
* Decrypt : Not a string cypher
*/
public function testDecryptNotStringCipherString()
{
$this->expectException(
@@ -127,11 +139,12 @@ class EncryptTest extends \PHPUnit_Framework_TestCase
500
);
$encrypt = new Encrypt();
$token = $encrypt->decrypt(array (), "124");
$token = $encrypt->decrypt([], "124");
}
/** Decrypt : Not a string cypher key
*/
/**
* Decrypt : Not a string cypher key
*/
public function testDecryptNotStringCipherKey()
{
$this->expectException(
@@ -140,11 +153,12 @@ class EncryptTest extends \PHPUnit_Framework_TestCase
500
);
$encrypt = new Encrypt();
$token = $encrypt->decrypt("1224", array ());
$token = $encrypt->decrypt("1224", []);
}
/** Decrypt : Not a cipher method string
*/
/**
* Decrypt : Not a cipher method string
*/
public function testDecryptNotStringCipherMethod()
{
$this->expectException(
@@ -153,11 +167,12 @@ class EncryptTest extends \PHPUnit_Framework_TestCase
500
);
$encrypt = new Encrypt();
$token = $encrypt->decrypt("1224", "1234", array ());
$token = $encrypt->decrypt("1224", "1234", []);
}
/** Decrypt : Not a known cipher method
*/
/**
* Decrypt : Not a known cipher method
*/
public function testDecryptUnknownCipherMethod()
{
$this->expectException(