You are here

public function TimeTest::testTimeOnDate in Time Field For Drupal 8.x / 9.x 2.x

Same name and namespace in other branches
  1. 8 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 51

Class

TimeTest
Tests time.

Namespace

Drupal\Tests\time_field\Unit

Code

public function testTimeOnDate() {
  $time = new Time(13, 40, 30);
  $dateTime = $time
    ->on(new \DateTime());
  $this
    ->assertEquals('13:40:30', $dateTime
    ->format('H:i:s'));
}