2016-03-17 21:18:28 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace LeagueTests\Utils;
|
|
|
|
|
|
|
|
use LeagueTests\Stubs\CryptTraitStub;
|
2017-11-08 16:07:07 -02:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2016-03-17 21:18:28 +01:00
|
|
|
|
2017-11-08 16:07:07 -02:00
|
|
|
class CryptTraitTest extends TestCase
|
2016-03-17 21:18:28 +01:00
|
|
|
{
|
|
|
|
/**
|
2017-07-01 18:11:19 +01:00
|
|
|
* @var \LeagueTests\Stubs\CryptTraitStub
|
2016-03-17 21:18:28 +01:00
|
|
|
*/
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|