0
0
Fork 0
mirror of https://github.com/kevinpapst/kimai2.git synced 2025-05-08 19:10:15 +00:00
kevinpapst_kimai2/tests/Repository/Search/SearchConfigurationTest.php
2025-05-05 18:18:00 +02:00

40 lines
1.2 KiB
PHP

<?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\Repository\Search;
use App\Repository\Search\SearchConfiguration;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Repository\Search\SearchConfiguration
*/
class SearchConfigurationTest extends TestCase
{
public function testDefaultConstruct(): void
{
$sut = new SearchConfiguration();
self::assertNull($sut->getMetaFieldClass());
self::assertNull($sut->getMetaFieldName());
self::assertEquals('meta', $sut->getEntityFieldName());
self::assertEquals([], $sut->getSearchableFields());
}
public function testConstruct(): void
{
$fields = ['field1', 'field2'];
$sut = new SearchConfiguration($fields, 'SomeClassName', 'foo-bar');
self::assertEquals($fields, $sut->getSearchableFields());
self::assertEquals('SomeClassName', $sut->getMetaFieldClass());
self::assertEquals('foo-bar', $sut->getMetaFieldName());
$sut->setEntityFieldName('customField');
self::assertEquals('customField', $sut->getEntityFieldName());
}
}