2016-03-18 01:48:28 +05:30
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace LeagueTests\Utils;
|
|
|
|
|
2016-03-28 20:12:34 +05:30
|
|
|
use League\OAuth2\Server\CryptKey;
|
2016-03-18 01:48:28 +05:30
|
|
|
use LeagueTests\Stubs\CryptTraitStub;
|
|
|
|
|
|
|
|
class CryptTraitTest extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
|
|
|
/**
|
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);
|
|
|
|
}
|
|
|
|
}
|