mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-03-05 20:44:19 +01:00
Create Testcoverage and upgrade Symfomy and PHP
* Some tests * More tests! * Tests 3 * Move getScores from Candidate to Quiz * Add some suggestions for future refactoring * - **Add Gedmo doctrine-extensions and Stof bundle integration** - Added `stof/doctrine-extensions-bundle` and `gedmo/doctrine-extensions` dependencies. - Integrated `Timestampable` behavior for `Created` fields in entities. - Updated `bundles.php` to register StofDoctrineExtensionsBundle. - Added configuration for the Stof bundle. - Simplified `SeasonVoter` with `match` expression and added new tests. - Minor fixes and adjustments across various files. * WIP * All the tests * Base64 tests * Symfomny 7.4.0 * Update * Update recipe * PHP 8.5 * Rector changes * More 8.5 * Things
This commit is contained in:
41
tests/Helpers/Base64Test.php
Normal file
41
tests/Helpers/Base64Test.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tvdt\Tests\Helpers;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Safe\Exceptions\UrlException;
|
||||
use Tvdt\Helpers\Base64;
|
||||
|
||||
final class Base64Test extends TestCase
|
||||
{
|
||||
public function testBase64UrlEncode(): void
|
||||
{
|
||||
$this->assertSame('TWFyaWpu', Base64::base64UrlEncode('Marijn'));
|
||||
$this->assertSame('UGhpbGluZQ', Base64::base64UrlEncode('Philine'));
|
||||
|
||||
$this->assertSame('_g', Base64::base64UrlEncode(\chr(254)));
|
||||
$this->assertSame('-g', Base64::base64UrlEncode(\chr(250)));
|
||||
}
|
||||
|
||||
public function testBase64UrlDecode(): void
|
||||
{
|
||||
$this->assertSame('Marijn', Base64::base64UrlDecode('TWFyaWpu'));
|
||||
$this->assertSame('Philine', Base64::base64UrlDecode('UGhpbGluZQ'));
|
||||
|
||||
$this->assertSame(\chr(254), Base64::base64UrlDecode('_g'));
|
||||
$this->assertSame(\chr(250), Base64::base64UrlDecode('-g'));
|
||||
}
|
||||
|
||||
public function testBase64UrlDecodeCanHandlePadding(): void
|
||||
{
|
||||
$this->assertSame('Philine', Base64::base64UrlDecode('UGhpbGluZQ=='));
|
||||
}
|
||||
|
||||
public function testBase64UrlDecodeThrowsExceptionOnInvalidInput(): void
|
||||
{
|
||||
$this->expectException(UrlException::class);
|
||||
Base64::base64UrlDecode('Philine==');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user