public function SmsFrameworkUserActiveHoursServiceTest::testFindNextTimeSameDayOutOfHours in SMS Framework 8
Same name and namespace in other branches
- 2.x modules/sms_user/tests/src/Kernel/SmsFrameworkUserActiveHoursServiceTest.php \Drupal\Tests\sms_user\Kernel\SmsFrameworkUserActiveHoursServiceTest::testFindNextTimeSameDayOutOfHours()
- 2.1.x modules/sms_user/tests/src/Kernel/SmsFrameworkUserActiveHoursServiceTest.php \Drupal\Tests\sms_user\Kernel\SmsFrameworkUserActiveHoursServiceTest::testFindNextTimeSameDayOutOfHours()
Test getting a range for next day when out of hours when a range was today.
File
- modules/
sms_user/ tests/ src/ Kernel/ SmsFrameworkUserActiveHoursServiceTest.php, line 180
Class
- SmsFrameworkUserActiveHoursServiceTest
- Tests active hours service.
Namespace
Drupal\Tests\sms_user\KernelCode
public function testFindNextTimeSameDayOutOfHours() {
$this
->setActiveHours([
[
'start' => '2016-03-15 tuesday 9:00',
'end' => '2016-03-15 tuesday 17:00',
],
[
'start' => '2016-03-12 saturday 9:00',
'end' => '2016-03-12 saturday 17:00',
],
[
'start' => '2016-03-13 sunday 9:00',
'end' => '2016-03-13 sunday 17:00',
],
]);
$user = $this
->createUser([
'timezone' => 'America/New_York',
]);
$now = '2016-03-12 saturday 5:00:01pm America/New_York';
$range = $this->activeHoursService
->findNextTime($user, $now);
$this
->assertEquals(new DrupalDateTime('2016-03-13 Sunday 9am America/New_York'), $range
->getStartDate());
$this
->assertEquals(new DrupalDateTime('2016-03-13 Sunday 5pm America/New_York'), $range
->getEndDate());
}