Files
hdk-core/tests/Unit/Base64WrapperTest.php

33 lines
774 B
PHP
Raw Permalink Normal View History

<?php
/**
* Base64WrapperTest.php@HDK-Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2022/12/20
*/
namespace Singularity\HDK\Test\Core\Unit;
use Singularity\HDK\Core\Service\Base64Wrapper;
use PHPUnit\Framework\TestCase;
it('assertions base64 wrapper ENCODE', function (string $source, string $expected) {
$encoded = (new Base64Wrapper())->encode($source);
expect($expected)->toBe($encoded);
})->with([
['abc==', 'abc'],
['=ccc=', 'ccc'],
['YWJ/+j', 'YWJ_-j']
]);
it('assertions base64 wrapper DECODE', function (string $source, string $expected) {
$decoded = (new Base64Wrapper())->decode($source);
expect($expected)->toBe($decoded);
})->with([
['abc', 'abc'],
['YWJ_-j', 'YWJ/+j']
]);