2016-03-18 01:48:28 +05:30
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace LeagueTests\Utils;
|
|
|
|
|
|
|
|
use LeagueTests\Stubs\CryptTraitStub;
|
2017-11-08 23:37:07 +05:30
|
|
|
use PHPUnit\Framework\TestCase;
|
2016-03-18 01:48:28 +05:30
|
|
|
|
2017-11-08 23:37:07 +05:30
|
|
|
class CryptTraitTest extends TestCase
|
2016-03-18 01:48:28 +05:30
|
|
|
{
|
|
|
|
/**
|
2017-07-01 22:41:19 +05:30
|
|
|
* @var \LeagueTests\Stubs\CryptTraitStub
|
2016-03-18 01:48:28 +05:30
|
|
|
*/
|
|
|
|
protected $cryptStub;
|
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
$this->cryptStub = new CryptTraitStub;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testEncryptDecrypt()
|
|
|
|
{
|
|
|
|
$payload = 'alex loves whisky';
|
|
|
|
$encrypted = $this->cryptStub->doEncrypt($payload);
|
|
|
|
$plainText = $this->cryptStub->doDecrypt($encrypted);
|
|
|
|
|
|
|
|
$this->assertNotEquals($payload, $encrypted);
|
|
|
|
$this->assertEquals($payload, $plainText);
|
|
|
|
}
|
|
|
|
}
|