mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 20:44:28 +09:00
Fix unit tests that don't work in PHP 7.2
This commit is contained in:
parent
3feaf36c23
commit
d7a3e1bc26
2 changed files with 19 additions and 13 deletions
|
|
@ -31,19 +31,19 @@ class MailTest extends \Codeception\TestCase\Test
|
||||||
$mail->setFrom('devops@rhymix.org', 'Rhymix Developers');
|
$mail->setFrom('devops@rhymix.org', 'Rhymix Developers');
|
||||||
$this->assertEquals('Rhymix Developers <devops@rhymix.org>', $mail->getFrom());
|
$this->assertEquals('Rhymix Developers <devops@rhymix.org>', $mail->getFrom());
|
||||||
|
|
||||||
$this->assertEquals(0, count($mail->message->getTo()));
|
$this->assertEquals(null, $mail->message->getTo());
|
||||||
$mail->addTo('whoever@rhymix.org', 'Name');
|
$mail->addTo('whoever@rhymix.org', 'Name');
|
||||||
$this->assertEquals(array('whoever@rhymix.org' => 'Name'), $mail->message->getTo());
|
$this->assertEquals(array('whoever@rhymix.org' => 'Name'), $mail->message->getTo());
|
||||||
|
|
||||||
$this->assertEquals(0, count($mail->message->getCc()));
|
$this->assertEquals(null, $mail->message->getCc());
|
||||||
$mail->addCc('whatever@rhymix.org', 'Nick');
|
$mail->addCc('whatever@rhymix.org', 'Nick');
|
||||||
$this->assertEquals(array('whatever@rhymix.org' => 'Nick'), $mail->message->getCc());
|
$this->assertEquals(array('whatever@rhymix.org' => 'Nick'), $mail->message->getCc());
|
||||||
|
|
||||||
$this->assertEquals(0, count($mail->message->getBcc()));
|
$this->assertEquals(null, $mail->message->getBcc());
|
||||||
$mail->addBcc('wherever@rhymix.org', 'User');
|
$mail->addBcc('wherever@rhymix.org', 'User');
|
||||||
$this->assertEquals(array('wherever@rhymix.org' => 'User'), $mail->message->getBcc());
|
$this->assertEquals(array('wherever@rhymix.org' => 'User'), $mail->message->getBcc());
|
||||||
|
|
||||||
$this->assertEquals(0, count($mail->message->getReplyTo()));
|
$this->assertEquals(null, $mail->message->getReplyTo());
|
||||||
$mail->setReplyTo('replyto@rhymix.org');
|
$mail->setReplyTo('replyto@rhymix.org');
|
||||||
$this->assertEquals(array('replyto@rhymix.org' => ''), $mail->message->getReplyTo());
|
$this->assertEquals(array('replyto@rhymix.org' => ''), $mail->message->getReplyTo());
|
||||||
|
|
||||||
|
|
@ -151,7 +151,7 @@ class MailTest extends \Codeception\TestCase\Test
|
||||||
$mail->setReceiptor('Another Recipient', 'whatever@rhymix.org');
|
$mail->setReceiptor('Another Recipient', 'whatever@rhymix.org');
|
||||||
$this->assertEquals('Another Recipient <whatever@rhymix.org>', $mail->getReceiptor());
|
$this->assertEquals('Another Recipient <whatever@rhymix.org>', $mail->getReceiptor());
|
||||||
$this->assertEquals(1, count($mail->message->getTo()));
|
$this->assertEquals(1, count($mail->message->getTo()));
|
||||||
$this->assertEquals(0, count($mail->message->getCc()));
|
$this->assertEquals(null, $mail->message->getCc());
|
||||||
|
|
||||||
$mail->setBcc('bcc-1@rhymix.org');
|
$mail->setBcc('bcc-1@rhymix.org');
|
||||||
$mail->setBcc('bcc-2@rhymix.org');
|
$mail->setBcc('bcc-2@rhymix.org');
|
||||||
|
|
|
||||||
|
|
@ -36,16 +36,22 @@ class SecurityTest extends \Codeception\TestCase\Test
|
||||||
$this->assertEquals($plaintext, $decrypted);
|
$this->assertEquals($plaintext, $decrypted);
|
||||||
|
|
||||||
// Encryption with defuse/php-encryption and decryption with CryptoCompat.
|
// Encryption with defuse/php-encryption and decryption with CryptoCompat.
|
||||||
$encrypted = Rhymix\Framework\Security::encrypt($plaintext);
|
if (function_exists('mcrypt_decrypt'))
|
||||||
$this->assertNotEquals(false, $encrypted);
|
{
|
||||||
$decrypted = Rhymix\Framework\Security::decrypt($encrypted, null, true);
|
$encrypted = Rhymix\Framework\Security::encrypt($plaintext);
|
||||||
$this->assertEquals($plaintext, $decrypted);
|
$this->assertNotEquals(false, $encrypted);
|
||||||
|
$decrypted = Rhymix\Framework\Security::decrypt($encrypted, null, true);
|
||||||
|
$this->assertEquals($plaintext, $decrypted);
|
||||||
|
}
|
||||||
|
|
||||||
// Encryption with CryptoCompat and decryption with defuse/php-encryption.
|
// Encryption with CryptoCompat and decryption with defuse/php-encryption.
|
||||||
$encrypted = Rhymix\Framework\Security::encrypt($plaintext, null, true);
|
if (function_exists('mcrypt_encrypt'))
|
||||||
$this->assertNotEquals(false, $encrypted);
|
{
|
||||||
$decrypted = Rhymix\Framework\Security::decrypt($encrypted);
|
$encrypted = Rhymix\Framework\Security::encrypt($plaintext, null, true);
|
||||||
$this->assertEquals($plaintext, $decrypted);
|
$this->assertNotEquals(false, $encrypted);
|
||||||
|
$decrypted = Rhymix\Framework\Security::decrypt($encrypted);
|
||||||
|
$this->assertEquals($plaintext, $decrypted);
|
||||||
|
}
|
||||||
|
|
||||||
// Test invalid ciphertext.
|
// Test invalid ciphertext.
|
||||||
$decrypted = Rhymix\Framework\Security::decrypt('1234' . substr($encrypted, 4));
|
$decrypted = Rhymix\Framework\Security::decrypt('1234' . substr($encrypted, 4));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue