forked from TFMM/silent-auction
change phone number display
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Models\Bidders;
|
||||
use App\Helpers\PhoneHelper;
|
||||
|
||||
class PhoneFormattingTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
public function it_formats_a_10_digit_phone_number()
|
||||
{
|
||||
$formatted = PhoneHelper::format('1234567890');
|
||||
$this->assertEquals('123-456-7890', $formatted);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_strips_non_numeric_characters_before_formatting()
|
||||
{
|
||||
$formatted = PhoneHelper::format('(123) 456-7890');
|
||||
$this->assertEquals('123-456-7890', $formatted);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_returns_original_value_if_not_10_digits()
|
||||
{
|
||||
$formatted = PhoneHelper::format('1234567');
|
||||
$this->assertEquals('1234567', $formatted);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user