Server IP : 66.29.132.124 / Your IP : 52.15.71.146 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/book24.ng/vendor/lcobucci/jwt/test/unit/Parsing/ |
Upload File : |
<?php /** * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS * * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause */ namespace Lcobucci\JWT\Parsing; /** * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com> * @since 0.1.0 */ class EncoderTest extends \PHPUnit\Framework\TestCase { /** * @test * * @covers Lcobucci\JWT\Parsing\Encoder::jsonEncode */ public function jsonEncodeMustReturnAJSONString() { $encoder = new Encoder(); $this->assertEquals('{"test":"test"}', $encoder->jsonEncode(['test' => 'test'])); } /** * @test * * @covers Lcobucci\JWT\Parsing\Encoder::jsonEncode * * @expectedException \RuntimeException */ public function jsonEncodeMustRaiseExceptionWhenAnErrorHasOccured() { $encoder = new Encoder(); $encoder->jsonEncode("\xB1\x31"); } /** * @test * * @covers Lcobucci\JWT\Parsing\Encoder::base64UrlEncode */ public function base64UrlEncodeMustReturnAnUrlSafeBase64() { $data = base64_decode('0MB2wKB+L3yvIdzeggmJ+5WOSLaRLTUPXbpzqUe0yuo='); $encoder = new Encoder(); $this->assertEquals('0MB2wKB-L3yvIdzeggmJ-5WOSLaRLTUPXbpzqUe0yuo', $encoder->base64UrlEncode($data)); } }