public function TimeTest::testItCanBeCreatedByHtml5String in Time Field For Drupal 8.x / 9.x 2.x
Same name and namespace in other branches
- 8 tests/src/Unit/TimeTest.php \Drupal\Tests\time_field\Unit\TimeTest::testItCanBeCreatedByHtml5String()
Test it can be created by html5 string.
File
- tests/
src/ Unit/ TimeTest.php, line 36
Class
- TimeTest
- Tests time.
Namespace
Drupal\Tests\time_field\UnitCode
public function testItCanBeCreatedByHtml5String() {
$time = Time::createFromHtml5Format('13:40:30');
$this
->assertEquals('13', $time
->getHour());
$this
->assertEquals('40', $time
->getMinute());
$this
->assertEquals('30', $time
->getSecond());
$time = Time::createFromHtml5Format('14:50');
$this
->assertEquals('14', $time
->getHour());
$this
->assertEquals('50', $time
->getMinute());
$this
->assertEquals('0', $time
->getSecond());
}