Skip to content

Commit f82f954

Browse files
committed
Tets are now 100% coverage.
1 parent b99f0ef commit f82f954

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

.phpunit.result.cache

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/Formatters/Date.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ public function __construct()
1616
public function format( $Data ): string
1717
{
1818
$Date = self::normalizeDate( $Data );
19+
if( $Date === '' )
20+
{
21+
return '';
22+
}
23+
1924
return date( $this->getFormat(), strtotime( $Date ) );
2025
}
2126
}

tests/Formatters/DateTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,36 @@ public function testFormat()
3030
$Formatter->format( '23/12/2018')
3131
);
3232

33+
$this->assertEquals(
34+
'',
35+
$Formatter->format( '23/12')
36+
);
37+
38+
$this->assertEquals(
39+
'',
40+
$Formatter->format( '23/13/2018')
41+
);
42+
43+
$this->assertEquals(
44+
'',
45+
$Formatter->format( '13/32/2018')
46+
);
47+
48+
$this->assertEquals(
49+
'',
50+
$Formatter->format( '32/12/2018')
51+
);
52+
53+
$this->assertEquals(
54+
'',
55+
$Formatter->format( '3244/1244/20184')
56+
);
57+
58+
$this->assertEquals(
59+
'',
60+
$Formatter->format( '3244124420184')
61+
);
62+
3363
}
3464

3565
public function testFormatWithFormat()

versionlog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## 0.6.6
2+
* Upgraded tests to 100% coverage.
23

34
## 0.6.5 2025-01-13
45
* Updated phone number formatter to support international.

0 commit comments

Comments
 (0)