oauth2-server/tests/Utils/CryptTraitTest.php

30 lines
648 B
PHP
Raw Normal View History

2016-03-18 01:48:28 +05:30
<?php
namespace LeagueTests\Utils;
use LeagueTests\Stubs\CryptTraitStub;
use PHPUnit\Framework\TestCase;
2016-03-18 01:48:28 +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);
}
}