You are here

public function SmsFrameworkUserActiveHoursServiceTest::testInHoursDifferentTimezone in SMS Framework 8

Same name and namespace in other branches
  1. 2.x modules/sms_user/tests/src/Kernel/SmsFrameworkUserActiveHoursServiceTest.php \Drupal\Tests\sms_user\Kernel\SmsFrameworkUserActiveHoursServiceTest::testInHoursDifferentTimezone()
  2. 2.1.x modules/sms_user/tests/src/Kernel/SmsFrameworkUserActiveHoursServiceTest.php \Drupal\Tests\sms_user\Kernel\SmsFrameworkUserActiveHoursServiceTest::testInHoursDifferentTimezone()

Test if in hours with different timezone.

File

modules/sms_user/tests/src/Kernel/SmsFrameworkUserActiveHoursServiceTest.php, line 72

Class

SmsFrameworkUserActiveHoursServiceTest
Tests active hours service.

Namespace

Drupal\Tests\sms_user\Kernel

Code

public function testInHoursDifferentTimezone() {
  $this
    ->activeHoursStatus(TRUE);
  $this
    ->setActiveHours([
    [
      'start' => '2016-03-13 sunday 9:00',
      'end' => '2016-03-13 sunday 17:00',
    ],
  ]);
  $user = $this
    ->createUser([
    'timezone' => 'America/New_York',
  ]);
  $now = '2016-03-13 Sunday 4pm America/Los_Angeles';
  $this
    ->assertFalse($this->activeHoursService
    ->inHours($user, $now));
}