2021-02-11 12:22:51 +00:00
|
|
|
<?php
|
|
|
|
|
2023-04-09 00:40:21 +00:00
|
|
|
namespace NoccyLabs\SimpleJWT;
|
2021-02-11 12:22:51 +00:00
|
|
|
|
|
|
|
|
2023-04-09 00:40:21 +00:00
|
|
|
class JWTUtilTest extends \PHPUnit\Framework\TestCase
|
2021-02-11 12:22:51 +00:00
|
|
|
{
|
|
|
|
|
2023-04-09 00:40:21 +00:00
|
|
|
/**
|
2023-04-09 22:04:43 +00:00
|
|
|
* @covers \NoccyLabs\SimpleJWT\JWTUtil::encode
|
|
|
|
* @covers \NoccyLabs\SimpleJWT\JWTUtil::decode
|
2023-04-09 00:40:21 +00:00
|
|
|
*/
|
2021-02-11 12:22:51 +00:00
|
|
|
public function testTheEncodingShouldBeSymmetric()
|
|
|
|
{
|
|
|
|
$v1a = "HelloWorld";
|
2023-04-09 00:40:21 +00:00
|
|
|
$v1b = JWTUtil::encode($v1a);
|
|
|
|
$v1c = JWTUtil::decode($v1b);
|
2021-02-11 12:22:51 +00:00
|
|
|
|
|
|
|
$this->assertEquals($v1a, $v1c);
|
|
|
|
$this->assertNotEquals($v1a, $v1b);
|
|
|
|
}
|
2023-04-09 00:40:21 +00:00
|
|
|
}
|