27 lines
628 B
PHP
27 lines
628 B
PHP
<?php
|
|
|
|
namespace Tests\Unit\Services\Phone;
|
|
|
|
use App\Services\Phone\PhoneFormatterService;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class PhoneFormatterServiceTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_format_returns_null_for_invalid(): void
|
|
{
|
|
$service = app(PhoneFormatterService::class);
|
|
|
|
$this->assertNull($service->format('123'));
|
|
}
|
|
|
|
public function test_format_formats_digits(): void
|
|
{
|
|
$service = app(PhoneFormatterService::class);
|
|
|
|
$this->assertSame('555-123-4567', $service->format('(555) 123-4567'));
|
|
}
|
|
}
|