Publication initiale de RelaisSMS : documentation et sources nettoyees
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user