Some random tests and fixes (#6000)

* added tests for form models
* apply form theme only to the own custom form type
* change route order for improves matching
This commit is contained in:
Kevin Papst
2026-06-17 10:20:50 +02:00
committed by GitHub
parent f8bc853d2f
commit 8bf711c417
11 changed files with 403 additions and 32 deletions

View File

@@ -0,0 +1,34 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Tests\Form\Model;
use App\Entity\User;
use App\Form\Model\TotpActivation;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
#[CoversClass(TotpActivation::class)]
class TotpActivationTest extends TestCase
{
public function testDefaultValues(): void
{
$user = new User();
$sut = new TotpActivation($user);
self::assertSame($user, $sut->getUser());
self::assertNull($sut->getCode());
$sut->setCode('');
self::assertEquals('', $sut->getCode());
$sut->setCode('jztfztfjzfjhgfjhgfjhgfjtzfiuzgbljv');
self::assertEquals('jztfztfjzfjhgfjhgfjhgfjtzfiuzgbljv', $sut->getCode());
$sut->setCode(null);
self::assertNull($sut->getCode());
}
}