oauth2-server/tests/CryptTraitTest.php

30 lines
670 B
PHP
Raw Normal View History

2016-03-17 21:18:28 +01:00
<?php
namespace LeagueTests\Utils;
2016-03-28 16:42:34 +02:00
use League\OAuth2\Server\CryptKey;
2016-03-17 21:18:28 +01:00
use LeagueTests\Stubs\CryptTraitStub;
class CryptTraitTest extends \PHPUnit_Framework_TestCase
{
/**
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);
}
}