public function TimeTest::testTimeOnDate in Time Field For Drupal 8.x / 9.x 8
Same name and namespace in other branches
- 2.x tests/src/Unit/TimeTest.php \Drupal\Tests\time_field\Unit\TimeTest::testTimeOnDate()
Test time can attach to specific date.
File
- tests/
src/ Unit/ TimeTest.php, line 41
Class
- TimeTest
- Tests time.
Namespace
Drupal\Tests\time_field\UnitCode
public function testTimeOnDate() {
$time = new Time(13, 40, 30);
$dateTime = $time
->on(new \DateTime());
$this
->assertEquals('13:40:30', $dateTime
->format('H:i:s'));
}