analyzer = new SmsMessageAnalyzer; } public function test_empty_message_has_zero_parts(): void { $this->assertSame(0, $this->analyzer->estimatedParts('')); } public function test_gsm_single_part_message(): void { $message = str_repeat('A', 160); $this->assertTrue($this->analyzer->isGsm7($message)); $this->assertSame(1, $this->analyzer->estimatedParts($message)); } public function test_gsm_multi_part_message(): void { $message = str_repeat('A', 161); $this->assertSame(2, $this->analyzer->estimatedParts($message)); } public function test_unicode_single_part_message(): void { $message = 'Привет'; $this->assertFalse($this->analyzer->isGsm7($message)); $this->assertSame(1, $this->analyzer->estimatedParts($message)); } public function test_unicode_multi_part_message(): void { $message = str_repeat('Я', 71); $this->assertSame(2, $this->analyzer->estimatedParts($message)); } #[DataProvider('summaryProvider')] public function test_summary(string $message, string $expectedSubstring): void { $this->assertStringContainsString($expectedSubstring, $this->analyzer->summary($message)); } /** * @return array */ public static function summaryProvider(): array { return [ 'empty' => ['', '0 harp'], 'gsm' => ['Hello', '5 harp · 1 SMS'], 'unicode' => ['你好', '2 harp · 1 SMS'], ]; } }