cii-text-analysis/vendor/yooper/php-text-analysis/tests/TextAnalysis/Utilities/TextTest.php

32 lines
785 B
PHP
Raw Permalink Normal View History

2026-02-10 16:19:59 +01:00
<?php
namespace Tests\Utilities;
use TextAnalysis\Utilities\Text;
/**
* Description of TextTest
*
* @author yooper
*/
class TextTest extends \PHPUnit\Framework\TestCase
{
public function testAllSubstrings()
{
$text = 'abc';
$expected = ['a','ab','abc','b','bc','c'];
$substrings = Text::getAllSubStrings($text);
$this->assertCount(6, $substrings);
$this->assertEquals($expected, $substrings);
}
public function testEndsWith()
{
$this->assertTrue(Text::endsWith('lunches', 's'));
$this->assertTrue(Text::endsWith('lunches', 'es'));
$this->assertTrue(Text::endsWith('lunches', 'hes'));
$this->assertFalse(Text::endsWith('joe', 'is'));
}
}