feat: add MCP server for the website chatbot over a mirrored TYPO3 content feed
This commit is contained in:
1 parent
ff7ddf7a9e
commit
1b4384e3f3
52 files changed
+5117
-4
No files matched your search
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Chatbot\Search;
|
||||
|
||||
use App\Chatbot\Search\ContentSearchQuery;
|
||||
use App\Chatbot\Search\Excerpt;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ContentSearchQueryTest extends TestCase
|
||||
{
|
||||
public function testDropsGermanStopwordsShortTokensAndOperators(): void
|
||||
{
|
||||
self::assertSame(
|
||||
'skipass* val* thorens* inklusive*',
|
||||
ContentSearchQuery::booleanQuery('Ist im Skipass bei "Val Thorens" alles +inklusive? Ja!'),
|
||||
);
|
||||
}
|
||||
|
||||
public function testTermsAreUniqueAndLowerCased(): void
|
||||
{
|
||||
self::assertSame(['gepäck', 'snowboard'], ContentSearchQuery::terms('Gepäck GEPÄCK Snowboard'));
|
||||
}
|
||||
|
||||
public function testNothingSearchableLeftIsNull(): void
|
||||
{
|
||||
self::assertNull(ContentSearchQuery::booleanQuery('Was ist das?'));
|
||||
self::assertNull(ContentSearchQuery::booleanQuery('***'));
|
||||
}
|
||||
|
||||
public function testExcerptIsTheWholeTextWhenShort(): void
|
||||
{
|
||||
self::assertSame('Kurzer Text', Excerpt::around("Kurzer\n\nText", ['text']));
|
||||
}
|
||||
|
||||
public function testExcerptCentresOnTheFirstMatch(): void
|
||||
{
|
||||
$text = str_repeat('Füllwort ', 200).'Der Skipass ist inklusive. '.str_repeat('Nachwort ', 200);
|
||||
$excerpt = Excerpt::around($text, ['skipass']);
|
||||
|
||||
self::assertStringContainsString('Der Skipass ist inklusive.', $excerpt);
|
||||
self::assertStringStartsWith('…', $excerpt);
|
||||
self::assertStringEndsWith('…', $excerpt);
|
||||
self::assertLessThanOrEqual(Excerpt::LENGTH + 2, mb_strlen($excerpt));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user