-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from hydephp/80-add-more-aria-roles-to-articles
Updates the frontend and adds the tests for hydephp/framework#102
- Loading branch information
Showing
6 changed files
with
69 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Tests\Unit; | ||
|
||
use DateTime; | ||
use Hyde\Framework\Models\DateString; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class DateStringTest extends TestCase | ||
{ | ||
// Test it can parse a date string | ||
public function test_it_can_parse_date_string() | ||
{ | ||
$dateString = new DateString('2020-01-01'); | ||
$this->assertEquals('2020-01-01', $dateString->string); | ||
} | ||
|
||
// Test it can parse date string into datetime object | ||
public function test_it_can_parse_date_string_into_datetime_object() | ||
{ | ||
$dateString = new DateString('2020-01-01 UTC'); | ||
$this->assertInstanceOf(DateTime::class, $dateString->dateTimeObject); | ||
} | ||
|
||
// Test it can format date string into a machine-readable string | ||
public function test_it_can_format_date_string_into_machine_readable_string() | ||
{ | ||
$dateString = new DateString('2020-01-01 UTC'); | ||
$this->assertEquals('2020-01-01T00:00:00+00:00', $dateString->datetime); | ||
} | ||
|
||
// Test it can format date string into a human-readable string | ||
public function test_it_can_format_date_string_into_human_readable_string() | ||
{ | ||
$dateString = new DateString('2020-01-01 UTC'); | ||
$this->assertEquals('Wednesday Jan 1st, 2020, at 12:00am', $dateString->sentence); | ||
} | ||
|
||
// Test it can format date string into a short human-readable string | ||
public function test_it_can_format_date_string_into_short_human_readable_string() | ||
{ | ||
$dateString = new DateString('2020-01-01 UTC'); | ||
$this->assertEquals('Jan 1st, 2020', $dateString->short); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters