Publication initiale de RelaisSMS : documentation et sources nettoyees

This commit is contained in:
2026-10-21 09:29:39 +02:00
commit ac186b03b1
158 changed files with 24818 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace Tests\Unit;
use App\Services\Sms\SmsMessageLength;
use PHPUnit\Framework\TestCase;
class SmsMessageLengthTest extends TestCase
{
public function test_gsm_message_is_limited_to_160_units(): void
{
$length = new SmsMessageLength;
$this->assertTrue($length->fitsInOneSms(str_repeat('a', 160)));
$this->assertFalse($length->fitsInOneSms(str_repeat('a', 161)));
$this->assertSame(160, $length->units(str_repeat('^', 80)));
}
public function test_unicode_message_is_limited_to_70_units(): void
{
$length = new SmsMessageLength;
$this->assertTrue($length->fitsInOneSms(str_repeat('ê', 70)));
$this->assertFalse($length->fitsInOneSms(str_repeat('ê', 71)));
}
public function test_value_is_truncated_with_marker_inside_one_sms(): void
{
$length = new SmsMessageLength;
$value = $length->truncateBetween('Rappel : ', str_repeat('a', 200), "\n17/09/2026 14:00");
$message = 'Rappel : '.$value."\n17/09/2026 14:00";
$this->assertStringEndsWith('[...]', $value);
$this->assertTrue($length->fitsInOneSms($message));
}
}