1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/15403] Refactor get_context

PHPBB-15403
This commit is contained in:
Ruben Calvo
2024-07-13 15:34:37 +02:00
parent 89afa0cb5e
commit f41c8eef47
2 changed files with 73 additions and 55 deletions

View File

@@ -39,7 +39,7 @@ class phpbb_functions_content_get_context_test extends TestCase
'text' => 'This is a sample text containing several words, but none of them match the given words.',
'words' => ['nonexistent'],
'length' => 50,
'expected' => 'This is a sample text containing several words, bu ...',
'expected' => 'This is a sample text containing several words ...',
],
'desired length equal to text length' => [
'text' => 'Exact length text.',
@@ -57,13 +57,13 @@ class phpbb_functions_content_get_context_test extends TestCase
'text' => 'This is a sample text containing & and < and > entities.',
'words' => ['sample', 'entities'],
'length' => 50,
'expected' => 'This is a sample text containing & and < and ...',
'expected' => 'This is a sample text ... and < and > entities.',
],
'text with multiple spaces and special characters' => [
'text' => 'This is a sample text containing several words.',
'words' => ['sample', 'several'],
'length' => 50,
'expected' => 'This is a sample text containing several words ...',
'expected' => 'This is a sample text containing several words.',
],
'empty text' => [
'text' => '',